You are previewing UML FOR JAVA™ PROGRAMMERS.
O'Reilly logo
UML FOR JAVA™ PROGRAMMERS

Book Description

UML for Java Programmers

Robert C. Martin

All the UML Java developers need to know

You don't use UML in a vacuum: you use it to build software with a specific programming language. If that language is Java, you need UML for Java Programmers. In this book, one of the world's leading object design experts becomes your personal coach on UML 1&2 techniques and best practices for the Java environment.

Robert C. Martin illuminates every UML 1&2 feature and concept directly relevant to writing better Java software--and ignores features irrelevant to Java developers. He explains what problems UML can and can't solve, how Java and UML map to each other, and exactly how and when to apply those mappings.

  • Pragmatic coverage of UML as a working tool for Java developers

  • Shows Java code alongside corresponding UML diagrams

  • Covers every UML diagram relevant to Java programmers, including class, object, sequence, collaboration, and state diagrams

  • Introduces dX, a lightweight, powerfully productive RUP & XP-derived process for successful software modeling

  • Includes a detailed, start-to-finish case study: remote service client, server, sockets, and tests

Table of Contents

  1. Copyright
    1. Dedication
  2. Robert C. Martin Series
  3. Source Code and Contact Information:
  4. Figures
  5. Listings
  6. Forward
  7. Preface
  8. 1. Overview of UML for Java™ Programmers
    1. Diagram Types
      1. Class diagrams
      2. Object diagrams
      3. Sequence diagrams
      4. Collaboration diagrams
      5. State diagrams
    2. Conclusion
    3. Notes
      1. Bibliography
  9. 2. Working with Diagrams
    1. Why Model?
      1. Why build models of software?
      2. Why should we build comprehensive designs before coding?
    2. Making Effective use of UML
      1. Communicating with others
      2. Road maps
      3. Back-end documentation
      4. What to keep and what to throw away
    3. Iterative Refinement
      1. Behavior first
      2. Check the structure
      3. Envisioning the code
      4. Evolution of diagrams
    4. Minimalism
    5. When and How to Draw Diagrams
      1. When to draw diagrams and when to stop.
      2. CASE tools
      3. But what about documentation?
      4. And Javadocs™?
    6. Conclusion
  10. 3. Class Diagrams
    1. The Basics
      1. Classes
      2. Association
      3. Inheritance
    2. An Example Class Diagram
    3. The Details
      1. Class stereotypes
        1. «interface»
        2. «utility»
      2. Abstract classes
      3. Properties
      4. Aggregation
      5. Composition
      6. Multiplicity
      7. Association stereotypes
      8. Inner classes
      9. Anonymous inner classes
      10. Association classes
      11. Association qualifiers
    4. Conclusion
    5. Notes
      1. Bibliography
  11. 4. Sequence Diagrams
    1. The Basics
      1. Objects, lifelines, messages, and other odds and ends
      2. Creation and destruction
      3. Simple loops
      4. Cases and scenarios
    2. Advanced Concepts
      1. Loops and conditions
      2. Messages that take time
      3. Asynchronous messages
      4. Multiple threads
      5. Active objects
      6. Sending messages to interfaces
    3. Conclusion
  12. 5. Use Cases
    1. Writing Use Cases
      1. What is a use case?
      2. The primary course
      3. Alternate courses
      4. What else?
    2. Use Case Diagrams
      1. System boundary diagram
      2. Use case relationships
    3. Conclusion
  13. 6. Principles of OOD
    1. Design Quality
      1. Design smells
      2. Dependency management
    2. The Single Responsibility Principle (SRP)
    3. The Open–Closed Principle (OCP)
    4. The Liskov Substitution Principle (LSP)
    5. The Dependency Inversion Principle (DIP)
    6. The Interface Segregation Principle (ISP)
    7. Conclusion
    8. Notes
      1. Bibliography
  14. 7. The Practices: dX
    1. Iterative Development
      1. The initial exploration
      2. Estimating the features
      3. Spikes
    2. Planning
      1. Planning releases
      2. Planning iterations
      3. The midpoint
      4. Velocity feedback
    3. Organizing the Iterations into Management Phases
    4. What's in an Iteration?
      1. Developing in pairs
      2. Acceptance tests
      3. Unit tests
      4. Refactoring
      5. Open office
      6. Continual integration
    5. Conclusion
    6. Notes
      1. Bibliography
  15. 8. Packages
    1. Java Packages
      1. Packages
      2. Dependencies
    2. Binary Components — .jar Files
    3. Principles of Package Design
      1. The Release/Reuse Equivalency Principle (REP)
      2. The Common Closure Principle (CCP)
      3. The Common Reuse Principle (CRP)
      4. The Acyclic Dependencies Principle (ADP)
      5. The Stable Dependencies Principle (SDP)
      6. The Stable Abstractions Principle (SAP)
    4. Conclusion
    5. Notes
      1. Bibliography
  16. 9. Object Diagrams
    1. A Snapshot in Time
    2. Active Objects
    3. Conclusion
  17. 10. State Diagrams
    1. The Basics
      1. Special events
      2. Superstates
      3. Initial and final pseudostates
    2. Using FSM Diagrams
      1. SMC
      2. ICE: A case study
    3. Conclusion
  18. 11. Heuristics and Coffee
    1. The Mark IV Special Coffee Maker
      1. A challenge
      2. A common, but hideous, coffee maker solution
      3. Missing methods
      4. Vapor classes
      5. Imaginary abstraction
      6. God classes
    2. A Coffee Maker Solution
      1. Crossed wires
      2. The coffee maker user interface
      3. Use Case 1: User pushes brew button
      4. Use Case 2: Containment vessel not ready
      5. Use Case 3: Brewing complete
      6. Use Case 4: Coffee all gone
      7. Implementing the abstract model
      8. Use Case 1: User pushes Brew button
      9. Implementing the isReady() functions
      10. Implementing the start() functions
      11. How does M4UserInterface.checkButton get called?
      12. Completing the Coffee Maker
      13. The benefits of this design
      14. How did I really come up with this design?
    3. OOverkill
    4. Notes
      1. Bibliography
  19. 12. SMC Remote Service: Case Study
    1. Caveat Emptor
      1. Unit Tests
    2. The SMCRemote System
    3. SMCRemoteClient
      1. SMCRemoteClient Command Line
      2. SMCRemote Communication Protocols
      3. SMCRemoteClient
      4. The Loggers
      5. The Remote Sessions
      6. RemoteSessionBase
      7. RemoteRegistrar
      8. RemoteCompiler
      9. FileCarrier
      10. SMCRemoteClient Conclusion
    4. SMCRemoteServer
      1. SocketService
      2. SMCRemoteService
      3. SMCRemoteServer
      4. ServerSession
      5. Three-Level FSM
      6. UserRepository
      7. OReillyEmailSender
      8. PasswordGenerator
    5. Conclusion
    6. Tests for SMCRemoteClient
    7. Tests for SocketService
    8. Tests for SMCRemoteServer
    9. Other Tests
    10. ServerController (SMC Generated)
    11. Notes
      1. Bibliography
    12. Endnotes