You are previewing Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition.
O'Reilly logo
Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition

Book Description

"People often ask me which is the best book to introduce them to the world of OO design. Ever since I came across it Applying UML and Patterns has been my unreserved choice."
Martin Fowler, author, UML Distilled and Refactoring

The first edition of Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design quickly emerged as the leading OOA/D introduction; it has been translated into seven languages and adopted in universities and businesses worldwide. In this second edition, well-known object technology and iterative methods leader Craig Larman refines and expands this text for developers and students new to OOA/D, the UML, patterns, use cases, iterative development, and related topics.

Put simply, the book shows newcomers to OOA/D how to "think in objects." It does so by presenting three iterations of a single, cohesive case study, incrementally introducing the requirements and OOA/D activities, principles, and patterns that are most critical to success. It introduces the most frequently used UML diagramming notation, while emphasizing that OOA/D is much more than knowing UML notation. All case study iterations and skills are presented in the context of an "agile" version of the Unified Process -- a popular, modern iterative approach to software development. Throughout, Larman presents the topics in a fashion designed for learning and comprehension.

Among the topics introduced in Applying UML and Patterns are: * requirements and use cases, * domain object modeling, * core UML, * designing objects with responsibilities, * "Gang of Four" and other design patterns, * mapping designs to code (using Java as an example), * layered architectures, * architectural analysis, * package design, * iterative development, and * the Unified Process. For a more detailed list of topics, please see the accompanying table of contents.

Foreword by Philippe Kruchten, the lead architect of the Rational Unified Process.

"Too few people have a knack for explaining things. Fewer still have a handle on software analysis and design. Craig Larman has both."
John Vlissides, author, Design Patterns and Pattern Hatching

"This edition contains Larman's usual accurate and thoughtful writing. It is a very good book made even better."
Alistair Cockburn, author, Writing Effective Use Cases and Surviving OO Projects

