Understand the Classics

Design patterns often make a design stronger. This is not a new idea, so it is no surprise that many design patterns are built into the Java class libraries. If you can spot the design pattern in a body of code you can grasp the design yourself and communicate it to others who understand design patterns. For example, if a developer understands the DECORATOR pattern, it is meaningful to explain that Java streams are decorators.

Here is a test of your understanding of some of the classic examples of design patterns that appear in Java.

  • How do Swing listeners use the OBSERVER pattern?

  • Why do menus often use the COMMAND pattern? How can you use the COMMAND pattern with Swing menus?

  • Why are drivers a good example of the BRIDGE ...

Get Design Patterns Java™ Workbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.