Character Interview: Best-selling writer Harold "Java IO"

zhaozj2021-02-08  581

Elliotte Rusty Harold

This article translated from O'Reilly US Corporate Website,

Don't think that Java can only design the dynamic graphics on the web page, in fact, Java is a fully functional programming, and is the first choice for many pristines today. Because the Java language has a clear architecture, providing dynamic memory management, the advantages of Web ..., which makes it more than the time required by the Java development program more than many other development tools. Best-selling writer Elliotte Rusty Harold Recently published book "Java I / O" detailed with us to understand the internal mystery of Java I / O. We specially invited him to accept our a few minutes of interviews, and against the direction of Java I / O planted by Sun.

Wayner: Which type of Java prister should be interested in Java I / O?

Harold: All Java programs should be interested in Java I / O. Almost all programs are less involved in I / O, although their destination has a thousand autumn. However, IO examples in textbooks often only limit the command line arguments and system.out.println (), but ignore the real program often need to read and write files, read and write networks, data encryption and decryption, from string SERIAL port delivery information, and database communication ... etc. We usually judge his profession through the ability to control I / O, and the more professionals from system.out.println ().

Wayner: In many intended impressions, Java is a tool for writing a webpage, but in fact, Java is a full-functional program. What do you think Java and C this two-functional programming language is more compared to I / O?

Harold: There is no doubt that Java's I / O tool is more comfortable, powerful, and easy to use than C / C . C / C and many other languages ​​assume read and written information from the equipment such as Yangchun terminal in the 1970s, can't keep up with the era, modern C / C pristines are deeply bitter. Java is the first mainstream language that abandon this baggage. Java designer has long realized the reading and writing of the file, and the communication between the network, and the communication of the series of information is important. "The first-year student program" reads into a number, output the value of the open root number. "Can match.

It is a pity that because the structure of Java I / O is quite different from that, many pristines don't know that it is actually very simple but very powerful. From my students' response, many online discussion districts, and mailing discussion letters, I found that most people asked if I should not ask. For example, someone often asks how to read a number from console. In fact, they should not deal with console at first.

Students always ask Java to have a similar usage similar to c (), I think this is to blame the professor without taught. You, a bunch of books on the market, often, when you start with Java, how to use Java to write SCANF () and printf () and other functions of C. I feel that the factors behind this phenomenon may be: "The author does not understand Java, especially Java I / O", or "the author directly uses the two-year unchanged PASCAL Chen year old case, lazy to spend the heart." It is already in 1999, and the user interface should be a graphic mode (GUI) instead of text mode. We need to introduce students to the modern GUI program design in the course of the system. Now, I am teaching graduate Java entry courses, and there are no more than 10% of the GUI programming experience in the students in the class. Of course, the user interface is GUI, does not represent the traditional I / O method is no longer important. But once you abandon console, you can design a clearer I / O interface, you can easily support files, networks ..., etc., use Java to have such benefits.

Wayner: As for the Applet designer of the Web, what is Java I / O affecting them?

Harold: Java's security mechanism strictly limits the I / O action that can be performed in the web browser. At present, the main browser has not supported Java 2 security model, so it is purely "theoretical, actually not actually." Moreover, most users do not relax with the user's permissions of the applet because they want the website designer. Therefore, the I / O used in general applets is mainly to establish a network connection between the original servers, or use Object Serialization, or RMI.

Wayner: When Microsoft began to build its own Java branch, it does not use RMI to change its own way, what is your view?

Harold: Microsoft does not have RMI because they have a Windows exclusive technology DCOM, Microsoft has also established the technology of ActiveX web pages to dynamically content with Java. But regardless of the DCOM or ActiveX, there is no market in the web design market, and Microsoft has given them to the benefits and certain purposes. In fact, the Object Serialization mechanism in RMI and the underlying is really scary, and the Yuan fierce is Java itself. Most large, non-Applet project I have contacted is to choose CORBA, rather than Microsoft's DCOM or Java RMI.

Wayner: Do you think NC does not want to download the software back in an applet? Is there this possible in the new version of Java 2?

Harold: If this is true, it will not be on the PC or any computer platform. TV player or video receiving box (SET-TOP BOX) is a platform for this way.

Wayner: Sun is sufficient for the support for multi-cultural multi-language through Unicode? Or just talk one?

Harold: From Java 1.1, Java I / O category has fully supported internationalization. The main problem is that the programs are not familiar with this, because they always use the programs that do not support internationalization (compared to C or PASCAL), in Java I / O, in fact, there is no Factory. Once you know how to cut the function between the languages ​​of different countries in Java, and know their connection method, you can use it as soon as you want to reach the same purpose, you will find that it is difficult to complicate. Control. Wayner: Is there any I / O function Sun still need to strengthen or expand?

Harold: At present, Java does not support the bit group format "" Little Endian ", or other order value (more than the floating point number of VAX). However, I have designed some categories in the "Java I / O" book to tell the readers how to read and write special formats to streams. These categories can also be easily connected to each other with standard data streams.

Wayner: Do you think Java needs to support more encoding?

Harold: It is clear that we need Java to support new Latin-0 segments to include Euro symbols. And Unicode 3.0 will be released for another few months. Java needs to do some corresponding fine-tuning behind the scenes, such actions cannot affect most existing programs. And IBM claims that Sun will make the EBCDIC conversion code, this is also improved (I personally think this is the IBM fault, if they have the statement of the ebcdic standard and organize its documents, today EBCDIC will not be chaotic . In addition to the above problems, Sun is actually not good on supporting most collections.

Wayner: Many people complain that there are many differences in the Java environment of different companies. Do you have any serious problems? Where should we pay attention to?

Harold: I / O largest problem in java.io.file. Although it has been improved in Java 2, its UNIX blood is still revealed. Java.io.file is working very well on UNIX, but it is OK on Windows, but can't help it on the Mac, because Java.IO.File has made many simplified simplification of "What is the file. Sex assumptions, many of these plus counterfeits are only compatible with UNIX environments without applicable in non-UNIX platforms. There are also some potential problems, and the side is determined that as long as two arbitraries that cannot appear in the file, they can be used as the separated symbols of the file as a file name, such supplementation and MAC will produce. Conflict, for Mac, only one font cannot be used as part of the file name. This requires some row-of steps when Java is ported to the Apple computer.

Wayner: Last question: Do you think sun is not a good job in making Java cross-platform? Or do you think some places are too unix?

Harold: For cross-platform, AWT is a big trouble. I know that a GUI category library that can span Windows, Mac, and Motif is quite difficult, but SUN is trying to try. However, after Java 2 and SWING came out, the situation has improved. Although there is already improved, Java is still very foot because it comes from many UNIX pristines, and these people don't know much about Windows and Mac. The Java Internet API (more than square: java.net.socket, java.net.serversocket) is also quite unix. However, in fact, Windows and Mac are also very similar to UNIX, so, in the Java network API, it is not easy to detect Unix flavor.

-------------------------------------------------- ------------------------------

转载请注明原文地址:https://www.9cbs.com/read-255.html

New Post(0)