O'Reilly logo

Java I/O by Elliotte Rusty Harold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Design Patterns

At the time I was writing the first draft of this book, I also happened to be learning about design patterns. Gradually, it became obvious that much of the AWT was written by programmers who had patterns on the brain. The java.awt.Toolkit class is a textbook example of the “abstract factory” pattern. The URL class’s openConnection() method is a factory method. The Reader and Writer classes are decorators on top of InputStream and OutputStream. The engine classes in the JCE are proxies, and I could cite many more examples. Much of the class library—including the java.io package—has been designed with design patterns, and it will all make a lot more sense if you’re familiar with the standard patterns.

The seminal text on the subject is Design Patterns, by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (Addison-Wesley, 1995). The four authors are colloquially known as the “Gang of Four,” and the book is often cited informally as “GoF.” The 23 patterns covered in GoF are rapidly becoming part of the vocabulary of the object-oriented programming community. Design patterns are also beginning to be covered in many more introductory books about object-oriented programming and Java.

There are also several extremely active mailing lists and web sites devoted to design patterns. To subscribe to the list send email to with the word “subscribe” in the Subject: field. Archives of this and several related lists may be ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required