1 On To Object Design Chapter 14 Applying UML and Patterns -Craig Larman
2 Connection between SSDs, System Operations and Layers In a well-designed layered architecture that supports high cohesion and a separation of concerns, the UI layer objects will then forward the request from the UI layer onto the domain layer for handling.
How design objects? Code : Design while coding Draw, then code : UML on a whiteboard, then switch to code Only draw: tools generate everything from diagrams. 3
WSEP 06 Designing Objects Static and dynamic modeling. Two kinds of object models: Static models : Class diagrams / Package diagram / Deployment diagram Helps design definition of packages, class name, attributtes and method signature Dynamic models : Interaction Diagrams/ (Sequence / comunication). State machine diagrams/activity diagram Illustrate how objects collaborate via messages and methdos. They help design the logic and method bodies
5 Agile modeling practice Create Models in parallel! ( interaction diagram and class diagram) Modeling with others
6 UML INTERACTION DIAGRAMS Chapter 15 Applying UML and Patterns -Craig Larman
Sequence Diagrams 7 A First Look at interaction Diagrams Illustrate how objects interacts with each other. Emphasizes time ordering of messages. Can model simple sequential flow, branching, iteration (loop), …etc Sequence / communication
sequence diagram Each new object is added to the right Method of Object A Class A has an attribute of type B to be able to call doTwo and doThree. Methods of Object B
Code public class A { private B myB= new B(); Public void doOne() { myB.doTwo(); myB.doThree(); } Class A has an attribute of type B. Class A has a method named doOne Class B has methods named doTwo and doThree
Communication diagram
Interaction Diagram notation
Common UML Interraction diagram notation lifeline
Basic Sequence diagram n o tation
How to illustrate a return result ? Is equivalent to
Messages sent to itself
Creation of Instances Dashed line Sale class will invoke the new operator and call the constructor.
Object destruction
Conditional message : OPT frame is placed around one or more messages. opt : Optional fragment that execute if guard [color=red] is true
Conditional message : UML1.x notation
which notation do you prefer?
Loops (iteration over a collection)
Code page
Loops (iteration over a collection)
Which notation do you prefer
Nesting of frames 25
How relate Interaction diagram? 26
Invoke static (class)methods 27
Polymorphism in interaction diagrams? 28
UP artifacts influencing OO design
Questions? 30
aMember: BookBorrower theLibraryMember: LibraryMember theCopy: CopytheBook: Book borrow (theCopy) 1: okToBorrow 2: borrow 2.1:borrowed Can you guess the scenario from this interaction diagram ?
Collaboration diagram: Library System