O'Reilly logo
live online training icon Live Online training

Design Patterns in Java

Douglas Schmidt

Attendees in this course will learn how to apply patterns—along with pattern-oriented frameworks—to alleviate the complexity of developing software via the use of object-oriented and functional design/programming techniques and Java programming language features (including Java 8 features). We'll use a case study based on many patterns in the book Design Patterns: Elements of Reusable Object-Oriented Software (the so-called “Gang of Four”' book) to showcase pattern-oriented design and programming techniques in Java. This case study will enable us to concretely evaluate the limitations with alternative design and programming methods (such as algorithm decomposition) and demonstrate by example how patterns and Java features help alleviate these limitations. The course will also give an overview of key relationships between patterns, including pattern complements, pattern compounds, pattern sequences, and pattern languages.

What you'll learn-and how you can apply it

  • Recognize the inherent and accidental complexities involved with developing object-oriented and functional software using Java.
  • Understand how pattern-oriented software architecture techniques can and cannot help to alleviate this complexity.
  • Apply key pattern-oriented software architecture techniques to develop reusable Java software infrastructure and apps.
  • Utilize Java programming language features and libraries effectively.
  • Know where to find additional sources of information on how to successfully apply pattern-oriented software architecture techniques to Java.

This training course is for you because...

  • For software developers creating robust and reusable frameworks and apps using Java

Prerequisites

This training is intended for software developers who are familiar with:

  • General object-oriented and functional design/programming concepts, such as encapsulation, abstraction, polymorphism, extensibility, and the Unified Modeling Language (UML)
  • Core programming language features, such as classes, inheritance, dynamic binding, generics, lambda expressions, and method references, that are available in Java

Students need to know how to Download and install the Java JDK and JRE:

  • Download and install an IDE, such as IntelliJ, NetBeans, Eclipse, or Android Studio

Course Set-up:

  • An installed copy of the Java JDK and JRE
  • An installed copy of IntelliJ, NetBeans, Eclipse, or Android Studio

Resources:

Design Patterns in Java LiveLessons (video)

Design Patterns: Elements of Reusable Object-Oriented Software (book)

About your instructor

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

DAY ONE

Segment 1 Course Overview (10 minutes)

  • Instructor will give an overview of the course.

Segment 2 Overview of the Case Study Requirements and Comparison of Algorithmic and Object-Oriented Design Techniques C

  • Instructor will explain requirements and design of the pattern-oriented expression tree app that is used throughout the course as a realistic--yet tractable--case study to motivate the need for--and benefits of--key Gang of Four patterns written in Java that run on a range of runtime platforms, including Android and Eclipse.
  • Participants can obtain all the case study code in open-source format from GitHub at https://github.com/douglascraigschmidt/LiveLessons/tree/master/ExpressionTree

Segment 3 Summary of Patterns in the Case Study (15 Minutes)

  • Instructor will give an overview of the Gang-of-Four Composite and Bridge patterns, which are used to treat individual objects and multiple, recursively-composed objects uniformly and which separates an abstraction from its implementation(s) so the two can vary independently, respectively.

Break (5 minutes)

Segment 4 The Composite and Bridge Patterns (30 Minutes)

  • Instructor will give an overview of the Gang-of-Four Composite and Bridge patterns, which are used to treat individual objects and multiple, recursively-composed objects uniformly and which separates an abstraction from its implementation(s) so the two can vary independently, respectively.

Segment 5 The Interpreter and Builder Patterns (30 Minutes)

  • Instructor will give an overview of the Gang-of-Four Interpreter and Builder patterns, which parse sentences in a grammar and separate the construction of a complex object from its representation, respectively.

Break (5 minutes)

Segment 6 The Command and Factory Method Patterns (45 Minutes)

  • Instructor will give an overview of the Gang-of-Four Factory Method and Command patterns, which provide an interface for creating an object, but leaves choice of object’s concrete type to a subclass and encapsulate the request for a service as an object.

Day Two

Segment 1 The Iterator, Strategy, and Visitor Patterns (45 Minutes)

  • Instructor will give an overview of the Gang-of-Four Iterator, Strategy, Visitor patterns, which access elements of a collection without exposing its representation; define a family of algorithms, encapsulate each one, and make them interchangeable to let clients and algorithms vary independently; and centralize operations on an object structure so that they can vary independently but still behave polymorphically, respectively.

Segment 2 The State Pattern (30 Minutes)

  • Instructor will give an overview of the Gang-of-Four State pattern, which allows an object to alter its behavior when its internal state changes.the object will appear to change its class.

Break (5 minutes)

Segment 3 The Template Method Pattern (25 Minutes)

  • Instructor will give an overview of the Gang-of-Four Template Method pattern, which provide a skeleton of an algorithm in a method, deferring some steps to subclasses.

Segment 4 The Singleton Pattern (20 Minutes)

  • Instructor will give an overview of the Gang-of-Four Singleton pattern, which ensures that a class has only one instance and provides a global point of access to that instance.

Break (5 minutes)

Segment 5 Overview of Pattern Concepts (30 Minutes)

  • Instructor will give an overview of key pattern concepts to help participants recognize the importance of design experience, understand how patterns can help improve software quality and developer productivity, identify common characteristics in pattern descriptions, and know the history of the Gang-of-Four book and its patterns.

Segment 6 Overview of Pattern Relationships (30 Minutes)

  • Instructor will give an overview of key relationships between patterns, including pattern catalogs, pattern complements, pattern compounds, pattern sequences, and pattern languages.

Segment 7 Benefits and Limitations of Patterns (15 Minutes)

  • Instructor will summarize the benefits and limitations of applying patterns to Java 8 programs.