mirage22 / Practical-Design-Patterns-for-Java-Developers

Practical Design Patterns for Java Developers, published by Packt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Practical Design Patterns for Java Developers

LinkedIn URL

Design Patterns and Best Practices in Java

This is the code repository for Practical Design Patterns for Java Developers , published by Packt.

Hone your software design skills by implementing popular design patterns in Java

What is this book about?

As the experience level increases for software developers, it becomes crucial to develop the required skillset for developing quality code. This book will enable you to identify and apply common design patterns for building quality applications by refining your code.

This book covers the following exciting features:

  • Understand the most common problems that can be solved using Java design patterns
  • Uncover Java building elements, their usages, and concurrency possibilities
  • Optimize a vehicle memory footprint with the Flyweight Pattern
  • Explore one-to-many relations between instances with the observer pattern
  • Discover how to route vehicle messages by using the visitor pattern
  • Utilize and control vehicle resources with the thread-pool pattern
  • Understand the penalties caused by anti-patterns in software design

The book describes 42 popular design patterns formed into an imaginary abstraction of vehicle manufacturing to boost the learning curve (Table 1.).

Creational Structural Behavioral Concurrent
Chapter 3 Chapter 4 Chapter 5 Chapter 6
Factory Method Adapter Caching Active Object
Abstract Factory Bridge Chain of Responsibility Asynchronous Method
Builder Composite Command Balking
Prototype Decorator Interpreter Double Checked Locking
Singleton Facade Iterator Read Write Lock
Object Pool Filter Mediator Producer Consumer
Lazy Initialization Flyweight Null Object Scheduler
Dependency Injection Front Controller Observer Thread Pool
Marker Pipeline
Module State
Proxy Strategy
Twin Template
Visitor

Table 1. : 42 Practical Design Patterns explored in the book

If you feel this book is for you, get your copy today!
What led the author to write this book: Miroslav Wengner: The Interview

https://www.packtpub.com/

The book

Instructions and Navigations

All of the code is organized into folders. For example, Chapter02.

The code will look like the following:

public class Vehicle {
 private boolean moving;
   public void move(){
       this.moving = true;
       System.out.println("moving...");
 }

Following is what you need for this book: If you are an intermediate-level Java developer or software architect looking to learn the practical implementation of software design patterns in Java, then this book is for you. No prior knowledge of design patterns is required, but an understanding of Java programming is necessary.

With the following software and hardware list you can run all code files present in the book (Chapter 1-7).

Software and Hardware List

Chapter Software required OS required
1 Java Development Kit 17+ Windows, Mac OS X, and Linux (Any)
1 Recommended IDE VSCode 1.73.1+ Windows, Mac OS X, and Linux (Any)
1 A text editor or IDE Windows, Mac OS X, and Linux (Any)

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Errata

  • Figure 2.2 : The Extension class loader mentioned in the image should be the Application & Platform Classloader
  • Example 4.2 : The case statement 'case ElectricEngine de' contains a missleding reference variable 'de', it should be changed to 'ee'. The correct statement would be then 'case ElectricEngine ee', according to the used notation. The variable name would be changed to 'ee'

Related products

How to install Java

Java Development Kit 17+ is required to run the book's examples. To check if it is available on your system, execute the following commands:

$ java -version

# Expected output:
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment (build 17+35-2724)
OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode,
sharing)

In case the JDK is not installed, feel free to visit the following links for help:

  1. Foojay.io : Java Quick Start
  2. dev.java : Getting Started with Java
  3. Homebrew Formulae: OpenJDK

How to create and open Java Flight Recorder recordings

The project contains several *.jfr recordings. The file-name refers to the image that was created from this recording. Java Mission Control version 8.2 was used for image creation purposes. *.jfr files can be opened in the Java Mission Control application, which can be downloaded from the links below.

download links:

# Starting the JavaFlightRecorder for the patterns
# Recordings are done on Java 17
$ java -XX:StartFlightRecording=filename=<PATTERN_NAME_MAIN>.jfr,dumponexit=true,settings=profile <MAIN_CLASS>

HowToCompileAndExecuteCode

Get to Know the Author

Miroslav Wengner is an engineer with a passion for resilient distributed systems and product quality. He is a co-author and contributor to the Robo4J project (a reactive soft real-time framework for robotics/IoT). Miro contributes to OpenJDK and participates in other open source technologies. He uses his passion for helping build resilient and scalable solutions. Miro was selected for the Java Champions Program, recognized as a JavaOne Rockstar, and elected to the Java Community Process (JCP) as an executive committee member.He shares his knowledge at conferences (JavaOne, Devoxx, and so on) and in blogs. Miro believes in the Java ecosystem and helps move it forward!

Twitter URL
LinkedIn URL

Download a free PDF

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

https://packt.link/free-ebook/9781804614679

About

Practical Design Patterns for Java Developers, published by Packt

License:MIT License


Languages

Language:Java 100.0%