Você está na página 1de 4

University of Toronto Department of Computer Science University of Toronto Department of Computer Science

Lecture 16: Object Oriented Analysis


Object Oriented Modeling Methods ➜ Background
 Model the requirements in terms of objects and the services they provide
➜ Basics of Object Oriented Analysis  Grew out of object oriented design
 Notations used  partitions the problem in a different way from structured approaches
 Poor fit moving from Structured Analysis to Object Oriented Design
 Modeling Process

➜ Variants ➜ Motivation
 Coad-Yourdon  OOA is (claimed to be) more ‘natural’
 As a system evolves, the functions (processes) it performs tend to change, but
 Shlaer-Mellor the objects tend to remain unchanged…
 Fusion  …so a structured analysis model will get out of date, but an object oriented
model will not…
 UML
 …hence the claim that object-oriented systems are more maintainable

➜ Advantages and Disadvantages  OOA emphasizes importance of well-defined interfaces between objects
 compared to ambiguities of dataflow relationships

NOTE: OO applies to requirements engineering because it is a modeling tool. But


in RE we are modeling domain objects, not the design of the new system

© 2001, Steve Easterbrook 1 © 2001, Steve Easterbrook 2

University of Toronto Department of Computer Science University of Toronto Department of Computer Science

Modeling primitives Key Principles


See also: van Vliet 1999, section 12.2 See also: van Vliet 1999, section 12.2

➜ Objects ➜ Methods (services, functions) ➜ Classification (using inheritance)


 an entity that has state, attributes  These are the operations that all
 Classes capture commonalities of a number of objects
and services objects in a class can do…
 Each subclass inherits attributes and methods from its parent
 Interested in problem-domain objects  …when called on to do so by other
 Forms an ‘is_a’ hierarchy
for requirements analysis objects
E.g. Constructors/Destructors (if  Child class may ‘specialize’ the parent class
➜ Classes objects are created dynamically)
 by adding additional attributes & methods
E.g. Set/Get (access to the object’s
 Provide a way of grouping objects state)  by replacing an inherited attribute or method with another
with similar attributes or services
 Multiple inheritance is possible where a class is subclass of several
 Classes form an abstraction hierarchy ➜ Message Passing different superclasses.
though ‘is_a’ relationships
 How objects invoke services of other
➜ Attributes objects ➜ Information Hiding
 Together represent an object’s state ➜ Use Cases/Scenarios  internal state of an object need not be visible to external viewers
 May specify type, visibility and  Sequences of message passing  Objects can encapsulate other objects, and keep their services internal
modifiability of each attribute between objects  useful for forming abstractions
 Represent specific interactions
Relationships
Aggregation

 ‘is_a’ classification relations

 ‘part_of’ assembly relationships  Can describe relationships between parts and the whole
 ‘associations’ between classes
© 2001, Steve Easterbrook 3 © 2001, Steve Easterbrook 4
University of Toronto Department of Computer Science University of Toronto Department of Computer Science

Information Hiding Nearly anything can be an object…


See also: van Vliet 1999, section 12.3

➜ Objects can contain other objects ➜ External Entities ➜ Organizational Units


 (compare with hierarchies of dataflow diagram in Structured Analysis)  …that interact with the system  that are relevant to the application
being modeled E.g. division, group, team, etc.
System Model E.g. people, devices, other systems
Object 2 ➜ Places
Object 1 ➜ Things  …that establish the context of the
Service 1  …that are part of the domain being problem being modeled
Method 1
Method 1 Service 5 modeled E.g. manufacturing floor, loading
Service 2 Method 2 E.g. reports, displays, signals, etc. dock, etc.
Method 2
Service 6 ➜ Occurrences or Events ➜ Structures
 …that occur in the context of the  that define a class or assembly of
system objects
Service 3 Object 3 E.g. transfer of resources, a control E.g. sensors, four-wheeled vehicles,
action, etc. computers, etc.
Service 4 Method 1
➜ Roles Some things cannot be objects:
Method 2  played by people who interact with  procedures (e.g. print, invert, etc)
the system  atomic attributes (e.g. blue, 50Mb,
etc)

© 2001, Steve Easterbrook 5 © 2001, Steve Easterbrook 6

University of Toronto Department of Computer Science University of Toronto Department of Computer Science

Selecting Objects
Source: Adapted from Pressman, 1994, p244
Variants
See also: van Vliet 1999, section 12.3

➜ Need to choose which candidate objects to include ➜ Coad-Yourdon


in the analysis  Developed in the late 80’s
 Coad & Yourdon suggest each object should satisfy (most of) the following  Five-step analysis method
criteria:
 Retained information: Does the system need to remember information about this ➜ Shlaer-Mellor
object?
 Needed Services: Does the object have identifiable operations that change the  Developed in the late 80’s
values of its attributes?  Emphasizes modeling information and state, rather than object interfaces
 Multiple Attributes: If the object only has one attribute, it may be better
represented as an attribute of another object ➜ Fusion
 Common Attributes: Does the object have attributes that are shared with all
occurrences of the object?  Second generation OO method
 Common Operations: Does the object have operations that are shared with all  Introduced message sequence charts
occurrences of the object?
 Note: External entities that produce or consume information essential to ➜ Unified Modeling Language (UML)
