Preface

I had my first programming experience when I was studying at Jilin University of Technology, China, in the 1990s. At that time, we were using mainframe computers, as personal computers (PCs) were not available in China. A mainframe computer is just one computer sitting somewhere in a room, and we connected to it through text-mode dumb terminals. As we connected to the mainframe computer using a shared account, a lot of strange things could happen. The program you created early on could be deleted or modified by someone else later. Printing was also a nightmare. For example, when you were printing your Fortran code, halfway through another student might send a printing request. The printer would immediately stop printing your code and start to print the other student's code. When finished, the printer would come back to resume printing the rest of your code. What kind of logic is that? So every time we wanted to print, we would shout “I am printing!” and hope others would not start to print their code at the same time. The programming language we used was Fortran, short for “formula translation.” Fortran is primarily designed for scientific calculations, and it is a very powerful language, but the Go To statement drove me crazy. It makes the code very difficult to read.

Later, when IBM PCs started to become available, our university also bought some IBM PCs and built a dedicated two floor building to host these computers. Yes, you heard me, a whole building was dedicated to these IBM PCs. The building was designed like a clean room, with red carpeting, and reception. You needed to take off your shoes, change into slippers, and wear a white lab coat to go in. The time for each student to use these computers was strictly limited.

Have you ever wondered why computer hard drives always start with Drive C, and not Drive A or Drive B? The reason is that in the beginning, IBM PCs did not have hard drives; instead, they had two 5¼ inch floppy drives. To use the computer, you needed two floppy disks—one floppy disk for the MS-DOS operating system, used to boot up the computer, and one floppy disk for saving your data. Each floppy disk could hold 512 KB of data. It could not fit even as much as a smart phone photo today. But that time, it was plenty. We started to learn the BASIC (Beginner's All-purpose Symbolic Instruction Code) programming language. BASIC is very simple to use, and we had endless fun with BASIC programming for both scientific calculations and drawing text based pictures.

I started to learn Java in 1997, just two years after it was first released by what was then Sun Microsystems, now part of Oracle Corporation. Since web pages at that time were pretty much just static text and static pictures, I was fascinated with Java's ability to create animations (Java Applets) inside a web page. But the time when I really fell in love with Java and fully appreciated its beauty was a few years later. I was preparing for an MSc module on Java network programming, and I was astonished by how simple it was to learn and use Java, especially for network programming. With just a few lines of Java code, you have a server!

I was also impressed with Java's memory garbage collection ability and the fact that Java has no pointers. C and C++ programmers, you'll be relieved to learn there are no pointers in Java! I had a tough time before Java, when I was using the C programming language for finite difference analysis and finite elements analysis. Pointers are variables to point to particular positions in memory, and they are essential for working with matrices. Ninety-nine percent of the time my programs crashed because of the mishandling of pointers. So I was over the moon when I heard there were no pointers in Java. Hallelujah! There is also no Go To statement in Java, which makes the Java code much easier to understand.

Java's exception handling is also worth mentioning. Java can “throw” exceptions. So when you run a program, if an exception/error occurs, for example, division by zero, reading a file that does not exist, or connecting to a remote computer that is not responding, instead of hanging the program or crashing the entire computer, Java will simply terminate the program and gracefully display an error message.

I have since developed many Java programs for teaching and researching. I have thoroughly enjoyed working with Java programming language, and I hope you will enjoy it too.

Dr. Perry Xiao
November 2018, London

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset