[UKUUG Logo] Copyright © 1995-2004 UKUUG Ltd

UKUUG


[Back]

Newsletter Section 2

Reviews




Java in a Nutshell

David Flanagan
O'Reilly & Associates, Inc
ISBN 1-56592-183-6

Exploring Java

Pat Niemeyer & Josh Peck
O'Reilly & Associates, Inc 426 pp
ISBN 1-56592-184-4
(Reviewed by Lindsay Marshall)

The number of books on Java is already bidding fair to rival those on C++ and we hope to bring you reviews of as many of them as we can, as and when we get hold of them. So to kick off, here is a pair of books from that most consistent of publishers of quality computing books - O'Reilly & Associates.

As you would expect from their previous books these are well produced, attractive volumes that are a pleasure to read with well chosen typefaces, good paper, clear diagrams and lots of solid information. In fact, of all the Java books that I have seen so far, these are easily the best. If you are an experienced programmer and want to get to grips with Java as quickly as possible, working with these two books will give you the best possible start.

If you have started to play with Java, I am sure that you too will have been frustrated by the lack of accessible documentation of the various libraries that are what make Java a useful system. You can of course poke around in the code of the innumerable applets and applications that are available on the web, to see how other people have solved various problems, but this is really no substitute for a decent manual - particularly one that you can read on the bus going home.

Java in a Nutshell goes a long way to filling this niche. It provides a rundown of all the interfaces available to you in Java 1.0 and has lots of extremely useful examples to show how to put together various different kinds of systems.

The treatment of the actual Java language is, to say the least, succinct, but if you are coming from a background of C++ programming then you will find this a great relief as you do not have to wade around in detailed descriptions of looping constructs! However, if you are not familiar with C++ this is probably not the best place to start. Get up to speed with the language and then come back to this book when you start to program seriously.

What this book does well is to collect together the interface specifications in a readable format. What it doesn't do is to give details of what every last member function in each class does. This is really the only weakness in the book, but of course, if all that detail were included, the book would be at least three times the size, not to mention three times the price. What it does do though, is give you a handle on where to look in the online documentation that comes with the Java system so that you can quickly find out if a particular function does what you want it to do. (The

function names are usually well chosen, so their intended purpose is generally clear from the context in which they appear.) Yes, you're right, this is a book in that long UNIX tradition of books based on the manual pages, but it's a good one for a change.

The other ORA book, Exploring Java, is much more of a proper textbook on Java programming, though I would still not recommend it to people without some C++ or other OOP experience. It proceeds at a fairly cracking pace once it has got going but is none the worse for that. Each of the important areas of Java - Threads, Networking, Graphics - gets its own chapter (two for graphics) and there are many clear examples. I particularly like the sequence of examples that takes you from a simple, flickery image dragging program to one that is much smoother. This not only provides an insight into what most people seem to want to do with Java programs, but also shows up the reality of how difficult it is to achieve good results.

This book does not pretend that Java is easy to use or that anyone can become a prize winning Java jockey overnight. Java is new (a least to those of us not involved in its development) and few idioms have developed yet. This book makes a start on documenting those that are establishing themselves now, which is really the best you can hope for at the moment. You can certainly create some pleasing applets based on the ideas here, assuming of course you have the graphic design skills needed to make the images in the first place...

In summary then, given the current state of Java development these two books will give you the start you need to becoming fluent in the language. A year from now, I don't know whether they will still do this, but by then everything will have changed again anyway, so strike those hot irons and get these.



Active Java: Object- Oriented Programming for the World Wide Web

Adam Freeman & Darrel Ince
Addison-Wesley 1996
ISBN 0-201-40370-6

and

Essential Java: Developing Interactive Applications for the World-Wide Web

Jason J Manger
McGraw-Hill 1996
ISBN 0-07-709292-9
(Reviewed by Ana von Klopp)

The Java Language is largely based on C++ and although it is simpler in some aspects (there are no pointers for instance), there is no significant difference in complexity with respect to the basic language constructs. As a consequence, learning Java requires as much effort as learning the basics of C++ unless you are familiar with the latter.

Neither of the books reviewed here expect their readers to know C++ which means that the authors initially face the same task as somebody who is teaching that language. As readers, we ought to be able to expect something similar to the first part of a C++ book; probably starting with the compiler, showing a simple program and how to run it, progressing to data types, to the language constructs, etc. (There may be alternatives, but it would seem sensible for the early Java

book authors to follow a tried and tested format, especially in view of the time constraints no doubt imposed on them.) C++ books typically take well over a hundred pages to do this, and there is no reason to expect anything different with Java: a switch statement is a switch statement (whether or not you know Pascal). There are no shortcuts, unless you assume that the readers know C++.

Neither of the books reviewed here are anything like this, of course. Essential Java devotes a mere sixteen pages to the basics of the language, Active Java twenty-six. Even if the aim is to give a “gentle introduction” (Active Java) surely the solution is not to pretend that the complexity does not exist, but to devote more effort to the explanations.

Essential Java is targeted at PC users and assumes no programming experience. It begins with a chapter on installing the Java Development Kit and Netscape on a PC. The next part of the book deals with JavaScript and the final part with Java. The JavaScript chapters basically list the various language construct in alphabetic order, and could be better organised (discussing everything related to the Math object together, say) but a reader who is familiar with HTML could nevertheless find it useful. The Java part consists of four chapters. In the first one, Manger explains how to compile and run Java applets and applications, shows how to incorporate an applet into a HTML document, introduces the language and describes the structure of an applet. Subsequent chapters deal with the Java Abstract Window Toolkit (AWT), Threads and File I/O and interprocess communication.

The first Java chapter attempts to cover a wide range of topics with the obvious consequences. It is also infected with mistakes ( n++ returns n+1 , an array declared as days[30] has 31 items because Java arrays start at 0, data members must be declared static if they are to be accessed from outside the object, all classes are derived from the Applet superclass, etc., etc.).

The rest of the chapters build on this foundation. Most of the code samples read as if Manger has adapted code from working applets without understanding them: several contain a switch statement with a single case and no break; variables which should pass on information are not used; classes are given return type “void”. Manger describes himself as a freelance writer and Internet consultant, and comes across as a cheerful Internet enthusiast; he even encourages people to mail him personally with their queries. Freeman and Ince have a different background, working at the Open University - Ince has a chair in computing and Freeman works on the Stadium project, a large and impressive Java application - which should make them better placed to write a programming textbook.

In contrast to Essential Java, Active Java assumes a background in programming (though not in C++). It consists of an introduction followed by chapters falling into five categories: a general introduction to object-oriented programming (chapters 2 and 3); the Java language: data types,

control structures and the implementation of classes (4 and 5); Java libraries (6-8); how to compile and run applets and applications and the structure of applet/applications (9- 11); and finally a discussion of the underlying technology (12).

This is a peculiar organisation, unless you are not meant to practice while you learn. The writing would have benefited from proof reading, as there are chunks of text which do not fit in, unrelated concepts which are explained in the same section and at times outright schizophrenia: material is duplicated and accompanied by statements insisting that you have not seen it before.

There are frequent errors and inconsistencies in the code examples which are annoying, but not very important, compared with more serious errors and omissions in the chapters introducing the basics of the language. For instance, to use an array consisting of complex objects, not only the array but also each object in the array have to be initialised (this is probably the one Java feature everybody stumbles on). But this is not mentioned, and there are also several “code” samples in chapter 5 where arrays are not properly initialised.

Unlike Manger, Freeman and Ince do discuss keywords specifying access levels, but Java uses the same keywords as C++ and the text appears to reflect their functions in C++ which are different from those in Java. It would have been useful to explain how they actually work, to mention that you cannot have two public classes in the same file, that “protected” is in fact the default (instead of suggesting that it is uncommon), etc. There are many similar discrepancies.

I am beginning to emulate “Disgusted of Tunbridge Wells”, but these books genuinely bother me. I have read badly written programming books before, but the problem was usually poor organisation and they could have been improved with more time and/or editing. They did not leave me thinking that the author probably did not know the language very well, which is what these books do. If they are representative of the recent Java books, the best sources for learners are still the various Java sites on the World Wide Web.

