earn a subset of design patterns that any practicing Java professional simply must know in today’s job climate.
Java Program Design presents program design principles to help practicing programmers up their game and remain relevant in the face of changing trends and an evolving language. The book enhances the traditional design patterns with Java's new functional programming features, such as functional interfaces and lambda expressions. The result is a fresh treatment of design patterns that expands their power and applicability, and reflects current best practice.
The book examines some well-designed classes from the Java class library, using them to illustrate the various object-oriented principles and patterns under discussion. Not only does this approach provide good, practical examples, but you will learn useful library classes you might not otherwise know about.
The design of a simplified banking program is introduced in chapter 1 in a non-object-oriented incarnation and the example is carried through all chapters. You can see the object orientation develop as various design principles are progressively applied throughout the book to produce a refined, fully object-oriented version of the program in the final chapter.
What You'll Learn
• Create well-designed programs, and identify and improve poorly-designed ones
• Build a professional-level understanding of polymorphism and its use in Java interfaces and class hierarchies
• Apply classic design patterns to Java programming problems while respecting the modern features of the Java language
• Take advantage of classes from the Java library to facilitate the implementation of design patterns in your programs
Who This Book Is For
Java programmers who are comfortable writing non-object-oriented code and want a guided immersion into the world of object-oriented Java, and intermediate programmers interested in strengthening their foundational knowledge and taking their object-oriented skills to the next level. Even
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
# Java Program Design: Principles, Polymorphism, and Patterns
## 【One-Line Pitch】
A practical, example-driven guide for Java programmers who want to move beyond writing working code to designing maintainable, object-oriented programs—using classic design patterns refreshed with modern Java features like lambdas and functional interfaces. Ideal for developers comfortable with basic Java who want to understand *why* the Java library is designed the way it is and how to apply those lessons to their own code.
## 【Book Arc】
- **Opening (~0%–9%)**: Introduces the core problem—software must be designed for change, not just correctness. Covers modular design fundamentals: APIs, dependencies, class diagrams, the Single Responsibility Rule, refactoring, and unit testing, all anchored by a simplified banking program that will evolve throughout the book.
- **Early (~9%–31%)**: Deep dive into polymorphism as the heart of object-oriented design. Explores interfaces, reference types, type safety, casting, and the Open-Closed Rule. Uses the Java Collection library (List, Set, SortedSet, Queue) as a case study for understanding subtype relationships, the Liskov Substitution Principle, and the Rule of Abstraction.
- **Middle (~37%–46%)**: Class hierarchies and the Template Pattern. Shows how abstract classes like InputStream and the collection library's AbstractList provide default implementations that subclasses customize. Introduces the template pattern with protected abstract "hook" methods, demonstrated through the evolving banking account hierarchy.
- **Middle (~46%–54%)**: Strategy and Command patterns. Explains how to encapsulate varying behavior using interfaces, comparators, anonymous inner classes, and lambda expressions. Compares templates vs. strategies, showing when each approach is appropriate.
- **Late (~54%–71%)**: Encapsulating object creation (Singleton, Factory patterns), Iterables and Iteration (Iterator, Visitor patterns, collection streams), Adapters (wrappers, text/object streams), Decorators (Chain of Command, buffered/cipher streams), Composites (JavaFX, predicates), Observers (JavaFX properties, bindings), and finally Model-View-Controller architecture applied to the banking demo.
## 【Key Takeaways】
- **Design for change is the primary goal** (Early): Programs always evolve through bug fixes and feature requests; good design minimizes the ripple effect of changes. The waterfall vs. agile discussion frames why modularity matters from day one.
- **Polymorphism is the foundation of flexible Java design** (Early): Interfaces and reference types let you write code that works with many concrete classes. The Open-Closed Rule—open for extension, closed for modification—is the guiding principle.
- **The Java Collection library is a masterclass in interface design** (Early): Questions like "Should SortedSet extend List?" and "Why isn't there a SortedList interface?" reveal deep thinking about subtype relationships and the Liskov Substitution Principle.
- **The Template Pattern eliminates code duplication** (Middle): Abstract classes implement complete methods that call protected abstract "hook" methods. The banking example shows how SavingsAccount and CheckingAccount become remarkably compact with zero repeated code.
- **Strategies and lambdas replace class hierarchies** (Middle): The Strategy Pattern, enhanced by lambda expressions, lets you vary behavior without creating subclasses. Comparators are the canonical example—a single interface enabling countless sorting behaviors.
- **The Java I/O library is built on Adapters and Decorators** (Middle–Late): Understanding why you combine BufferedReader with FileReader, and how OutputStreamWriter adapts byte streams to character streams, makes the "complicated" library design suddenly coherent.
- **MVC ties everything together** (Late): The Model-View-Controller pattern, demonstrated with JavaFX and the banking demo, shows how all the principles—polymorphism, observers, composites—combine into an elegant, nontrivial architecture.
## 【Reading Tips】
- **Skim the opening chapter's banking demo** (~0–9%) if you're already comfortable with basic OOP; it's mostly setup. But do pay attention to the Single Responsibility Rule and dependency injection—they recur throughout.
- **Deep-read Chapter 2 on polymorphism** (Early): The discussion of why certain interfaces exist (or don't) in the Java Collections framework is the intellectual core of the book. This is where you build professional-level judgment about interface design.
- **Study the version 8 → version 9 banking refactor** (Middle, ~63–71%): The Template Pattern transformation is the clearest before/after example in the book. Seeing the code shrink while becoming more flexible is the "aha" moment.
- **Use the companion source code**: The author explicitly recommends downloading the code and following along in an IDE. The book shows only relevant code fragments; running the complete examples is essential for full understanding.
- **Treat JavaFX chapters as optional depth** (Late): If you're not doing GUI work, skim the JavaFX-specific sections but still read the underlying patterns (Observer, Composite, MVC)—they apply to any Java project.
## 【Coverage Limits】
This guide covers the book's core progression through modular design, polymorphism, class hierarchies, and the major design patterns (Template, Strategy, Command, Factory, Iterator, Visitor, Adapter, Decorator, Composite, Observer, MVC). The excerpts do not cover the book's final chapter details on the complete banking application, nor do they include the full code listings for every pattern discussed.
##
Excerpt 1
on of design patterns in your programs Who This Book Is For Java programmers who are comfortable writing non-object-oriented code and want a guided immersion...
mma usage, and by simply being there. Thanks for everything. xiii Introduction This book is concerned with the following topic: How to use the object-oriente...
sing order until the isDone method of ReadLine returns true. In other words, the program prints integers until the user presses the Return key. The new threa...
, with differences from Listin g 3-24 in b old. Listing 4-3. The Revised ReadLine Class public class ReadLine implements Runnable { private boolean done = fa...
.out.println("Acct with smallest num is " + a3); System.out.println("Acct with largest num is " + a4); } private static BankAccount findMax(List<BankAccount>...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Java Program Design Principles, Polymorphism, and Patterns (Edward Sciore) (Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Java Program Design Principles, Polymorphism, and Patterns (Edward Sciore) (Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment