Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dr. Kivanc DincerCS319 Week 6 - Oct.17,20051 Chapter 14 Onto Object Design Objectives Understand dynamic and static object design modeling. Try agile modeling,

Similar presentations


Presentation on theme: "Dr. Kivanc DincerCS319 Week 6 - Oct.17,20051 Chapter 14 Onto Object Design Objectives Understand dynamic and static object design modeling. Try agile modeling,"— Presentation transcript:

1 Dr. Kivanc DincerCS319 Week 6 - Oct.17,20051 Chapter 14 Onto Object Design Objectives Understand dynamic and static object design modeling. Try agile modeling, or a UML CASE tool for drawing. “I do not like this word ‘bomb’. It is not a bomb. It is a device that is exploiding.” - Ambassador Jackues le Blanc on nuclear weapons

2 Dr. Kivanc DincerCS319 Week 6 - Oct.17,20052 Agile Modeling and Lightweight UML Drawing Two of the aims of Agile modeling: –Reduce drawing overhead –Model to understand and communicate This is a change from a view of modeling as documentation. In a era of rapid change, documentation tends to have minimal value. More Agile Principles –Modeling with others –Create several models in parallel –Use temporary models such as diagrams on white boards –Digital photographs of white boards can be shared on a wiki. (See www.twiki.org)

3 Dr. Kivanc DincerCS319 Week 6 - Oct.17,20053 UML Case Tools You can also do agile modeling with UML case tools like Rational Rose, Together, or one that comes with a popular IDE such as Eclipse or Visual Studio. Choose a tool that can read your code and reverse engineer it to create diagrams from your code. Switch back and forth from diagramming to reverse engineering.

4 Dr. Kivanc DincerCS319 Week 6 - Oct.17,20054 How much time spent during UML before coding? Limit time spent drawing A few hours or at most one day of diagramming should do most of the work for a three week iteration. Occasional short sessions of modeling during the iteration can clarify any concepts that still need to be understood.

5 Dr. Kivanc DincerCS319 Week 6 - Oct.17,20055 Designing Objects: Static and Dynamic Modeling Dynamic models such as interaction diagrams (sequence or communication diagrams) help design logic, code behavior, and method bodies. Static Models such as class diagrams help define packages, class names, attributes, and method signatures. Switch back and forth during modeling sessions.

6 Dr. Kivanc DincerCS319 Week 6 - Oct.17,20056 Dynamic Models Most of the challenging, interesting, and useful design work comes during dynamic modeling. –The interaction diagrams are typically where we apply design patterns such as the GRASP patterns. If the most important skill in object design is assigning behavior to objects, this is when it usually takes place. Dynamic UML models include –sequence, –communication, –state machine –and deployment diagrams.

7 Dr. Kivanc DincerCS319 Week 6 - Oct.17,20057 Static Models If behavior is designed during dynamic modeling, it is the static models, such as the class diagrams, which give the overall structure to our software, and allow us to divide the work into manageable and maintainable chunks. Static UML models include –class, –package, –and deployment diagrams.

8 Dr. Kivanc DincerCS319 Week 6 - Oct.17,20058 The Importance of Object Design Skill over UML Notation Skill UML is only an ancillary tool to object design. The real skill is the design, not the diagramming. Seeking a software design job because you are good at making UML diagrams is like seeking a career as a novelist because you have good penmanship.

9 Dr. Kivanc DincerCS319 Week 6 - Oct.17,20059 Other Object Design Techniques: CRC Cards An alternative to UML Object Design is the Class, Responsibility, Collaboration Cards popularized by Kent Beck in eXtreme Programming. –There are some brief examples in the text, but you should get a book on eXtreme Programming or go to a Web site if you are interested.

10 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200510 CRC Cards

11 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200511 Chapter 15 UML Interaction Diagrams Objectives Provide a reference for frequently used UML interaction diagram notation – sequence and communication diagrams “Cats are smarter than dogs. You can’t get eight cats to pull a sled through snow.” - Jeff Waldez

