Introduction to Software Design with Java

This textbook provides an in-depth introduction to software design, with a focus on object-oriented design, and using the Java programming language. Its goal is to help readers learn software design by discovering the experience of the design process. To this end, a narrative is used that introduces...

Full description

Saved in:
Bibliographic Details
Main Author Robillard, Martin P
Format eBook
LanguageEnglish
Published Cham Springer Nature 2019
Springer International Publishing AG
Springer International Publishing
Edition1
Subjects
Online AccessGet full text

Cover

Loading…
Table of Contents:
  • Annotating Overridden Methods -- 7.5 Overloading Methods -- 7.6 Inheritance Versus Composition -- 7.7 Abstract Classes -- 7.8 Revisiting the DECORATOR Design Pattern -- 7.9 The TEMPLATE METHOD Design Pattern -- Final Methods and Classes -- Abstract Methods -- Summary of the Pattern -- 7.10 Proper Use of Inheritance -- Restricting What Clients of Base Classes Can Do -- Subclasses That Are Not Proper Subtypes -- Insights -- Code Exploration -- Edge Class Hierarchy -- NodeView Class Hierarchy -- Further Reading -- Chapter 8: Inversion of Control -- Design Context -- 8.1 Motivating Inversion of Control -- 8.2 The Model-View-Controller Decomposition -- 8.3 The OBSERVER Design Pattern -- Linking Model and Observers -- Control Flow Between Model and Observers -- Data Flow between Model and Observers -- Event-Based Programming -- Summary -- 8.4 Applying the OBSERVER Design Pattern -- 8.5 Introduction to Graphical User Interface Development -- 8.6 Graphical User Interface Component Graphs -- The User Experience Perspective -- The Logical Perspective -- The Source Code Perspective -- The Run-time Perspective -- Defining the Object Graph -- 8.7 Event Handling -- 8.8 The VISITOR Design Pattern -- Abstract and Concrete Visitors -- Integrating Operations into a Class Hierarchy -- Traversing the Object Graph -- Using Inheritance in the Pattern -- Supporting Data Flow in Visitor Structures -- Insights -- Code Exploration -- LuckyNumber -- Minesweeper -- Solitaire -- JetUML -- Further Reading -- Chapter 9: Functional Design -- Design Context -- 9.1 First-Class Functions -- 9.2 Functional Interfaces, Lambda Expressions, and Method References -- Functional Interfaces -- Lambda Expressions -- Method References -- 9.3 Using Functions to Compose Behavior -- 9.4 Using Functions as Suppliers of Data -- Supplier Functions and the OBSERVER Pattern
  • 4.6 Final Fields and Variables -- 4.7 Object Identity, Equality, and Uniqueness -- 4.8 The FLYWEIGHT Design Pattern -- 4.9 The SINGLETON Design Pattern -- 4.10 Objects of Nested Classes -- Inner Classes -- Anonymous Classes -- Insights -- Code Exploration -- Minefield in Minesweeper -- Card in Solitaire -- Move Anonymous Classes in Solitaire -- ApplicationResources in JetUML -- Further Reading -- Chapter 5: Unit Testing -- Design Context -- 5.1 Introduction to Unit Testing -- 5.2 Unit Testing Framework Fundamentals with JUnit -- 5.3 Organizing Test Code -- 5.4 Metaprogramming -- Introspection -- Program Manipulation -- Program Metadata -- 5.5 Structuring Tests -- 5.6 Tests and Exceptional Conditions -- 5.7 Encapsulation and Unit Testing -- 5.8 Testing with Stubs -- 5.9 Test Coverage -- Statement Coverage -- Branch Coverage -- Path Coverage -- Insights -- Code Exploration -- An Example of Bug -- Chapter Samples from Solitaire -- TestClipboard in JetUML -- Further Reading -- Chapter 6: Composition -- Design Context -- 6.1 Composition and Aggregation -- 6.2 The COMPOSITE Design Pattern -- 6.3 Sequence Diagrams -- 6.4 The DECORATOR Design Pattern -- 6.5 Combining COMPOSITE and DECORATOR -- 6.6 Polymorphic Object Copying -- Declaring to Implement Cloneable -- Overriding Object.clone() -- Calling super.clone() -- Catching CloneNotSupportedException -- Adding clone() to an Interface -- 6.7 The PROTOTYPE Design Pattern -- 6.8 The COMMAND Design Pattern -- 6.9 The Law of Demeter -- Insights -- Code Exploration -- Commands in Solitaire -- Delegation in GameModel -- Cloning in JetUML -- Commands in JetUML -- Prototype Object in JetUML -- Further Reading -- Chapter 7: Inheritance -- Design Context -- 7.1 The Case for Inheritance -- 7.2 Inheritance and Typing -- Downcasting -- Singly-Rooted Class Hierarchy -- 7.3 Inheriting Fields -- 7.4 Inheriting Methods
  • 9.5 First-Class Functions and Design Patterns -- Functional-Style STRATEGY -- Functional-Style COMMAND -- 9.6 Functional-Style Data Processing -- Data as a Stream -- Applying Higher-Order Functions to Streams -- Filtering Streams -- Mapping Data Elements -- Reducing Streams -- Insights -- Code Exploration -- Event Handlers in Minesweeper -- Strategies in Solitaire -- Event Handlers in JetUML -- Observer Notification in JetUML -- COMMAND Pattern in JetUML -- Absence of Streaming in JetUML -- Further Reading -- Appendix A: Important Java Programming Concepts -- A.1 Variables and Types -- A.2 Objects and Classes -- A.3 Static Fields -- A.4 Methods -- A.5 Packages and Importing -- A.6 Generic Types -- A.7 Collection Classes -- A.8 Exception Handling -- Appendix B: Coding Conventions -- Medial Capitals for Identifier Names -- All Capitals for Constants -- Variable Name Prefixes -- Indentation -- Use of the @Override Annotation -- Code Comments -- Ellipses and Adaptations -- Example -- Appendix C: Example Applications -- References -- Index
  • Intro -- Preface -- Organization of the Book -- Acknowledgments -- Contents -- Chapter 1: Introduction -- 1.1 Defining Software Design -- 1.2 Design in the Software Development Process -- 1.3 Capturing Design Knowledge -- The Unified Modeling Language -- 1.4 Sharing Design Know-How -- Design Patterns -- Design Antipatterns -- Insights -- Further Reading -- Chapter 2: Encapsulation -- Design Context -- 2.1 Encapsulation and Information Hiding -- 2.2 Encoding Abstractions as Types -- 2.3 Scopes and Visibility Restrictions -- 2.4 Object Diagrams -- 2.5 Escaping References -- Returning a reference to an internal object -- Storing an external reference internally -- Leaking references through shared structures -- 2.6 Immutability -- 2.7 Exposing Internal Data -- Extended interface -- Returning Copies -- Advanced Techniques -- 2.8 Design by Contract -- Insights -- Code Exploration -- Cell in Minesweeper -- Dimension in JetUML -- Card in Solitaire -- Rectangle JetUML -- Further Reading -- Chapter 3: Types and Interfaces -- Design Context -- 3.1 Decoupling Behavior from Implementation -- 3.2 Specifying Behavior with Interfaces -- 3.3 Class Diagrams -- 3.4 Function Objects -- 3.5 Iterators -- 3.6 The ITERATOR Design Pattern -- 3.7 The STRATEGY Design Pattern -- 3.8 The Interface Segregation Principle -- Insights -- Code Exploration -- Comparable Java Versions in JetUML -- Strategy Pattern Meets Interface Segregation in Solitaire -- Further Reading -- Chapter 4: Object State -- Design Context -- 4.1 The Static and Dynamic Perspectives of a Software System -- 4.2 Defining Object State -- 4.3 State Diagrams -- 4.4 Designing Object Life Cycles -- Invalid and Useless States -- Unnecessary Stateful Information -- 4.5 Nullability -- No Need to Model Absent Values -- Modeling Absent Values -- Optional Types -- The NULL OBJECT Design Pattern