1 / 18

CS551 Modelling with Objects (Chap. 3 of UML)

CS551 Modelling with Objects (Chap. 3 of UML). Yugi Lee STB #555 (816) 235-5932 yugi@cstp.umkc.edu www.cstp.umkc.edu/~yugi. Object Modelling. Static model : the state of an object at any given moment (object attributes, relationships, constraints between objects)

yorick
Download Presentation

CS551 Modelling with Objects (Chap. 3 of UML)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 CS551 - Lecture 8

  2. 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) CS551 - Lecture 8

  3. CS551 - Lecture 8

  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. CS551 - Lecture 8

  5. CS551 - Lecture 8

  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". CS551 - Lecture 8

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

  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. CS551 - Lecture 8

  9. 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. CS551 - Lecture 8

  10. CS551 - Lecture 8

  11. 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 CS551 - Lecture 8

  12. 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 CS551 - Lecture 8

  13. 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)) CS551 - Lecture 8

  14. Boolean Operators CS551 - Lecture 8

  15. CS551 - Lecture 8

  16. 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. CS551 - Lecture 8

  17. A Typical Dictionary CS551 - Lecture 8

  18. 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. CS551 - Lecture 8

More Related