12 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200512 Introduction Why do objects exist? –To perform an activity to help fulfill a system’s purpose UML interaction diagrams are used to illustrate how objects interact via messages. –They are used for dynamic object modeling. Interaction Diagrams provide a thoughtful, cohesive, common starting point for inspiration during programming

13 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200513 Interaction Diagrams There are two common types: –Sequence diagrams –Communication diagrams Both diagram types are semantically equivalent, however, they may not show the same information –Communication Diagrams emphasize the structural organization of objects, while Sequence Diagrams emphasize the time ordering of messages –Communication Diagrams explicitly show object linkages, while links are implied in Sequence Diagrams

14 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200514 Fig. 15.1 Sequence diagram Fig. 15.2 Communication diagram

15 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200515 Fig. 15.4 Communication diagram Fig. 15.3 Sequence diagram

16 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200516 Comparison of Diagrams TypeStrengthsWeaknesses Sequence Diagram -clearly shows sequence or time ordering of messages. - large set of detailed notation options. - forced to extend to the right when adding new objects; consumes horizontal space Communication Diagram Space economical – flexibility to add new objects in two dimensions. -more difficult to see sequence of messages. -fewer notation options.

17 Basic Sequence Diagram Notation

18 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200518 Fig. 15.5 Lifeline boxes to Show participants in interactions

19 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200519 Fig. 15.6 Singletons in interaction diagrams

20 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200520 Fig. 15.7 Messages and focus of control with execution specification bar (activation bar)

21 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200521 Fig. 15.8 Two ways to show a return result from a message.

22 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200522 Fig. 15.9 Messages to `this`

23 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200523 Fig. 15.10 Instance creation and object lifelines

24 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200524 Fig. 15.11 Object destruction

25 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200525 Fig. 15.12 Example UML frame (regions or fragments of the diagrams) Frame OperatorMeaning altAlternative fragment for mutual exclusion loopLoop fragment while guard is true optOptional fragment that executes if guard is true parParallel fragments that execute in parallel regionCritical region within which only one thread can run

26 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200526 Fig. 15.13 A conditional message / Optional fragment that executes if guard is true

27 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200527 Fig. 15.14 A conditional message in UML 1.x notation – a simple style.

28 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200528 Fig. 15.15 Mutually exclusive conditional messages. /Alternative fragment for mutual exclusion

29 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200529 Fig. 15.16 Iteration over a collection using relatively explicit notation Fig. 15.17 Iteration over a collection using more implicit notation

30 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200530 Fig. 15.18 Nesting of frames

31 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200531 Fig. 15.19 Example interaction occurrence, sd and ref frames.

32 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200532 Fig. 15.20 Invoking class or static methods.

33 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200533 Fig. 15.21 Modeling polymorphic cases.

34 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200534 Fig. 15.22 Asynchronous calls and active objects

35 Basic Communication Diagram Notation

36 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200536 Fig. 15.23 Link lines Fig. 15.24 Messages

37 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200537 Fig. 15.25 Messages to `this`

38 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200538 Fig. 15.26 Instance creation

39 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200539 Fig. 15.27 Sequence numbering

40 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200540 Fig. 15.28 Complex sequence numbering

41 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200541 Fig. 15.29 Conditional message

42 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200542 Fig. 15.30 Mutually exclusive messages

43 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200543 Fig. 15.31 Iteration

44 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200544 Fig. 15.32 Iteration over a collection

45 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200545 Fig. 15.33 Messages to a class object (static message invocation)

46 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200546 Fig. 15.34 An approach to modeling polymorphic cases.

47 Dr. Kivanc DincerCS319 Week 6 - Oct.17,200547 Fig. 15.35 Asynchronous call


Download ppt "Dr. Kivanc DincerCS319 Week 6 - Oct.17,20051 Chapter 14 Onto Object Design Objectives Understand dynamic and static object design modeling. Try agile modeling,"

Similar presentations


Ads by Google