Skip to main content
Top

2019 | Book

Java Design Patterns

A Hands-On Experience with Real-World Examples

insite
SEARCH

About this book

Get hands-on experience implementing 26 of the most common design patterns using Java and Eclipse. In addition to Gang of Four (GoF) design patterns, you will also learn about alternative design patterns, and understand the criticisms of design patterns with an overview of anti-patterns. For each pattern you will see at least one real-world scenario, a computer-world example, and a complete implementation including output.

This book has three parts. The first part covers 23 Gang of Four (GoF) design patterns. The second part includes three alternative design patterns. The third part presents criticisms of design patterns with an overview of anti-patterns. You will work through easy-to-follow examples to understand the concepts in depth and you will have a collection of programs to port over to your own projects.

A Q&A session is included in each chapter and covers the pros and cons of each pattern. The last chapter presents FAQs about the design patterns. The step-by-step approach of the book helps you apply your skills to learn other patterns on your own, and to be familiar with the latest version of Java and Eclipse.

What You'll Learn

Work with each of the design patterns

Implement design patterns in real-world applications

Choose from alternative design patterns by comparing their pros and cons

Use the Eclipse IDE to write code and generate output

Read the in-depth Q&A session in each chapter with pros and cons for each design pattern

Who This Book Is For

Software developers, architects, and programmers

Table of Contents

Frontmatter

Gang of Four Patterns

Frontmatter
Chapter 1. Singleton Pattern
Abstract
This chapter covers the singleton pattern.
Vaskaran Sarcar
Chapter 2. Prototype Pattern
Abstract
This chapter covers the prototype pattern.
Vaskaran Sarcar
Chapter 3. Builder Pattern
Abstract
This chapter covers the builder pattern.
Vaskaran Sarcar
Chapter 4. Factory Method Pattern
Abstract
This chapter covers the factory method pattern.
Vaskaran Sarcar
Chapter 5. Abstract Factory Pattern
Abstract
This chapter covers the abstract factory pattern.
Vaskaran Sarcar
Chapter 6. Proxy Pattern
Abstract
This chapter covers the proxy pattern.
Vaskaran Sarcar
Chapter 7. Decorator Pattern
Abstract
This chapter covers the decorator pattern.
Vaskaran Sarcar
Chapter 8. Adapter Pattern
Abstract
This chapter covers the adapter pattern.
Vaskaran Sarcar
Chapter 9. Facade Pattern
Abstract
This chapter covers the facade pattern.
Vaskaran Sarcar
Chapter 10. Flyweight Pattern
Abstract
This chapter covers the flyweight pattern.
Vaskaran Sarcar
Chapter 11. Composite Pattern
Abstract
This chapter covers the composite pattern.
Vaskaran Sarcar
Chapter 12. Bridge Pattern
Abstract
This chapter covers the bridge pattern.
Vaskaran Sarcar
Chapter 13. Visitor Pattern
Abstract
This chapter covers the visitor pattern.
Vaskaran Sarcar
Chapter 14. Observer Pattern
Abstract
This chapter covers the observer pattern.
Vaskaran Sarcar
Chapter 15. Strategy (Policy) Pattern
Abstract
This chapter covers the strategy pattern.
Vaskaran Sarcar
Chapter 16. Template Method Pattern
Abstract
This chapter covers the Template Method pattern.
Vaskaran Sarcar
Chapter 17. Command Pattern
Abstract
This chapter covers the command pattern.
Vaskaran Sarcar
Chapter 18. Iterator Pattern
Abstract
This chapter covers the iterator pattern.
Vaskaran Sarcar
Chapter 19. Memento Pattern
Abstract
This chapter covers the memento pattern.
Vaskaran Sarcar
Chapter 20. State Pattern
Abstract
This chapter covers the state pattern.
Vaskaran Sarcar
Chapter 21. Mediator Pattern
Abstract
This chapter covers the mediator pattern.
Vaskaran Sarcar
Chapter 22. Chain-of-Responsibility Pattern
Abstract
This chapter covers the chain-of-responsibility pattern.
Vaskaran Sarcar
Chapter 23. Interpreter Pattern
Abstract
This chapter covers the interpreter pattern.
Vaskaran Sarcar

Additional Design Patterns

Frontmatter
Chapter 24. Simple Factory Pattern
Abstract
This chapter covers the simple factory pattern.
Vaskaran Sarcar
Chapter 25. Null Object Pattern
Abstract
Wikipedia says, “In object-oriented computer programming, a null object is an object with no referenced value or with defined neutral (null) behavior. The null object design pattern describes the uses of such objects and their behavior (or lack thereof). It was first published in the Pattern Languages of Program Design book series.” The Hillside Group sponsors Pattern Languages of Programs (PLoP) annual conferences.
Vaskaran Sarcar
Chapter 26. MVC Pattern
Abstract
Model-View-Controller (MVC) is an architectural pattern.
Vaskaran Sarcar

Final Discussions on Design Patterns

Frontmatter
Chapter 27. Criticisms of Design Patterns
Abstract
In this chapter, I present some of the criticisms of design patterns. Reading about the criticisms can offer real value. If you think critically about patterns before you design your software, you can predict your “return on investment” to some degree. Design patterns basically help you benefit from another people’s experience. This is often called experience reuse. You learn how they solved challenges, how they tried to adapt new behaviors in their systems, and so on. A pattern may not perfectly fit into your work, but if you concentrate on the best practices as well as the problems of a pattern at the beginning, you are more likely to make a better application.
Vaskaran Sarcar
Chapter 28. AntiPatterns: Avoid the Common Mistakes
Abstract
The discussion of design patterns cannot be completed without antipatterns. This chapter briefly overviews antipatterns. Let’s start.
Vaskaran Sarcar
Chapter 29. FAQs
Abstract
This chapter is a subset of the “Q&A Session” sections in all the chapters in this book. Many of these questions were not discussed in certain chapters because the related patterns were not yet covered. So, it is highly recommended that in addition to the following Q&As, you go through all the “Q&A Session” sections in the book for a better understanding of all the patterns.
Vaskaran Sarcar
Backmatter
Metadata
Title
Java Design Patterns
Author
Vaskaran Sarcar
Copyright Year
2019
Publisher
Apress
Electronic ISBN
978-1-4842-4078-6
Print ISBN
978-1-4842-4077-9
DOI
https://doi.org/10.1007/978-1-4842-4078-6

Premium Partner