Hands-On Design Patterns with Java
eBook - ePub

Hands-On Design Patterns with Java

Learn design patterns that enable the building of large-scale software architectures

Dr. Edward Lavieri

  1. 360 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Hands-On Design Patterns with Java

Learn design patterns that enable the building of large-scale software architectures

Dr. Edward Lavieri

Book details
Book preview
Table of contents
Citations

About This Book

Understand Gang of Four, architectural, functional, and reactive design patterns and how to implement them on modern Java platforms, such as Java 12 and beyond

Key Features

  • Learn OOP, functional, and reactive patterns for creating readable and maintainable code
  • Explore architectural patterns and practices for building scalable and reliable applications
  • Tackle all kinds of performance-related issues and streamline development using design patterns

Book Description

Java design patterns are reusable and proven solutions to software design problems. This book covers over 60 battle-tested design patterns used by developers to create functional, reusable, and flexible software.

Hands-On Design Patterns with Java starts with an introduction to the Unified Modeling Language (UML), and delves into class and object diagrams with the help of detailed examples. You'll study concepts and approaches to object-oriented programming (OOP) and OOP design patterns to build robust applications. As you advance, you'll explore the categories of GOF design patterns, such as behavioral, creational, and structural, that help you improve code readability and enable large-scale reuse of software. You'll also discover how to work effectively with microservices and serverless architectures by using cloud design patterns, each of which is thoroughly explained and accompanied by real-world programming solutions.

By the end of the book, you'll be able to speed up your software development process using the right design patterns, and you'll be comfortable working on scalable and maintainable projects of any size.

What you will learn

  • Understand the significance of design patterns for software engineering
  • Visualize software design with UML diagrams
  • Strengthen your understanding of OOP to create reusable software systems
  • Discover GOF design patterns to develop scalable applications
  • Examine programming challenges and the design patterns that solve them
  • Explore architectural patterns for microservices and cloud development

Who this book is for

If you are a developer who wants to learn how to write clear, concise, and effective code for building production-ready applications, this book is for you. Familiarity with the fundamentals of Java is assumed.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Hands-On Design Patterns with Java an online PDF/ePUB?
Yes, you can access Hands-On Design Patterns with Java by Dr. Edward Lavieri in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in Java. We have over one million books available in our catalogue for you to explore.

Information

Year
2019
ISBN
9781789809954
Edition
1

Section 1: Introducing Design Patterns

In this section, you will gain an understanding of the concept and significance of design patterns, learn necessary unified modeling language constructs, and learn how design patterns are classified into a comprehensive library.
The following chapters will be covered:
  • Chapter 1, Unified Modeling Language Primer
  • Chapter 2, Object-Oriented Design Patterns

Unified Modeling Language Primer

This book features several design patterns and covers their implementation using Java. We can use Unified Modeling Language (UML) to help communicate class structures, objects, and interactions. This chapter provides an overview of UML, with a specific focus on diagrams applicable to the hands-on activities in this book.
The following topics will be covered in this chapter:
  • Introducing UML
  • Behavior diagrams
  • Structural diagrams

Technical requirements

This chapter does not have any technical requirements. In order to create UML diagrams, the following open source software tool is recommended:
  • Modelio, which is available at https://www.modelio.org
Modelio can be run on systems with any of the following operating systems:
  • Debian/Ubuntu
  • macOS X
  • RedHat/CentOS
  • Windows 7
  • Windows 8
  • Windows 10

Introducing UML

UML was developed in 1994 to document object-oriented systems. Since that time, UML has become a standard tool for software engineers, software developers, and businesses. UML is used to design software and, after programming, also provides a visual record for the system which can be included as part of formal software documentation.
There are two types of UML diagrams—behavioral and structural. Both are described in the sections that follow.

Understanding behavioral UML diagrams

Behavioral diagrams illustrate how system components interact to form a system. The four diagrams listed here are behavioral, and are briefly described in the subsections that follow:
  • Activity diagrams
  • Interaction diagrams
  • State machine diagrams
  • Use case diagrams

Activity diagrams

Activity diagrams illustrate the flow of processes in a system. This type of diagram is used to visually document activities within a system, also referred to as a system's procedures or dynamic components.
The following activity diagram shows the activities involved when a coffee shop customer places an order. The starting point is the top black circle. From there, an order is received. Beneath the Receive Order node is a horizontal black bar referred to as a fork. There are three activities that take place in parallel after the fork—Make Drink, Get Bakery, and Collect Payment. All of those activities take place in parallel. Each of those activities feed into a second black bar, this time referred to as a join, which has multiple activities linked to it. Once all three activities are completed, the order can be completed and ends with the bottom black circle:
An activity diagram for a coffee shop order process

Interaction diagrams

Interaction diagrams visually document how system components interact with each other.
In the following interaction diagram, you can see that the flow starts with a decision on whether the customer is a new, or already existing, customer. In both cases, the interaction between the Customer object and Customer Database object is documented:
An interaction diagram for a coffee shop order
Interaction UML diagrams are robust and come in several different types. The interaction UML diagram types are listed here and will be covered in the subsequent sections:
  • Sequence diagram
  • Communication diagram
  • Timing diagram

Sequence diagrams

Sequence diagrams are used to show a specific use case scenario. So, these diagrams are representative of a typical behavior based on the given use case.
The following sequence diagram example visually documents the use case where a student logs on to an online book order system and enters their course code. The online system calculates a price and provides this total to the student. The student is then able to submit their payment, which goes through the online bookstore and informs the fulfillment center, which ships the books to the student:
An example sequence diagram

Communication diagrams

Communication diagrams are a special type of interaction diagrams. They f...

Table of contents