object oriented
play

Object-Oriented subsystems, modules and their relationships a - PDF document

ICS 121: Software Methods and Tools Topic 10:OOAD Design - Review Design transforms requirements into ICS 121 Topic 10: an architecture diagram Object-Oriented subsystems, modules and their relationships a detailed design


  1. ICS 121: Software Methods and Tools Topic 10:OOAD Design - Review • Design transforms requirements into ICS 121 Topic 10: – an architecture diagram Object-Oriented • subsystems, modules and their relationships – a detailed design Analysis and Design • a specification of the abstract interface, data structures, and algorithms of each module • Also develops Object Modeling Technique – a review plan for ensuring the design meets the requirements Unified Modeling Language – a test plan for ensuring the implementation meets the design Class Modeling Dynamic Modeling Topic 10 OOAD 2 Object Modeling Technique (OMT) Object-Oriented Analysis and Design • Object-Oriented Analysis is the “requirements phase” • OMT [Rumbaugh et al.,1991] consists of – an alternative semi-formal technique focused on objects in real world – building three complementary models of the system • Object-Oriented Design is the “design phase” – adding implementation details to the models – refine object definitions and their interactions until “implementable” – implementing the models • OMT includes a set of • Semi-formal technique • Reuses familiar tools – functional modeling – E-R diagrams – phases [processes] – class modeling – Finite State Machines – diagramming techniques – dynamic modeling – Data flow diagrams • OMT has four phases • These steps focus on • Steps and diagrams – object-oriented analysis builds a real-world model – data – are typically performed in parallel after initial class – system design determines overall architecture of system – actions definition – and their relationships – object design decides upon data structures and algorithms – must be kept in synch – implementation translates design into programming language Topic 10 OOAD 3 Topic 10 OOAD 4 OMT Stages and Models Unified Modeling Language • The Three Amigos join forces to form a single UML - Static structure of objects and their relationships – Grady Booch at Rational has his own technique Analysis - Model of real-world situation • Object-Oriented Analysis and Design [Booch, 1994] - What ? - Control aspects of the system – 1994: Jim Rumbaugh joins Rational - Data value transforamtions System Design - Overall architecture (sub-systems) • Object Modeling Technique [Rumbaugh, et.al. 1991] (dataflow diagrams) Functional Model (object diagram) (state diagrams) Dynamic Model Object Model • UML is initiated as a combination of the models in OMT and OOAD Object Design - Refinement of Design – 1995: Ivar Jacobson joins Rational - Algorithms/data structures to implement each class • Object-Oriented Software Engineering [Jacobson, et.al., 1992] • the use case model is added to UML Implementation - Translation of object classes and relationships to a particular UML is just a common notation, however, object-oriented language time not a methodology rather it can be used with a variety of methodologies System Topic 10 OOAD 5 Topic 10 OOAD 6 Spring 2000 1

  2. ICS 121: Software Methods and Tools Topic 10:OOAD Object-Oriented Modeling UML Models • Builds a real-world model from requirements • Use Case Model (takes the place of the functional model in OMT) – client interviews – user orientation – domain knowledge – what does the system do? how are various results computed – real-world experience (without regard to sequence)? • The model addresses three aspects of objects • Class Model – overall functionality – static structure – class structure and relationships – what objects are in the system? how are they related? – sequencing of interactions and events • Dynamic Model Model is more precise and concise than – behavioral aspects the informal problem definition – what events occur, when do they occur and in what order? Topic 10 OOAD 7 Topic 10 OOAD 8 OMT Analysis and Design: Steps Class Modeling • Functional Modeling • Identify objects and classes • Class Modeling • Prepare a data dictionary • Dynamic Modeling • Identify associations between objects • Identify class attributes and initial set of operations • Refine the Class Model (add Operations) • Organize object classes using inheritance • Iterate and refine all models – After the first iteration, steps may occur in parallel or out of order – All models must be kept in synch as changes are made Topic 10 OOAD 9 Topic 10 OOAD 10 Classes, Attributes and Operations Object Model Notation, review • Attributes define the properties of the objects – every instance of the class has the same attributes Class Name Classes are represented as rectangles; – an attribute has a data type InstanceVariable1 The class name is at the top, followed by attributes (instance variables) and methods (operations) InstanceVariable2: type – the values of the attributes may differ among instances • Operations define the behavior of the objects Depending on context some information can be Method1() Method2(arguments) return type hidden such as types or method arguments – action performed on or by an object – available for all instances of the class Objects are represented as rounded rectangles; (Class Name) – need not be unique among classes The object’s name is its classname surrounded by Class Attributes Operations InstanceVariable1 = value parentheses InstanceVariable2: type ball radius, weight catch, throw Method1() Instance variables can display the values that they football air pressure pass, kick, hand-off Method2(arguments) return type baseball liveness hit, pitch, tag have been assigned; pointer types will often point (not shown) to the object being referenced Topic 10 OOAD 11 Topic 10 OOAD 12 Spring 2000 2

  3. ICS 121: Software Methods and Tools Topic 10:OOAD Instantiation: example Object Instantiation Notation Class Name Class Person (Person) attribute_1: data_type_1 = default_1 attribute_2: data_type_2 = default_2 name Joe Smith age age=39 . . . weight weight=158 attribute_m: data_type_m = default_m (Class Name) (Person) attribute_1 = value_1 Mary Wilson Instance age=27 attribute_2 = value _2 weight=121 . . . attribute_m = value _m Topic 10 OOAD 13 Topic 10 OOAD 14 Inheritance Object Inheritance Notation • Classes with a set of similar attributes and operations may be organized into a hierarchical relationship Generalization Superclass • Common attributes and operations are factored out and assigned to a broad superclass (generalization) Class Ball Attributes Radius, Weight – generalization is the “is-a” relationship Operations Throw, Catch – superclasses are ancestors, subclasses are descendants • A class can be iteratively refined into subclasses that Subclasses inherit the attributes and operations of the superclass Football Baseball Basketball air pressure liveness air pressure , dimples (specialization) pass, kick, hand-off hit, pitch, tag shoot, dribble, pass Specialization Topic 10 OOAD 15 Topic 10 OOAD 16 Association and Links Object Association Notation • An association is a relation among two or more classes Class, Association, and Roles describing a group of links, with common structure and Company Person semantics Works For • A link is a relationship or connection between objects equivalent and is an instance of an association • A link or association is inherently bi-directional Company Person Employs – the name may imply a direction, but it can usually be inverted Employer Employee – the diagram is usually drawn to read the link or association from left to right or top to bottom Object and Link • A role is one end of an association (Person) (Company) Works For – roles may have names IBM Johnson Topic 10 OOAD 17 Topic 10 OOAD 18 Spring 2000 3

  4. ICS 121: Software Methods and Tools Topic 10:OOAD Association and Links Multiplicity of Associations • Multiplicity is the number of instances of one class that has-capital Country City may relate to a single instance of an associated class Class diagram name name 1 – 1-to-1 * – 1-to-many (0 or more) (Country) has-capital (City) 0..1 – 1-to-(zero-or-one) ‘optional’ Canada Ottawa 1..* – 1-to-(one-or-more) ‘required’ n (Country) has-capital (City) – 1-to-n Instance diagram France Paris (Country) has-capital (City) Austria Vienna Topic 10 OOAD 19 Topic 10 OOAD 20 Association Class OMT Multiplicity Notation • Enables you to add attributes, operations and other features to associations Instructor Courses 1..* Teach * works-for Person Company * Enroll name name Job address 6..65 salary Student Each course has at least one instructor and job title between 6 and 65 students enrolled A student may enroll in many courses An instructor may teach many courses Topic 10 OOAD 21 Topic 10 OOAD 22 Aggregation Object Aggregation Notation • Aggregation is a special form of association that indicates a “part-of” relationship between a whole and its parts Window • Useful when the parts do not have independent existence – A part is subordinate to the whole • In an aggregation, properties and operations may be propagated from the whole to its parts TitleBar ScrollBar Border Topic 10 OOAD 23 Topic 10 OOAD 24 Spring 2000 4

Recommend


More recommend