© Adam L. Davis 2020
A. L. DavisModern Programming Made Easyhttps://doi.org/10.1007/978-1-4842-5569-8_9

9. Design Patterns

Adam L. Davis1 
(1)
Oviedo, FL, USA
 

In object-oriented programming (OOP), design patterns are useful organizations of state and behavior that make your code more readable, testable, and extensible. Now that you understand classes, inheritance, objects, and the basics of programming, let’s go over some common design patterns—common ways of arranging application code.

Observer

The observer pattern allows you to broadcast information from one class to many others, without them having to know about each other directly (low coupling).

It is often used with events. For example, the KeyListener, MouseListener, and many other “Listener” ...

Get Modern Programming Made Easy: Using Java, Scala, Groovy, and JavaScript 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.