Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.

Similar presentations


Presentation on theme: "Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match."— Presentation transcript:

1 Object-Oriented Modeling: Static Models

2 Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match experience Match experience  We are surrounded by objects: people, trees, cars, towns and houses  Objects are related to each other Reduce the "semantic gap" Reduce the "semantic gap"

3 Key Object-oriented ideas (Pfleeger) Identity Identity Abstraction Abstraction Classification Classification Encapsulation Encapsulation Inheritance Inheritance Polymorphism Polymorphism Persistence Persistence

4 OO Concepts (Eriksson et al, 2004) OO is a technology for producing models that reflect a domain OO is a technology for producing models that reflect a domain Every object is an instance of a class. Objects have names, attributes, and operations. Every object is an instance of a class. Objects have names, attributes, and operations. OO models, when constructed correctly, are easy to communicate, change, expand, validate, and verify. OO models, when constructed correctly, are easy to communicate, change, expand, validate, and verify. OO systems are flexible, have well-defined architectures, and provide reusable components. OO systems are flexible, have well-defined architectures, and provide reusable components. OO models are conveniently implemented in software, but OO is more than just programming constructs. OO models are conveniently implemented in software, but OO is more than just programming constructs. OO requires a method that integrates development and modeling. OO requires a method that integrates development and modeling.

5 Advantages of O-O Approach Requires analysis Requires analysis Emphasis on data and function. Emphasis on data and function. Seamless development process. Seamless development process.  Use analysis models for design and implementation  Progressively refine work rather than converting from one representation to another Iterative rather than sequential. Iterative rather than sequential.  Each iteration builds on previous work  Progress from analysis to design to implementation  Avoid replacing previous work

6 OO Analysis Objective To develop precise, concise, understandable, and correct models of the problem context. To develop precise, concise, understandable, and correct models of the problem context.

7 Object Modeling Involves systems analysis and design based on three different views of the system: Involves systems analysis and design based on three different views of the system:  Object Models  Dynamic Models  Functional Models

8 Activities and Products of OOA 0. State the requirements 1. Build an Object Model 2. Develop a Dynamic Model 3. Construct a Functional Model 4. Verify, iterate, and refine the three models

9 1. Build an Object Model Identify objects and classes Identify associations between objects Identify attributes of objects and associations Organize and simplify object classes using inheritance Verify that paths exist for likely operations

10 2. Develop a Dynamic Model Prepare scenarios of typical interaction sequences Identify Events between objects and prepare an event trace Build a state diagram, sequence diagram, or communication diagram Match events between objects to verify consistency

11 3. Construct a Functional Model Identify Input and Output Values Build Use Case scenarios Build Data Flow Diagrams showing functional dependencies Describe Functions Identify Constraints Specify Optimization Criteria

12 Phases Analysis Analysis Design Design

13 An Object is:

14 Objects often correspond to nouns May represent physical entities May represent physical entities May represent concepts or roles May represent concepts or roles May represent an interaction May represent an interaction

15 Classes A class is a "template" describing a set of objects with A class is a "template" describing a set of objects with  similar properties (attributes),  common behavior (operations),  common relationships to other objects, and  common semantics.

16 Instances An instance of a class is an object created at runtime created at runtime based on a class (template). based on a class (template). Sometimes class and object are used to mean the same thing (by mistake). Sometimes class and object are used to mean the same thing (by mistake). An instance is used to refer to exactly one thing. An instance is used to refer to exactly one thing.

17 Attribute (The abstraction of) a single characteristic possessed by all the instances of a class.

18 How to recognize attributes Descriptive attributes. Descriptive attributes.  Provide facts intrinsic to each instance of an object. Naming Attributes. Naming Attributes.  Provide facts about the arbitrary labels and names carried by each instance of an object. Referential Attributes. Referential Attributes.  Capture the facts that tie an instance of one object to an instance of another object.

19 Operations and Methods Behavior of objects is realized via operations. Behavior of objects is realized via operations.  a function or transformation that may be applied  to objects in a class.  by objects in a class  All objects in a class share the same operations. Method: the implementation of an operation. Method: the implementation of an operation. Operations usually correspond to verbs in a natural language. (print, open, transform, mail) Operations usually correspond to verbs in a natural language. (print, open, transform, mail)

20 Recognizing Operations Manipulate data: Manipulate data: Perform a calculation. Perform a calculation. Monitor the object to verify the occurrence of an event that is controlling the object. Monitor the object to verify the occurrence of an event that is controlling the object.

21 UML Class Diagram Class Name Attributes Operations These may be abstract or at the source code level

22 UML Class Diagrams Employee Name: ID: SetName (string): void (Employee) Joe The box on the right is an instance of the Employee object.

23 Class Relationships Aggregation Dependency Relationship between two elements, one independent, one dependent Association A connection between two classes Generalization A relationship between a more general and a more specific class. The more specific can contain additional information An association that suggests that one class contains another

24 Shared Aggregation Class A Class B Role A Role B The diamond is open (not filled). This says “B is a part of A.” A is made of B’s. The B’s are part of A.

25 Composition Aggregation Class A Class B Role A Role B Here the diamond is filled. The part object may belong to only one whole. The parts are expected to live and die with the whole. If the whole is deleted, the parts go with it.

26 UML notation: subtypes/generalization Customer Corporate Customer Private Customer Every attribute of Customer is also an attribute of its subclasses.

27 Notes: Subtypes/Supertypes: Inheritance Every subtype must have the “is a” relationship with its supertype. Every subtype must have the “is a” relationship with its supertype. These are also known as “parent class” and “child class”. These are also known as “parent class” and “child class”. All attributes and methods of the parent are also attributes and methods of the child. All attributes and methods of the parent are also attributes and methods of the child.

28 Reasons for using Inheritance Introduce a new class only if it provides significantly new or modified functionality. Introduce a new class only if it provides significantly new or modified functionality. Extension: Extension: Restriction: Restriction:


Download ppt "Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match."

Similar presentations


Ads by Google