Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS551 - Lecture 8 1 CS551 Modelling with Objects (Chap. 3 of UML) Yugi Lee STB #555 (816) 235-5932

Similar presentations


Presentation on theme: "CS551 - Lecture 8 1 CS551 Modelling with Objects (Chap. 3 of UML) Yugi Lee STB #555 (816) 235-5932"— Presentation transcript:

1 CS551 - Lecture 8 1 CS551 Modelling with Objects (Chap. 3 of UML) Yugi Lee STB #555 (816) 235-5932 yugi@cstp.umkc.edu www.cstp.umkc.edu/~yugi

2 2 CS551 - Lecture 8 Object Modelling Static model: the state of an object at any given moment (object attributes, relationships, constraints between objects) Dynamic model: the changes that happen to the state as event occur (actions affect objects, using the changes of objects and attributes in the object state) Interactive model: interactions between objects (the responsibility for achieving goal is divided among collaborating objects)

3 3 CS551 - Lecture 8

4 4 Modeling Objects: Definitions Object: anything that presents a definable encapsulated behavior to the world around it; e.g. individual programming-language objects, software components, programs, Type: a collection of objects with similar behaviors, satisfying the specification of that type Type model: Behaviors are specified in terms of attributes, a valid abstract model of many possible implementations.

5 5 CS551 - Lecture 8

6 6 Static Model The state of an object at any given point in time: individual identity, characteristic behavior, and state (a combination of stored state and executable code) –a set of attributes: properties that define information on the state of the object at any point in time; e.g. a set of LineItems (quantity of a product), the orderTotal, and the Customer. –a set of static invariants: rules on what combinations of attribute values are valid for that object's state to be valid; e.g. "no two LineItems can be for the same Product", or "the orderTotal cannot be greater than the customer's credit limit".

7 7 CS551 - Lecture 8 Type Model Sales System > Interface Operations of System System of Interest Model of object types for terms used to specify system operations Not a stored data model Object type and abstract attribute Sale SaleItem quantity Payment Authorization * * * currSale Cust Product inventory

8 8 CS551 - Lecture 8 Modeling State A snapshot shows a set of objects and their configuration at a point in time (the values of their attributes or links to other objects). A filmstrip shows a sequence of snapshots evolving through the steps of a scenario.

9 9 CS551 - Lecture 8 Modeling Object State Attributes: model and reality Parameterized attribute –session-5.startDate.isLessThan (today) –session-5.startDate < today Association: a pair of attributes that are inverses of each other, drawn as a line joining the two types on a type model.

10 10 CS551 - Lecture 8

11 11 CS551 - Lecture 8 Modeling Object State: Invariants Collections –Set: a collection of objects without any duplicates; –Bag: a collection with duplicates of elements; –Seq: a sequence-a bag with an ordering of its elements. Operators: –dot (“.”) operator for a collection evaluates an attribute on every element of the collection; e.g., clients.sessions = Set {s1, s5, s9} –The -> operator for a collection evaluates an attribute on the collection itself; e.g., client3.sessions -> count =3

12 12 CS551 - Lecture 8 Modeling Object State: Invariants forAll, exists //every one of laura’s session grades is better than pass. laura.sessions.grade -> forAll (g|g.betterThan(Grade.pass)) union (+), intersection (*), difference (-) //the courses taught by either laura.sessions.course + marty.sessions.course //the courses taught by both laura.sessions.course * marty.sessions.course //the course taught by Laura that are not taught by Marty laura.session.course - marty.sessions.course

13 13 CS551 - Lecture 8 Static Invariants Boolean Operators: an invariant is a Boolean expression & Quantifier (forall, exists) –and (&), or (|), a implies b (a ==> b), not a (!a), –aSet -> forall (x|P(x)) is equivalent to x:aSet::P(x), –aSet -> exists (x|P(x)) is equivalent to exist x:aSet, P(x) Context Operator(::); short for an explicit forall // a session has an evaluation exactly when it is completed. –inv Session::self.completed = (self.eval <> null) –inv Session -> forall (self | self.completed = (self.eval <> null))

14 14 CS551 - Lecture 8 Boolean Operators

15 15 CS551 - Lecture 8

16 16 CS551 - Lecture 8 Dictionary The collected set of definitions of modeling constructs. The definitions must include – the formal modeling and specification bits (relating the formal names and symbols to each other) – the (usually informal) description that relate the symbols and names to things in the problem domain. Dictionary definitions are scoped according to package scope rules.

17 17 CS551 - Lecture 8 A Typical Dictionary

18 18 CS551 - Lecture 8 Static Model: Summary Describes the state of the business or the component(s) we are interested in, with a set of attributes, together with an invariant, constitutes the static part of a type model. –each concept is described with a type –its state is described with attributes and associations –The invariant express constraints on the state: combinations of values that should always be observed. To provide a vocabulary in which to describe actions, which include interactions in a business, between user and software, or between objects inside the software. Snapshots are used to represent specific situations, and helps to develop the static model.


Download ppt "CS551 - Lecture 8 1 CS551 Modelling with Objects (Chap. 3 of UML) Yugi Lee STB #555 (816) 235-5932"

Similar presentations


Ads by Google