Ana von Klopp writes interactive computer aided learning material for linguistics students. A demonstration is available at http://www.linguistics.bangor.ac.uk/ java/lt/LingTutor.html

UNIX Internals: The New Frontiers

Uresh Vahalia
Prentice Hall 601pp
ISBN 0-13-101908-2
(Reviewed by Virantha Mendis)

Recent years have witnessed many enhancements being made to the UNIX operating system, notably multi-threaded processing, distributed processing, micro kernel technology, multiprocessing and improvements to the virtual memory management system. These changes have been prompted by the computing architectural model we use today, the client-server model, and the need for the growth of computing power required by users and applications. All this has made classic texts such as Bach's "The Design of the UNIX Operating System" out of place in the modern UNIX world and has generated a need for new texts to cover the current technology. This book from Uresh Vahalia attempts to cover this new ground.

This is a hefty book that spans over seventeen chapters and five-hundred plus pages. Almost all aspects of the UNIX operating system are covered and logically arranged. Each chapter is written in a structured manner that makes reading easier. The chapters contain the main text, summary, exercises and references.

It is possible to identify three types of chapters in the book. The first type covers traditional features of UNIX such as "The Process and the Kernel", "Interprocess Communications" and "Virtual Memory". The second type of chapter discusses more recent advancements made to traditional features to make the feature more acceptable for current computing usage. The discussion on "Process Scheduling" looks at the traditional view of the subject and the modifications made in the Solaris 2.X, SVR4, Mach and DEC UNIX to create more functionality and efficiency. The final type of chapter deals with completely new features that have been added to the old UNIX to make it a viable operating system in the 90's. These include "Advanced File Systems" and "Threads and Lightweight Processes".

Overall, the text is well presented and the material is thoroughly researched for inclusion in the book. Some of the text is "heavy going" but when describing the internals of several flavours of UNIX this is not surprising. The book is suitable for undergraduate students in an advanced operating system course and for anybody who is interested in the aspects of UNIX internals.



Exploring Java

Pat Niemeyer & Josh Peck
O'Reilly & Associates, Inc.
ISBN: 1-56592-184-4
426 pages, price $24.95
(Another perspective from Virantha Mendis)

The introduction of the Java programming language by Sun Microsystems has taken the Internet by storm. The only other event to parallel this was the creation of the World Wide Web itself, to provide easy access to the vast amount of information buried on many thousands of computers. Java's success and growth is

directly related to that of the WWW. Sun has pushed the language as the main contender for creating network capable applications to work on the WWW and the early decision by Netscape to include Java support in their WWW browsers has given the language its prominent place.

The past few months have seen the publication of many books on Java. This book, "Java Programming", from O'Reilly, is aimed at the absolute beginner who wishes to explore the language and to create his/her own Java applets and applications.

The book is arranged in three logical sections: a quick tutorial, the Java language and Java associated tools and the class libraries. The introduction to the language and the tutorial is presented in chapters 1 and 2. As is customary in books about programming, an "Hello Web!" Java applet is quickly developed to offer the reader a jump start. This applet is refined and several versions of the applet are used to introduce new concepts such as methods and events.

It is vital to know how the Java language handles object-oriented concepts in order to write efficient Java applets and applications. Several chapters from the book are devoted to presenting this information to the reader. The last section of the book covers topics such as input/output, threads in Java and network programming. As in many O'Reilly books it is easy to read and provides the reader with valuable suggestions on how to become a good Java programmer.

I work for Biotechnology & Biological Sciences Research Council Computing Centre and provide second level UNIX support. BBSRC Computing Centre is reponsible for providing computing support for various research institutes in food and agriculture.

Post.Office

(Bob Dowling)

A new MTA/MDA POST.OFFICE is described by its creators, Software.Com, as “The ultimate E-mail server for the Internet” and as “simple, powerful, secure”. So, before the box was even open they had tickled two pet peeves: gratuitous punctuation in the middle of names and trademark symbols splashed all over the box.

