Presentation is loading. Please wait.

Presentation is loading. Please wait.

OO Methodology Elaboration Iteration 3 – Part 2 Refining Models.

Similar presentations


Presentation on theme: "OO Methodology Elaboration Iteration 3 – Part 2 Refining Models."— Presentation transcript:

1 OO Methodology Elaboration Iteration 3 – Part 2 Refining Models

2 2 Table of Contents Iteration 1 –Use-Case Model –Process Sale Use Case –Domain Model –Design Model Iteration 2 –GRASP: More Patterns for Assigning Responsibilities –Designing Use-Case Realizations with GoF Design Patterns Iteration 3 –Related Use Cases –Modeling Generalization –Refining the Domain Model –Modeling Behavior in Statechart Diagrams –Activity Diagrams –Designing the Logical Architecture with Patterns –Designing More Use-Case Realization with Paterns –Designing a Persistence Framework with Patterns

3 3 Using Packages to Organize the Domain Model Package –a general-purpose mechanism for organizing elements into groups –a package is a group of model elements and diagrams package and name space –every model element that is not part of another model element must be declared within exactly one namespace –the namespace containing the declaration of an element is said to be own the element –a package is general-purpose namespace that can own any kind of model element

4 4 Using Packages to Organize the Domain Model Package Dependencies –there exists at least one usage dependency between elements of the two packages (Usage Dependency) Visibility –private: are not available at all outside the containing package –public: available to importing packages and to descendants of the package –protected : available to specialized package of the containing package –nested package has access to any elements directly contained in outer packages –outer package must import the contained packages

5 5 Packages in NextGen POS Packages in Domain Model Core/Misc Package

6 6 Packages in NextGen POS Payments Package

7 7 Packages in NextGen POS Products Sales

8 8 Authorization Services Packages in NextGen POS

9 9 Modeling Behavior in Statechart Diagram Modeling Dynamic Behavior –Sequencing Diagram –Collaboration Diagram –Statechart Diagram –Activity Diagram Statechart Diagram –describe which states an object can have during its life cycle, and the behavior in those states, along with what events cause the state to change Events, States, and Transitions –an event is a significant or noteworthy occurrence e.g. a telephone receiver is taken off the hook –a state is the condition of an object at a moment in a time e.g. a telephone is in the state of being “idle” –a transition is a relationship between two states tht indicates that when an event occurs e.g. off hootransition from the idle to active state

10 10 Modeling Behavior in Statechart Diagram Subject of a Statechart Diagram –classes –use cases –etc. Use Case Statechart Diagrams –to describe the legal sequence of external system events handled by a system in the context of the use case

11 11 Modeling Behavior in Statechart Diagram Statechart Diagrams for Classes –useful for state-dependent objects with complex behavior –cf. state-independent objects –process control and telecommunication domains often have more state-dependent objects than business information systems Examples of State-Dependent Classes –use cases (viewed as types) –systems –stateful session –windows –controllers –transactions –devices –role mutators –etc.

12 12 Modeling Behavior in Statechart Diagram Additional Notations in Statechart –transition action and guard condition –state variable and activities within state On first floor do/moving to floor Moving up Idle timer=0 do/increase timer Moving Down do/moving to floor [timer = time-out]/go down(first floor) go up(floor) arrived go down(floor) arrived

13 13 Modeling Behavior in Statechart Diagram Nested States –a state allows nesting to contain substates –a substate inherits the transitions of its superstate

14 14 Modeling Behavior in Statechart Diagram Example Timeout do/play message DialTone do/play dialtone Invalid do/play message Dialing Connecting Busy do/play busytone Ringing do/play busytone Talking Idle dial digit(n) [incomplete] after(15sec) dial digit(n) [valid]/connect dial digit(n) [invalid] connected busy callee answers caller hang ups/ disconnect lift receiver Active

15 15 Modeling Behavior in Statechart Diagram Implementation –Conditional Logic (e.g. Case Statement) –State Pattern Example : Digital Watch Display Set HoursSet Minutes mode_ button mode_ button inc/h = h + 1 do/display current time do/display hours do/display minutes inc/m = m + 1 mode_button Watch h, m, state mode_button() inc() void mode_button() { switch (state ) { case DISPLAY:... case HOURS :... case MIN :... }

16 16 Modeling Behavior in Statechart Diagram Example : Digital Watch –Using State Pattern Watch h, m mode_button() inc() State mode_button() inc() Display mode_button() Sethours mode_button() inc() Sethours mode_button() inc()

17 17 Activity Diagrams Activity diagram –is a state machine in which all or most of the states are activity state or action states –shows a procedure or workflow –shows sequential and concurrent activities Activity diagrams may be used in various purpose –to capture the work to be performed in the implementation of an operation –to show how a set of related actions may be performed and how they will affect objects around them –to show how an instance of a use-case may be performed –to show how a business works in terms of workers, workflows, organization, and objects Elements –Actions –Transitions (guard-condition, send-clause, action) –Swimlanes –Objects –Signals

18 18 Activity Diagrams Example Set up order Assign seats Charge credit card Award member bonus Assign seats Debit account merge fork join branch [subscription] [member] [single order]

19 19 Activity Diagrams Swimlanes –groups activities with respect to who is responsible for them or where they reside in an organization Request Order Take Order Fill Order Pay Deliver Order Collect Order [placed] Order [delivered] Order [entered] Order [entered] CustomerSales Stockroom object and its state

20 20 Activity Diagrams Signals and Deferred Events –signal is a way of asynchronous communication between two objects –deferred event is an event whose occurrence must be deferred for later use while some other activities is underway Turn on Machine Get Cups light goes out/defer Pour Coffee turn on light goes out deferred event


Download ppt "OO Methodology Elaboration Iteration 3 – Part 2 Refining Models."

Similar presentations


Ads by Google