Table of Contents

  1. Copyright
  2. Sample UML Notation
  3. Praise for Applying UML and Patterns
  4. Foreword
  5. Preface
  6. Introduction
    1. Object-Oriented Analysis and Design
      1. Applying UML and Patterns in OOA/D
      2. Assigning Responsibilities
      3. What Is Analysis and Design?
      4. What Is Object-Oriented Analysis and Design?
      5. An Example
      6. The UML
      7. Further Readings
    2. Iterative Development and the Unified Process
      1. Introduction
      2. The Most Important UP Idea: Iterative Development
      3. Additional UP Best Practices and Concepts
      4. The UP Phases and Schedule-Oriented Terms
      5. The UP Disciplines (was Workflows)
      6. Process Customization and the Development Case
      7. The Agile UP
      8. The Sequential “Waterfall” Lifecycle
      9. You Know You Didn't Understand the UP When...
      10. Further Readings
    3. Case Study: The NextGen POS System
      1. Introduction
      2. The NextGen POS System
      3. Architectural Layers and Case Study Emphasis
      4. The Book's Strategy: Iterative Learning and Development
  7. Inception
    1. Inception
      1. Introduction
      2. Inception: An Analogy
      3. Inception May Be Very Brief
      4. What Artifacts May Start in Inception?
      5. You Know You Didn't Understand Inception When...
    2. Understanding Requirements
      1. Introduction
      2. Types of Requirements
      3. Further Readings
    3. Use-Case Model: Writing Requirements in Context
      1. Introduction
      2. Goals and Stories
      3. Background
      4. Use Cases and Adding Value
      5. Use Cases and Functional Requirements
      6. Use Case Types and Formats
      7. Fully Dressed Example: Process Sale
      8. Explaining the Sections
      9. Goals and Scope of a Use Case
      10. Finding Primary Actors, Goals, and Use Cases
      11. Congratulations: Use Cases Have Been Written, and Are Imperfect
      12. Write Use Cases in an Essential UI-Free Style
      13. Actors
      14. Use Case Diagrams
      15. Requirements in Context and Low-Level Feature Lists
      16. Use Cases Are Not Object-Oriented
      17. Use Cases Within the UP
      18. Case Study: Use Cases in the NextGen Inception Phase
      19. Further Readings
      20. UP Artifacts and Process Context
    4. Identifying Other Requirements
      1. Introduction
      2. NextGen POS Examples
      3. NextGen Example: (Partial) Supplementary Specification
      4. Commentary: Supplementary Specification
      5. NextGen Example: (Partial) Vision
      6. Commentary: Vision
      7. NextGen Example: A (Partial) Glossary
      8. Commentary: Glossary (Data Dictionary)
      9. Reliable Specifications: An Oxymoron?
      10. Online Artifacts at the Project Website
      11. Not Much UML During Inception?
      12. Other Requirement Artifacts Within the UP
      13. Further Readings
      14. UP Artifacts and Process Context
    5. From Inception to Elaboration
      1. Introduction
      2. Checkpoint: What Happened in Inception?
      3. On to Elaboration
      4. Planning the Next Iteration
      5. Iteration 1 Requirements and Emphasis: Fundamental OOA/D Skills
      6. What Artifacts May Start in Elaboration?
      7. You Know You Didn't Understand Elaboration When...
  8. Elaboration Iteration 1
    1. Use-Case Model: Drawing System Sequence Diagrams
      1. Moving on to Iteration 1
      2. Introduction
      3. System Behavior
      4. System Sequence Diagrams
      5. Example of an SSD
      6. Inter-System SSDs
      7. SSDs and Use Cases
      8. System Events and the System Boundary
      9. Naming System Events and Operations
      10. Showing Use Case Text
      11. SSDs and the Glossary
      12. SSDs Within the UP
      13. Further Readings
      14. UP Artifacts
    2. Domain Model: Visualizing Concepts
      1. Introduction
      2. Domain Models
      3. Conceptual Class Identification
      4. Candidate Conceptual Classes for the Sales Domain
      5. Domain Modeling Guidelines
      6. Resolving Similar Conceptual Classes—Register vs. “POST”
      7. Modeling the Unreal World
      8. Specification or Description Conceptual Classes
      9. UML Notation, Models, and Methods: Multiple Perspectives
      10. Lowering the Representational Gap
      11. Example: The NextGen POS Domain Model
      12. Domain Models Within the UP
      13. Further Readings
      14. UP Artifacts
    3. Domain Model: Adding Associations
      1. Introduction
      2. Associations
      3. The UML Association Notation
      4. Finding Associations—Common Associations List
      5. Association Guidelines
      6. Roles
      7. How Detailed Should Associations Be?
      8. Naming Associations
      9. Multiple Associations Between Two Types
      10. Associations and Implementation
      11. NextGen POS Domain Model Associations
      12. NextGen POS Domain Model
    4. Domain Model: Adding Attributes
      1. Introduction
      2. Attributes
      3. UML Attribute Notation
      4. Valid Attribute Types
      5. Non-primitive Data Type Classes
      6. Design Creep: No Attributes as Foreign Keys
      7. Modeling Attribute Quantities and Units
      8. Attributes in the NextGen Domain Model
      9. Multiplicity From SalesLineItem to Item
      10. Domain Model Conclusion
    5. Use-Case Model: Adding Detail with Operation Contracts
      1. Introduction
      2. Contracts
      3. Example Contract: enterItem
      4. Contract Sections
      5. Postconditions
      6. Discussion—enterItem Postconditions
      7. Writing Contracts Leads to Domain Model Updates
      8. When Are Contracts Useful? Contracts vs. Use Cases?
      9. Guidelines: Contracts
      10. NextGen POS Example: Contracts
      11. Changes to the Domain Model
      12. Contracts, Operations, and the UML
      13. Operation Contracts Within the UP
      14. Further Readings
    6. From Requirements to Design in this Iteration
      1. Introduction
      2. Iteratively Do the Right Thing, Do the Thing Right
      3. Didn't That Take Weeks To Do? No, Not Exactly.
      4. On to Object Design
    7. Interaction Diagram Notation
      1. Introduction
      2. Sequence and Collaboration Diagrams
      3. Example Collaboration Diagram: makePayment
      4. Example Sequence Diagram: makePayment
      5. Interaction Diagrams Are Valuable
      6. Common Interaction Diagram Notation
      7. Basic Collaboration Diagram Notation
      8. Basic Sequence Diagram Notation
    8. GRASP: Designing Objects with Responsibilities
      1. Introduction
      2. Responsibilities and Methods
      3. Responsibilities and Interaction Diagrams
      4. Patterns
      5. GRASP: Patterns of General Principles in Assigning Responsibilities
      6. The UML Class Diagram Notation
      7. Information Expert (or Expert)
      8. Creator
      9. Low Coupling
      10. High Cohesion
      11. Controller
      12. Object Design and CRC Cards
      13. Further Readings
    9. Design Model: Use-Case Realizations with GRASP Patterns
      1. Introduction
      2. Use-Case Realizations
      3. Artifact Comments
      4. Use-Case Realizations for the NextGen Iteration
      5. Object Design: makeNewSale
      6. Object Design: enterItem
      7. Object Design: endSale
      8. Object Design: makePayment
      9. Object Design: startUp
      10. Connecting the UI Layer to the Domain Layer
      11. Use-Case Realizations Within the UP
      12. Summary
    10. Design Model: Determining Visibility
      1. Introduction
      2. Visibility Between Objects
      3. Visibility
      4. Illustrating Visibility in the UML
    11. Design Model: Creating Design Class Diagrams
      1. Introduction
      2. When to Create DCDs
      3. Example DCD
      4. DCD and UP Terminology
      5. Domain Model vs. Design Model Classes
      6. Creating a NextGen POS DCD
      7. Notation for Member Details
      8. DCDs, Drawing, and CASE Tools
      9. DCDs Within the UP
      10. UP Artifacts
    12. Implementation Model: Mapping Designs to Code
      1. Introduction
      2. Programming and the Development Process
      3. Mapping Designs to Code
      4. Creating Class Definitions from DCDs
      5. Creating Methods from Interaction Diagrams
      6. Container/Collection Classes in Code
      7. Exceptions and Error Handling
      8. Defining the Sale--makeLineItem Method
      9. Order of Implementation
      10. Test-First Programming
      11. Summary of Mapping Designs to Code
      12. Introduction to the Program Solution
  9. Elaboration Iteration 2
    1. Iteration 2 and its Requirements
      1. Iteration 2 Emphasis: Object Design and Patterns
      2. From Iteration 1 to 2
      3. Iteration 2 Requirements
      4. Refinement of Analysis-oriented Artifacts in this Iteration
    2. GRASP: More Patterns for Assigning Responsibilities
      1. Introduction
      2. Polymorphism
      3. Pure Fabrication
      4. Indirection
      5. Protected Variations
    3. Designing Use-Case Realizations with GoF Design Patterns
      1. Introduction
      2. Adapter (GoF)
      3. “Analysis” Discoveries During Design: Domain Model
      4. Factory (GoF)
      5. Singleton (GoF)
      6. Conclusion of the External Services with Varying Interfaces Problem
      7. Strategy (GoF)
      8. Composite (GoF) and Other Design Principles
      9. Facade (GoF)
      10. Observer/Publish-Subscribe/Delegation Event Model (GoF)
      11. Conclusion
      12. Further Readings
  10. Elaboration Iteration 3
    1. Iteration 3 and Its Requirements
      1. Iteration 3 Requirements
      2. Iteration 3 Emphasis
    2. Relating Use Cases
      1. Introduction
      2. The include Relationship
      3. Terminology: Concrete, Abstract, Base, and Addition Use Cases
      4. The extend Relationship
      5. The generalize Relationship
      6. Use Case Diagrams
    3. Modeling Generalization
      1. Introduction
      2. New Concepts for the Domain Model
      3. Generalization
      4. Defining Conceptual Superclasses and Subclasses
      5. When to Define a Conceptual Subclass
      6. When to Define a Conceptual Superclass
      7. NextGen POS Conceptual Class Hierarchies
      8. Abstract Conceptual Classes
      9. Modeling Changing States
      10. Class Hierarchies and Inheritance in Software
    4. Refining the Domain Model
      1. Introduction
      2. Association Classes
      3. Aggregation and Composition
      4. Time Intervals and Product Prices—Fixing an Iteration 1 “Error”
      5. Association Role Names
      6. Roles as Concepts vs. Roles in Associations
      7. Derived Elements
      8. Qualified Associations
      9. Reflexive Associations
      10. Ordered Elements
      11. Using Packages to Organize the Domain Model
    5. Adding New SSDs and Contracts
      1. New System Sequence Diagrams
      2. New System Operations
      3. New System Operation Contracts
    6. Modeling Behavior in Statechart Diagrams
      1. Introduction
      2. Events, States, and Transitions
      3. Statechart Diagrams
      4. Statechart Diagrams in the UP?
      5. Use Case Statechart Diagrams
      6. Use Case Statechart Diagrams for the POS Application
      7. Classes that Benefit from Statechart Diagrams
      8. Illustrating External and Interval Events
      9. Additional Statechart Diagram Notation
      10. Further Readings
    7. Designing the Logical Architecture with Patterns
      1. Introduction
      2. Software Architecture
      3. Architectural Pattern: Layers
      4. The Model-View Separation Principle
      5. Further Readings
    8. Organizing the Design and Implementation Model Packages
      1. Introduction
      2. Package Organization Guidelines
      3. More UML Package Notation
      4. Further Readings
    9. Introduction to Architectural Analysis and the SAD
      1. Introduction
      2. Architectural Analysis
      3. Types and Views of Architecture
      4. The Science: Identification and Analysis of Architectural Factors
      5. Example: Partial NextGen POS Architectural Factor Table
      6. The Art: Resolution of Architectural Factors
      7. Summary of Themes in Architectural Analysis
      8. Architectural Analysis within the UP
      9. Further Readings
    10. Designing More Use-Case Realizations with Objects and Patterns
      1. Introduction
      2. Failover to Local Services; Performance with Local Caching
      3. Handling Failure
      4. Failover to Local Services with a Proxy (GoF)
      5. Designing for Non-Functional or Quality Requirements
      6. Accessing External Physical Devices with Adapters; Buy vs. Build
      7. Abstract Factory (GoF) for Families of Related Objects
      8. Handling Payments with Polymorphism and Do It Myself
      9. Conclusion
    11. Designing a Persistence Framework with Patterns
      1. Introduction
      2. The Problem: Persistent Objects
      3. The Solution: A Persistence Service from a Persistence Framework
      4. Frameworks
      5. Requirements for the Persistence Service and Framework
      6. Key Ideas
      7. Pattern: Representing Objects as Tables
      8. UML Data Modeling Profile
      9. Pattern: Object Identifier
      10. Accessing a Persistence Service with a Facade
      11. Mapping Objects: Database Mapper or Database Broker Pattern
      12. Framework Design with the Template Method Pattern
      13. Materialization with the Template Method Pattern
      14. Configuring Mappers with a MapperFactory
      15. Pattern: Cache Management
      16. Consolidating and Hiding SQL Statements in One Class
      17. Transactional States and the State Pattern
      18. Designing a Transaction with the Command Pattern
      19. Lazy Materialization with a Virtual Proxy
      20. How to Represent Relationships in Tables
      21. PersistentObject Superclass and Separation of Concerns
      22. Unresolved Issues
  11. Special Topics
    1. On Drawing and Tools
      1. Introduction
      2. On Speculative Design and Visual Thinking
      3. Suggestions for UML Drawing Within the Development Process
      4. Tools and Sample Features
      5. Example Two
    2. Introduction to Iterative Planning and Project Issues
      1. Introduction
      2. Ranking Requirements
      3. Ranking Project Risks
      4. Adaptive vs. Predictive Planning
      5. Phase and Iteration Plans
      6. Iteration Plan: What to Do in the Next Iteration?
      7. Requirements Tracking Across Iterations
      8. The (In)Validity of Early Estimates
      9. Organizing Project Artifacts
      10. Some Team Iteration Scheduling Issues
      11. You Know You Didn't Understand Planning in the UP When...
      12. Further Readings
    3. Comments on Iterative Development and the UP
      1. Additional UP Best Practices and Concepts
      2. The Construction and Transition Phases
      3. Other Interesting Practices
      4. Motivations for Timeboxing an Iteration
      5. The Sequential “Waterfall” Lifecycle
      6. Usability Engineering and User Interface Design
      7. The UP Analysis Model
      8. The RUP Product
      9. The Challenge and Myths of Reuse
    4. More UML Notation
      1. General Notation
      2. Implementation Diagrams
      3. Template (Parameterized, Generic) Class
      4. Activity Diagrams
  12. Bibliography
  13. Glossary
  14. Sample UML Notation
  15. Index