However, putting my prejudices behind me, I opened the box, installed the software, played with it for a couple of nights and was rather pleasantly surprised. This is what I found...

The product Post.Office is a package consisting of a mail transfer agent (MTA), a mail delivery agent (MDA), a POP3 server, a finger daemon and a web server. The web server provides the administrative interface to Post.Office, offering a forms system to configure the mail system as a whole and to configure individual mail accounts. There is also an e-mail based forms interface, but I emulated my impression of the average user who believes that Netscape is the Internet and stuck with the WWW server.

Post.Office supports mail accounts which have nothing to do with the system's user accounts. While the users of the UNIX system it runs on can use their accounts for e-mail, a POP service is also provided to users who have nothing to do with the UNIX system itself. It is not possible to use both local delivery and POP fetching conveniently. The mail accounts need not be in the same mail domain. One instance of Post.Office can support bob@grumble.co.uk and bob@whinge.co.uk and treat them as entirely separate entities.

Software.Com's description of Post.Office as “Simple, powerful, secure” triggered an immediate thought of “pick any two”, but a reasonable balance has been struck. The simplicity of use has not just been left as “it's got a WWW interface so it must be simple”, but instead some serious thought has gone into the layout of the forms and the division of tasks between forms.
Forms can be divided into administration forms (for the postmaster only) and the user forms (for each user). On first accessing any of these forms the user is challenged for an id and a password. The users can use their forms to set up responses to finger queries, automatic replies to mail messages and so on. The administrator can use the administration forms to set up the mail system for most reasonable configurations.

Each label on the form is a hot-link to on-line documentation. This can be a recipe for disaster, “hypertripe” as a colleague calls it, but again I was pleasantly surprised. The links are links into an on-line copy of the manual (or very close approximation thereto). The paragraph of manual linked to is, in itself, not necessarily useful, but because I was placed inside a coherent manual rather than in an isolated paragraph of text, I could read the surrounding text and found the help to be extremely good because of it. My typical means of working was that, if the link took me to a paragraph, I would read the surrounding subsection, if it took me to a subsection I would read the surrounding section and so on. This seemed to work well.

The power is demonstrated in two ways. The support for multiple domains is a very useful feature in complex set ups; Post.Office is clearly not just designed for very simple sites with the assumption that complex sites will have someone who speaks sendmail.cf fluently. The users can set up a variety of auto-reply features from their account form and there is also support for piping incoming e-mail to programs such as procmail with the approval of the administrator. This feature is flagged as being UNIX-only, but then you wouldn't want to run any other operating system, would you?

The security is addressed in three different ways. The administrator can set up a description of those systems whose browsers are allowed to access the system (only this host, only these hosts, only hosts in this domain, ...) so that even the compromise of the postmaster password will not necessarily compromise the system, unless the enemy can also get to a trusted machine. If Post.Office itself is compromised ( sendmail is notorious as a security weakness) the enemy still does not get full access to the system. Post.Office does not run as root, but as its own user ('mta', for example). So while this might expose your e-mail, it will not expose your whole system (and hence your entire network).

Finally, if your e-mail users are not given UNIX accounts on the Post.Office system and their passwords are compromised, the enemy can still not get shell access to the system (from which the root account might be accessible via another security hole). If user 'mta' does not have a valid shell then access via the 'mta' account is even more

difficult. It is worth emphasizing that the administration of the system is done through the postmaster mail account (recall that Post.Office accounts are totally unrelated to UNIX accounts) and this is therefore completely separate from the root account on the UNIX host.

So, “simple, powerful, secure”? Yes, configuring it is simple, yet it is powerful enough for a good many purposes and some thought has gone into its security. The mail system itself proved to be reliable. The SMTP daemon provided extended SMTP support and is the first I have seen to support the SIZE directive. The POP daemon worked perfectly well with Eudora, the most common POP client. It is necessary to decide once and for all if a user with a UNIX account is to have local delivery (in the UNIX style) or whether the mail is to be stored for subsequent retrieval by POP. A user cannot mix and match.

