Documente Academic
Documente Profesional
Documente Cultură
OO Analysis Overview Architectural Analysis Identify Entity Domain Modeling General Principles in Assigning Responsibilities Analysis Class and Use Case Realization
OO Analysis Overview
Understanding Analysis
In software engineering, analysis is the process of converting the user requirements to system specification system means the software to be developed. System specification, also known as the logic structure, is the developers view of the system. Function-oriented analysis concentrating on the decomposition of complex functions to simply ones. Object-oriented analysis identifying objects and the relationship between objects.
Understanding Analysis
The goal in Analysis is to understand the problem
and to begin to develop a visual model of what you are trying to build, independent of implementation and technology concerns. Analysis focuses on translating the
Design
Focus on understanding the solution Operations and Attributes Performance Close to real code Object lifecycles Non-functional requirements A large model
Architectural Analysis
10
Architectural Analysis
Architectural analysis is concerned with the identification and resolution of the system's non-functional (for example, quality) requirements, in the context of the functional requirements In the UP, the term encompasses both architectural investigation (identification) and architectural design (resolution)
11
12
Glossary
Supplementary Specification
Object Oriented Analysis and Design
13
Architecture Mechanism
For those requirements with a significant architectural impact, analyze alternatives and create solutions that resolve the impact.
These are architectural decisions.
Object Oriented Analysis and Design
14
15
Quality Scenarios
When defining quality requirements during architectural factor analysis, quality scenarios are recommended,
as they define measurable (or at least observable) responses, and thus can be verified. It is not much use to vaguely state "the system will be easy to modify" without some measure of what that means. Quantifying some things, such as performance goals and mean time between failure, are well known practices, but quality scenarios extend this idea and encourages recording all (or at least, most) factors as measurable statements.
Quality scenarios are short statements of the form <stimulus> <measurable response>; for example:
When the completed sale is sent to the remote tax calculator to add the taxes, the result is returned within 2 seconds "most" of the time, measured in a production environment under "average" load conditions. When a bug report arrives from a NextGen beta test volunteer, reply with a phone call within 1 working day.
Object Oriented Analysis and Design
16
Factor Table
Most architectural methods advocate creating a table or tree with variations of the following information. The following style shown in Table is called a factor table,
which in the UP is part of the Supplementary Specification
17
18
19
architectural concerns involve system-level,large-scale, and broad problems whose resolution usually involves large-scale or fundamental design decisions
for example, the choice ofor even use ofan application server.
21
22
4.3 Identify Entity Domain Modeling Visualizing Concepts Adding Associations Adding Attributes Modeling Generalization Refining the Domain Model
23
VISUALIZING CONCEPTS
Domain Models Conceptual Class Identification Domain Modeling Guidelines Resolving Similar Conceptual Classes Modeling the Unreal world Specification Conceptual Classes UML Notation v.s. Methodology Lowering the Representational Gap Domain Models within the UP
24
Domain Models
A domain model is a representation of real-world conceptual classes
not a representation of software components. not a set of diagrams describing software classes, not software objects with responsibilities.
A domain model is a visual representation of conceptual classes or real-world objects in a domain of interest [MO95, Fowler96]
They have also been called conceptual models, domain object models, and analysis object models.
The UP defines a Domain Model as one of the artifacts that may be created in the Business Modeling discipline.
Object Oriented Analysis and Design
25
Domain Models
Using UML notation, a domain model is illustrated with a set of class diagrams in which no operations are defined. It may show:
domain objects or conceptual classes associations between conceptual classes attributes of conceptual classes
26
Domain Models
The domain model illustrates conceptual classes or vocabulary in the domain. Domain Models are not models of software components. The following elements are not suitable in a domain model:
Software artifacts, such as a window or a database, unless the domain being modeled is of software concepts, such as a model of graphical user interfaces. Responsibilities or methods.
27
Domain Models
The domain model illustrates conceptual classes or vocabulary in the domain. Informally, a conceptual class is an idea, thing, or object. More formally, a conceptual class may be considered in terms of its symbol, intension, and extension[MO95].
Symbolwords or images representing a conceptual class. Intensionthe definition of a conceptual class. Extensionthe set of examples to which the conceptual class applies.
28
Domain Models
Software problems can be complex;
Decomposition (divide-and-conquer) is a common strategy to deal with this complexity by division of the problem space into comprehensible units. In structured analysis, the dimension of decomposition is by processes or functions. However, in object-oriented analysis, the dimension of decomposition is fundamentally by things or entities in the domain.
A central distinction between object-oriented and structured analysis is: division by conceptual classes (objects) rather than division by functions. A primary analysis task is to identify different concepts in the problem domain and document the results in a domain model
Object Oriented Analysis and Design
29
Another excellent technique for domain modeling is the use of analysis patterns, which are existing partial domain models created by experts,
using published resources such as Analysis Patterns [Fowler96] and Data Model Patterns[Hay96].
30
a domain model may exclude conceptual classes in the problem domain not pertinent to the requirements.
For example, we may exclude Pen and PaperBag from our domain model (for the current set of requirements) since they do not have any obvious noteworthy role.
the domain model should exclude things not in the problem domain consideration. Object Orientedunder Analysis and Design 31
As another example, consider the domain of airline reservations. Should destination be an attribute of Flight, or a separate conceptual class Airport?
In the real world, a destination airport is not considered a number or textit is a massive thing that occupies space. Therefore, Airport should be a concept. Object Oriented Analysis and Design 32
As a rule of thumb, a domain model is not absolutely correct or wrong, but more or less useful; it is a tool of communication.
33
It is still possible to create a domain model in these domains, but it requires a high degree of abstraction and stepping back from familiar designs. For example, here are some candidate conceptual classes related to a telecommunication switch:
Message, Connection, Port, Dialog, Route, Protocol.
34
35
36
Specification perspective
the diagrams are interpreted as describing software abstractions or components with specifications and interfaces, but no commitment to a particular implementation (for example, not specifically a class in C# or Java).
Implementation perspective
the diagrams are interpreted as describing software implementations in a particular technology and language (such as Java).
Object Oriented Analysis and Design
37
In object design and programming it is common to create software classes whose names and information is inspired from the real world domain.
38
39
Consequently, the UP defines the Domain Model as the more commonly created subset artifact or specialization of the BOM.
40
41
Adding Association
Associations The UML Association Notation Finding Associations Association Guidelines Roles How Detailed Should Associations Be? Naming Associations Multiple Associations Between Two Types Associations and Implementation Example
42
Associations
An association is a relationship between types (or more specifically, instances of those types) that indicates some meaningful and interesting connection In the UML associations are defined as "the semantic relationship between two or more classifiers that involve connections among their instances. Criteria for Useful Associations
Associations for which knowledge of the relationship needs to be preserved for some duration ("need-to-know" associations). Associations derived from the Common Associations List.
43
44
Finding Associations
Start the addition of associations by
using the Common Associations List It contains common categories that are usually worth considering.
Here are some high-priority association categories that are invariably useful to include in a domain model:
A is a physical or logical part of B. A is physically or logically contained in/on B. A is recorded in B.
45
Association Guidelines
Focus on those associations for which knowledge of the relationship needs to be preserved for some duration ("need-to-know" associations). It is more important to identify conceptual classes than to identify associations. Too many associations tend to confuse a domain model rather than illuminate it. Their discovery can be time-consuming, with marginal benefit. Avoid showing redundant or derivable associations.
46
Roles
Each end of an association is called a role. Roles may optionally have:
name multiplicity expression navigability
47
Naming Associations
Name an association based on a TypeNameVerbPhrase-TypeName format where the verb phrase creates a sequence that is readable and meaningful in the model context.
48
49
50
Example
The following sample of associations is justified in terms of a need-to-know.
It is based on the use cases currently under consideration.
51
52
Example
53
Example
54
Adding Attributes
Attributes VS. Associations Non-primitive Data Type Classes No Attributes as Foreign Keys Modeling Attribute Quantities and Units
55
56
57
58
59
Modeling Generalization
New Concepts for the Domain Model Generalization Defining Conceptual Superclasses and Subclasses Abstract Conceptual Classes Modeling Changing States
60
61
62
63
64
All Payment subclasses must conform to having an amount and paying for a Sale. 100% Rule
The subclass must conform to 100% of the superclass's:
attributes associations
Object Oriented Analysis and Design
65
67
69
70
71
72
73
74
75
of X. Rather, either:
Define a state hierarchy and associate the states with X, or Ignore showing the states of a concept in the domain model; show the states in state diagrams instead..
76
77
Association Classes
78
Association Classes
domain model:
An attribute is related to an association.
Instances of the association class have a life-time dependency on the association. There is a many-to-many association between two concepts, and information associated with the association itself...
Object Oriented Analysis and Design
79
Aggregation
A special form of association that models a whole-part relationship between an aggregate (the whole) and its parts
Whole Part
Student
Schedule
Aggregation
80
Composition
A form of aggregation with strong ownership and coincident lifetimes
The parts cannot survive the whole/aggregate
Whole Part
Student
Composition
Schedule
81
82
Qualified Associations
A qualifier may be used in an association; it distinguishes the set of objects at the far end of the association based on the qualifier value. An association with a qualifier is a qualified association.
83
Reflexive Associations
A concept may have an association to itself; this is known as a reflexive association
84
85
86
87
88
89
90
91
Responsibilities
The UML defines a responsibility as "a contract or obligation of a classifier" A knowing or doing service or group of services provided by an element (such as a class or subsystem); A responsibility embodies one or more of the purposes or obligations of an element. A popular way of thinking about the design of software objects and also larger-scale components is in terms of responsibilities, roles, and collaborations.
92
Responsibilities
Doing responsibilities of an object include:
doing something itself, such as creating an object or doing a calculation initiating action in other objects controlling and coordinating activities in other objects
For example
"a Sale is responsible for creating SalesLineItems" (a doing), "a Sale is responsible for knowing its total" (a knowing).
93
In RDD, Responsibilities are related to the obligations or behavior of an object in terms of its role.
94
CRC cards
CRC stands for Class-ResponsibilityCollaborator. They look like:
Name
Collaborators Responsibilities
one per class, which shows its responsibilities and with which other class(es) it must collaborate in order to fulfill each responsibility. Write a brief description of the class on the back of the card.
CRC cards are useful in detecting responsibilities of objects (developed by Kent Beck and Ward Cunningham).
Object Oriented Analysis and Design
95
RESPONSIBILITIES Do something
96
GRASP : General Principles in Assigning Responsibilities Creator Information Expert Low Coupling Controller High Cohesion
97
GRASP - Creator
Problem:
Who creates an A?
Solution
Assign class B the responsibility to create an instance of class A if one of these is true (the more the better): B "contains" or compositely aggregates A. B records A. B closely uses A. B has the initializing data for A.
98
Solution
Assign a responsibility to the class that has the information needed to fulfill it.
99
Solution
Assign responsibilities so that (unnecessary) coupling remains low. Use this principle to evaluate alternatives.
100
GRASP - Controller
Problem:
What first object beyond the UI layer receives and coordinates ("controls") a system operation?
Solution
Assign the responsibility to an object representing one of these choices:
Represents the overall "system," a "root object," a device that the software is running within, or a major subsystem (these are all variations of a facade controller). Represents a use case scenario within which the system operation occurs (a use case or session controller)
101
Solution
Assign responsibilities so that cohesion remains high. Use this to evaluate alternatives.
102
103
104
105
information
boundary
Object Oriented Analysis and Design
106
entity
boundary
Object Oriented Analysis and Design
107
System boundary
<<control>>
System information
<<entity>>
108
Use Cases
Analysis Classes
Design Elements
Source Code
Exec
Use-Case Analysis
Object Oriented Analysis and Design
109
<<entity>>
<<entity>>
111
Student
RegisterForCoursesForm
CourseCatalogSystem
112
113
Use Case
Environment Independent
114
<<entity>>
<<entity>>
Use use-case flow of events as input Key abstractions of the use case Traditional, filtering nouns approach
Underline noun clauses in the use-case flow of events Remove redundant candidates Remove vague candidates Remove actors (out of scope) Remove implementation constructs Remove attributes (save for later) Remove operations
116
CourseOffering
Schedule
Student
117
Use Case
118
<<entity>>
<<entity>>
Student
RegistrationController
120
Student
RegisterForCoursesForm
CourseCatalogSystem
Student
Schedule
CourseOffering
Object Oriented Analysis and Design
RegistrationController
121
Use-Case Realization
A realization of a use case describes a collection of interacting objects which will support the functionality required by the use case
Use-Case Model Design Model
Use Case
Use-Case Realization
Sequence Diagrams
Collaboration Diagrams