Read an Excerpt
PREFACE: Introduction
Thanks a million!
Writing a book is a time-consuming and arduous process with incredible rewards from both a career and personal perspective. While this entire book is written in the plural first person as a nod to my contributing author, Bill Rieken, I want to take a moment and thank each and every single person who helped me in this endeavor. It has always been my lifelong dream to write a book, and now that I've actually done it I realize it could never have been possible without the great many folks who stood by me.
The first thing moonlighting authors begin to realize is that the free time they once had to hang out with friends, watch "ER," and take a weekend flight to the Red- skins game is lost. I actually met my girlfriend three weeks before I began writ- ing. Amazingly, she's still with me after several nights of "sorry sweetie, I gotta write." I love you Jenn! My mom and my sister may be the women behind this man, but Jenn is most definitely the woman beside him. Thanks to all three of the most incredible women on the face of the planet!
Extra special thanks go to Bill Rieken, who helped me by getting those darn sock- ets straight! He was an extraordinary help in outlining some of the security prob- lems that the Internet brings to the network programming table. Bill is a mad scientist, a jolly old man, and a two-year old all rolled into one. Working with him has been and always will be a blast.
My friends were terrific throughout the entire process. Dave Krause dutifully called me after every Redskins loss to cheer me up, (Ensign) Daniel Orchard-Hays tried to get me to golf,Jon Hogue was around (somewhere), and somehow I man- aged to make it to Doug Jelen's wedding where I didn't even stumble with my best man's speech ("I've known Doug forever, and I would be the first to say that his garbage collection algorithm was implemented exceptionally well.")
Sydney Springer and Maurice Balick gave me my start in Silicon Valley, and they are two of the most wonderful people in the world. Hellene Garcia whined con- stantly about 49er superiority, Karin Stok-Harrison was a sweetheart, James McIlree made fun of my BMW, Janet Koenig made me laugh, and Laraine Peterson was a scout leader. I love all the engine ears and marketeers at SunSoft Object Products, especially Ken Oestreich and Manish Punjabi, my marketing conscience. My manager, Jeff Zank, was incredibly understanding and belied my experience with managers when I told him I needed "time to edit." This business is about people, and Jeff understands that.
Over at Prentice Hall, Ralph Moore made sure my manuscript was nice and neat. And, Mark Taub got me signed up to write a book to begin with. He showed remarkable trust in letting a kid write a book! Sean Donahue masterfully cor- rected my engineering-tainted English, and Eileen Clark made sure the produc- tion schedule didn't go through the roof.
Finally, Larry Pass, Fred Kuhl, Bill Rieken, Laraine Peterson, and Bob Goldberg helped me make sure everything I wrote was correct and useful. Ultimately, how- ever, the onus is on me to make sure everything is right, and I accept the blame for anything that may have gone wrong. It amazes me that a Computer Science- dropout-turned-English-major could end up in Silly Valley, in the hottest field imaginable, writing a book, and evangelizing Java for the best company in the Valley. Thanks to all the men and women of Silly Valley without whose passion, drive, and energy I would have been a lost soul long, long ago.
Prashant Sridharan
How to read this book
By now you've seen all the hype, read all the books, and discovered all the won- ders of Java. But, most of us still use C++ or C to create our hard-core applications, saving Java for our Web pages or leaving it to HTML jocks to fiddle with. Doing so denies us the opportunity to use a programming language that makes interfacing with a computer infinitely easier, with less frustration and faster results.
Java is much more than "Dancing Dukes" or a programming language for Web pages. It is a strong alternative to the masochistic programming of the pastÑPro- gramming in which countless months were spent debugging, in comparison to the mere days it took to code the initial concept. Java allows us to spend more time in the conceptual phase of software design, thinking up new and creative ways to bring the vast knowledge of the Internet and its many users to our desktop.
Gone are the days of reliance solely on the machines sitting in our offices, resting in the living room, or gathering dust in the kitchen. Today, our information, and the steady flow thereof, is garnered from the millions of our fellow computer users around the world, not only from a shiny disc we slip into the little slot on the front of our machine.
Up until now, you've no doubt designed programs to interface with that knowl- edge using C or C++. Java, however, will change all of that. Residing alongside its ability to create adorable and functional user interfaces quickly and easily is the capability to easily connect to the Internet. Java, after all, is The Internet Language.
What this book is all about
Advanced Java Networking is designed to present you with a myriad of alternatives to connect your applications to the Internet. It is neither a programming reference nor a marketing brochure. We'll leave that to the geeks and marketeers to battle out. Instead, we wanted to explore each alternative without marketing bias or engineering snobbery.
One part of the engineering community will tell you that plain vanilla sockets are the only true way to communicate information over a network. Another will pur- port that Java-only applications relying on Remote Method Invocation (RMI) will solve all your communication problems. Then, of course, there is the Common Object Request Broker Architecture (CORBA) camp. We will present you with an honest account of each alternative, as well as guidelines for choosing what's best for your business or programming needs. In addition to the hundreds of lines of sample code we will supply to help you start from scratch with Java communica- tion, we will place an additional emphasis on migration of your existing desktop- centric applications to an Internet-ready world.
Who should read this book
We assume that you have a strong object-oriented programming background, preferably in Java. You should have a strong grasp of Java fundamentals such as how to create a class, how to compile and execute programs on your native sys- tem, and how to deploy Java applications. Furthermore, you should understand a good deal of the terminology of the object-oriented world. In this book, we do not attempt to cover these details as this is not an introductory Java text.
How to read this book
We've divided this book into parts, and each part into chapters. Each part addresses one aspect of Internet programming, be it Java Fundamentals, Core Networking like RMI, CORBA, or Java Database Connectivity (JDBC), Advanced Networking like Beans and Java Web Servers, or some general Java Networking Information in which we've included a special chapter on Internet security that will address simple Applet Security restrictions, as well as more complex subjects such as good ol' Kerberos.
Finally, we want to show you that Java programming is much more than an ani- mation floating by a Web page, or interactive Internet content. Java is a language that the authors of this book truly, honestly believe in. We make no effort to con- tain our enthusiasm for it, and certainly don't apologize for our delight in work- ing with it. We hope that you will come to love this language as much as we have.
Where to begin
It's hard to believe, but Java is a little more than a year old! In the span of one year, a hundred or so books have been written on Java! Following is our honest appraisal of what we believe are the top three Java programming books on the market today. We feel these books, along with this one, will give you one heck of a Java library.
You will find that our code samples, as robust and well-documented as they are, sometimes will contain Java routines that seem esoteric. While we consider them essential, Java programmers who are unfamiliar with the language's powerful communication tools will find them strange and daunting. We do our best to explain them as well as we can, but we make no attempt to be exhaustive in our summary. These books will give you the proper foundation to build your net- worked applications.
In addition, there are several Java workshops and classes from which to choose. We have seen or have attended a few of them, and we chose one that we feel pro- motes the language properly, and teaches the material in a pleasing and fun man- ner. After all, Java should be fun. No more pointers!
Core Java, Gary Cornell and Cay S. Horstmann, Sun Microsystems Press (Prentice Hall), 1996, 607 pages
Core Java is an essential component of your Java library. While most of the Sun Microsystems Press Java titles are geared towards highly differing audiences, Core Java explains just about every feature of the Java language in a manner amenable to the hard- core programmer. If you are reading this book, more than likely you subscribe to the "Java as Internet Language" theory, so you will find the Socket section partic- ularly enlightening. The new second edition covers the Java Developer's Kit ver- sion 1.1 in depth and introduces JDBC.
Java in a Nutshell, David Flanagan, O'Reilly and Associates, 1996, 438 pages
O'Reilly and Associates have another gem on their hands with Java in a Nutshell. This book is a programming reference in the purest of terms. Most of the analysis is somewhat unhelpful, but the explanation of Java's core classes is unsurpassed. The diagrams are wonderful, and you will appreciate having the headers for every class in front of you.
Exploring Java, Patrick Niemeyer and Joshua Peck, O'Reilly and Associ- ates, 1996, 407 pages
Think of this book as the perfect companion to Java in a Nutshell. Niemeyer and Peck are a bit wordy and are sparse on coding examples, but they make up for it with a decent explanation of the concepts behind the language.
"Advanced Java Networking," Visigenic Professional Services (Palo Alto, CA)
Salil Deshpande has developed a course that we believe highlights Java's commu- nication aspects in a frank, informative, and fun manner. Salil steps through the various communication alternatives using a fast-paced, hands-on approach that ought to be the envy of any Java course available. A course syllabus is included in the following sidebar for your reference. Please contact Visigenic Professional Ser- vices directly through their Web site: ...