All the associated mail facilities are provided: vacation programs, auto-replies, forwarding, aliases etc. The finger daemon is provided as part of Post.Office, overriding the system one. This is necessary to allow access to the mail-only users who lack the UNIX accounts visible to the UNIX finger daemon. The Post.Office finger service has an interesting shortcoming, though. The classic UNIX finger program typically indicates if there is any read or unread mail in the user's inbox. For a finger daemon bundled with a mail package, I would have expected finger to support this feature but it doesn't. Finger is provided purely to identify mailboxes on the system and not to provide information on their status.

Paper documentation

The box contains a ring-bound manual and the media. Setting aside the media for an hour I pulled up a cup of coffee and sat back to read the manual. Four sentences into page 1 I came across the line “Depending on your needs, you may never need to read as much as 90% of this manual.” It then describes what the chapters are, to help you find the 10% that you should read. It starts in chapter 1 by describing e-mail in the abstract, introducing the concepts and jargon an e-mail user should be familiar with. This chapter would make a good 10% for every single user of an e-mail system and I wish some of my users knew half this much! It also has the quite remarkable property of acknowledging the existence of alternative MTAs ( sendmail ) and of MUAs that don't interoperate with Post.Office ( pine ).

Chapter 2 describes the architecture of Post.Office itself and gives a description of its features. This is definitely part of the 90% unless you are the e-mail administrator. Chapter 3 covers installation, transition from your old e-mail system to this new one and even deinstallation if you don't like it. The installation guide covers the necessary network work and concepts as well as the work on the machine itself. Chapters 4, 5 and 6 cover the routine management of Post.Office by the administrator. Chapter 7 covers the assorted automatic mail-handling programs that can be set up (mainly for auto-reply) and chapter 8 covers security.

Deciding I was a “100% administrator” rather than a snivelling “10% user”, I read the manual cover to cover. It is well written and contains everything you might reasonably want to know about Post.Office.

Installation

My copy came on two floppies in an envelope sealed with one of those agreements that is quite possibly invalid in this country, saying that breaking the seal means you accept the licence (pet peeve number three). So I sliced open the top of the envelope, leaving the seal intact, and removed the floppies. The data on these disks had to be untarred, glued together, uncompressed and untarred again. This gave a standard Solaris 2 package which pkgadd installed without a hiccough. The installation asked what userid is to be dedicated to Post.Office and some more guidance on setting up this pseudo-user would have been useful. I chose the suggested id “mta”, but had to decide myself details like the shell and home directory. I'd like to think they were irrelevant, but with an eye on security, I set the home directory to be /tmp and the shell to be /bin/false . The installation also offered to create Post.Office mail accounts corresponding to each of the UNIX users.

The installation revealed the only bug I found in the system. The file sendmail in /usr/bin is backed up to sendmail.bak and replaced with a symbolic link to the Post.Office binary. The start up scripts for Post.Office are placed in /etc/init.d with the correct links set up from the rc?.d directories. However, the sendmail start up scripts are not removed. These test for the existence of /usr/lib/sendmail and, by resolving the link, find a file so they try to start it with sendmail arguments. Meanwhile, when Post.Office tries to start up, it finds a mail system already running. I suggest clearing out sendmail and its start up scripts prior to installing Post.Office. After this modification, the installation works fine.

Conclusion

It's a decent product. I would consider it quite suitable for small and medium sized companies where creation of user accounts is done on individual request to the admin. It has been carefully designed to avoid as hard a learning curve as comes with sendmail and the company system administrator should have no problem running it. The manual has been well designed and integrated into the product and contains enough information on e-mail, beyond the installation and use of Post.Office, to be all that the system administrator needs to run the product.

Bob Dowling has just finished eight months hard labour as a postmaster and mail system administrator. He has now joyfully returned to his original job as UNIX system troubleshooter in the University of Cambridge's Computing Service.


[Forward]
Tel: 01763 273 475
Fax: 01763 273 255
Web: Webmaster
Queries: Ask Here
Join UKUUG Today!

UKUUG Secretariat
PO BOX 37
Buntingford
Herts
SG9 9UQ