the system are nearly always objects
 Third generation OO method
 Many candidate objects will be eliminated or combined
 An attempt to combine advantages of previous methods

© 2001, Steve Easterbrook 7 © 2001, Steve Easterbrook 8


University of Toronto Department of Computer Science University of Toronto Department of Computer Science

Coad-Yourdon
Source: Adapted from Pressman, 1994, p242 and Davis 1990, p98-99
Coad Object diagrams
object Source: Adapted from Davis, 1990, p67-68

➜ Five Step Process: patient


1. Identify Objects & Classes (i.e. ‘is_a’ relationships) patient Name
One-to-one
services Date of Birth
2. Identify Structures (i.e. ‘part_of’ relationships) attributes Name optional Height
Date of Birth Weight
3. Define Subjects Height
 A more abstract view of a large collection of objects Weight
 Each classification and assembly structure become one subject
classification assembly One-to-many
 Each remaining singleton object becomes a subject (although if there a many of
these, look for more structure!)
 Subject Diagram shows only the subjects and their interactions mandatory
4. Define Attributes and instance connections
5a. Define services - 3 types:
 Occur (create, connect, access, release) These are omitted from the model as In-patient Out-patient heart kidney eyes
every object has them Last visit
Room Natural/artif. Natural/artif. Natural/artif.
 Calculate (when a calculated result from one object is needed by another) next visit
Bed Orig/implant Orig/implant Vision
 Monitor (when an object monitors for a condition or event) Physician
physician
normal bpm number number
5b. Define message connections
 These show how services of one object are used by another
 Shown as dotted lines on object and subject diagrams
 Each message may contain parameters

© 2001, Steve Easterbrook 9 © 2001, Steve Easterbrook 10

University of Toronto Department of Computer Science University of Toronto Department of Computer Science

Shlaer-Mellor Fusion
➜ Three analysis models: ➜ Combines several OO Message Sequence Charts
 Information Model
 models objects, relationships, and attributes of objects and relationships methods External
User System
 uses associative objects to represent relationships between other objects. system
 E.g. ‘title’ is an object that represents the relationship between ‘owner’ and ‘car’ ➜ Analysis phase: Event 1
1. HOME (H)  Object model
1. HOME  like Shlaer-Mellor
* address owns Is owned by Event 2
OWNER (HO)  Operation model
* Unit at address
* Owner name  formal definition of each operation,
• square feet Response
• address  including pre- and post- conditions
• property tax fee
1. OWNERSHIP (O)  Lifecycle model
Identifier * Address (R1)  specifies admissible sequences of
* Unit at Address (R1) One or more interactions between system &
Associative Object environment
* Owner name (R1)
Exactly one  Interaction model
• Date purchased Event 3
 State model  = operation model + lifecycle model
Response
 Uses StateCharts to show the lifecycle of each object
 Each object may be continuous or born-and-die (object is created & destroyed) ➜ Message Sequence Charts
Response
 Process model  help to develop the interaction
 representation of each service (‘action’) of an object model
 Uses standard Dataflow Diagrams to show information used
© 2001, Steve Easterbrook 11 © 2001, Steve Easterbrook 12
University of Toronto Department of Computer Science University of Toronto Department of Computer Science

Unified Modeling Language (UML) Evaluation of OOA


➜ Third generation OO method ➜ Advantages of OO analysis for RE
 Booch, Rumbaugh & Jacobson are principal authors  Fits well with the use of OO for design and implementation
 Still in development  Transition from OOA to OOD ‘smoother’ than from SA to SD (but is it?)
 Attempt to standardize the proliferation of OO variants  Removes emphasis on functions as a way of structuring the analysis
 Is purely a notation  Avoids the fragmentary nature of structured analysis
 No modeling method associated with it!  object-orientation is a coherent way of understanding the world
 But has been accepted as a standard for OO modeling
 But is primarily owned by Rational Corp. (who sell lots of UML tools and services) ➜ Disadvantages
 Emphasis on objects brings an emphasis on static modeling
➜ Has a standardized meta-model  although later variants have introduced dynamic models
 Class diagrams  Not clear that the modeling primitives are appropriate
 Use case diagrams  are objects, services and relationships really the things we need to model in RE?
 Message trace diagrams  Strong temptation to do design rather than problem analysis
 Object message diagrams  Too much marketing hype
 State Diagrams (uses Harel’s statecharts)  and false claims - e.g. no evidence that objects are a more natural way to think

 Module Diagrams
 Platform diagrams
© 2001, Steve Easterbrook 13 © 2001, Steve Easterbrook 14

University of Toronto Department of Computer Science

References
van Vliet, H. “Software Engineering: Principles and Practice (2nd Edition)” Wiley,
1999.
chapter 12 is a thorough overview of object oriented analysis and design. van Vliet introduces all the
main notations of UML, and describes several older methods too.

Svoboda, C. P. “Structured Analysis”. In Thayer, R. H and Dorfman, M.


(eds.) “Software Requirements Engineering, Second Edition”. IEEE
Computer Society Press, 1997, p255-274
Excellent overview of the history of structured analysis, and a comparison of the variants

Davis, A. M. “Software Requirements: Analysis and Specification”.


Prentice-Hall, 1990.
This is probably the best textbook around on requirements analysis, although is a little dated now.

© 2001, Steve Easterbrook 15

Você também pode gostar