Skip to content
  • Sign In
  • Try Now
View all events
Java

Design Patterns in Java: Deep Dive

Published by Pearson

Intermediate content levelIntermediate

The Timeless Way of Coding

Based on Heinz's experience covering these topics, and years of teaching, we look at the ten most common design patterns: Builder, Memento, Proxy, Strategy, Composite, Visitor and Default Visitor, Command, Decorator, State, and Chain of Responsibility. The course includes hands-on exercises that the students need to solve, together with exercise walkthroughs.

What you’ll learn and how you can apply it

  • Understand why we need to know about design patterns
  • Understand how patterns influence the Java Virtual Machine JIT compiler and garbage collectors
  • Good working knowledge of the ten most common design patterns

This live event is for you because...

  • Beginner to intermediate Java programmers wishing to become better at writing reusable code

Prerequisites

  • Should be comfortable with at least Java 8 code. Java 11+ is an advantage.

Course Set-up:

Please install the following before the class begins:

Further set-up instructions will be provided at the start of the class.

Recommended Preparation:

Recommended Follow-up:

Schedule

The time frames are only estimates and may vary according to how the class is progressing.

Day 1

Segment 1: Welcome (20m)

  • Lay of the Land
  • Why Learn Patterns?
  • What is a Design Pattern?

Segment 2: Builder (40m including exercise)

  • Intent, Motivation, Effective Java vs GoF, polymorphic builder, known uses in the JDK
  • Exercise/activity description: Coding exercise creating a builder

Segment 3: Memento (40m including exercise)

  • Intent, Motivation, avoiding memory leaks, serialization, known uses in the JDK
  • Exercise/activity description: Two coding exercises

Segment 4: Proxy (40m including exercise)

  • Intent, Motivation, virtual proxy, dynamic proxy, known uses in the JDK
  • Exercise/activity description: Coding exercise with virtual proxy and also dynamic

Segment 5: Strategy (40m including exercise)

  • Intent, Motivation, polymorphism vs strategy, known uses in the JDK
  • Exercise/activity description: Coding exercise refactoring spaghetti code to strategy

Segment 6: Composite (40m including exercise)

  • Intent, Motivation, part-whole hierarchies, known uses in the JDK
  • Exercise/activity description: Coding exercise iterating over composite structure

Day 2

Segment 7a: Visitor (30m including exercise)

  • Intent, Motivation, annotation processing, known uses in the JDK
  • Exercise/activity description: Coding exercise adding visitor to composite structure

Segment 7b: Default Visitor (30m including exercise)

  • Intent, Motivation, comparison to GoF visitor, extensibility, known uses in the JDK
  • Exercise/activity description: Coding exercise refactoring visitor to default visitor

Segment 8: Command (40m including exercise)

  • Intent, Motivation, lambdas and method references, composite commands, known uses in the JDK
  • Exercise/activity description: Coding exercise creating actions for devices

Segment 9: Decorator (40m including exercise)

  • Intent, Motivation, object model, client view, known uses in the JDK
  • Exercise/activity description: Coding exercise mixing decorators with iterables

Segment 10: State (40m including exercise)

  • Intent, Motivation, use cases in the real world, complexity, known uses in the JDK
  • Exercise/activity description: Coding exercise creating state machine in code

Segment 11: Chain of Responsibility (40m including exercise)

  • Intent, Motivation, unmanaged requests, known uses in the JDK
  • Exercise/activity description: Coding exercise creating chain of object mappers

Segment 12: Conclusion (5m)

Your Instructor

  • Heinz Kabutz

    Heinz Kabutz is the author of The Java Specialists' Newsletter, where he explores interesting tips and tricks from the Java Programming Language. Please join his newsletter on www.javaspecialists.eu.

    linkedinXlinksearch