Chapter 8. Object-Oriented Techniques
8.0 Introduction
Java is an object-oriented (OO) language in the tradition of Simula-67, SmallTalk, and C++. It borrows syntax from C++ and ideas from SmallTalk. The Java API has been designed and built on the OO model and following many OO design patterns. The idea of “design patterns” originated with Christopher Alexander and colleagues at UC Berkeley’s Faculty of Architecture, as a way of teaching budding architects how to better design homes and offices.1 In the 1980s and early 1990s, computer science departments published catalogs of design patterns in computing. The 1995 book Design Patterns (by Erich Gamma et al., Addison-Wesley, often called the “Gang of Four” book [GoF], after the four authors) catalogued some two dozen of the best. These design patterns, such as Proxy, Strategy, and Delegate, are used throughout modern development; an understanding of these patterns will help you better understand the use of the Java API and improve the design of your own classes.
Most of the GoF book examples were originally written in C++. For Java developers, the pieces I wrote for Oracle’s Java Magazine include articles on half a dozen or so of these patterns. The book Head First Design Patterns by Eric Freeman and Elisabeth Robson (O’Reilly) describes all 23 GoF patterns, with examples in Java in a very entertaining and memorable fashion.
Advice, or Mantras
I could give you any number of short bits of advice on object-oriented ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access