object oreinted design
TRANSCRIPT
-
8/9/2019 object Oreinted Design
1/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 1
Object-Oriented Design
-
8/9/2019 object Oreinted Design
2/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 2
Outline
From Analysis toDesign
Design Issues
System Design
Object Design
Design patterns&
Conclusion
-
8/9/2019 object Oreinted Design
3/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 3
Object-Oriented Designx Transforms OOA model into blueprint for
software construction
x Builds upon four essential design concepts Abstraction
Information hiding
Functional independence
Modularity
-
8/9/2019 object Oreinted Design
4/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 4
Mapping OOA to OOD
-
8/9/2019 object Oreinted Design
5/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 5
Outline
From Analysis toDesign
Design Issues
System Design
Object Design
Design patterns&
Conclusion
-
8/9/2019 object Oreinted Design
6/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 6
Comparison of Conventional & OOD
x Representation of module hierarchiesx Specification of data definitionsx Specification of procedural logicx
Indication of end-to-end processing flowx Representation of object states and transitionsx Definition of classes and hierarchiesx Assignment of operations to classes
x Detailed definition of operationsx Specification of message connectionsx Identification of exclusive services
-
8/9/2019 object Oreinted Design
7/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 7
Design Issues for Modularity
x Decomposabilityx Composabilityx Understandability
x Continuityx Protection
x Linguistic modular units
x Few interfacesx Small interfaces (weak coupling)x Explicit interfacesx Information hiding (no global data)
-
8/9/2019 object Oreinted Design
8/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 8
OOD Methodologiesx The Booch Method
x
The Coad and Yourdon Methodx The Jacobson Method
x The Rumbaugh Method
x The Wirfs-Brock Method
-
8/9/2019 object Oreinted Design
9/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 9
Booch Methodx Architectural planning
Cluster similar objects in separate architectural
partitions. Layer objects by level of abstraction.
Identify relevant scenarios.
Create a design prototype. Validate the design prototype by applying it to
usage scenarios.
-
8/9/2019 object Oreinted Design
10/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 10
Booch Methodx Tactical design
Define domain-independent policies.
Define domain specific policies.
Develop a scenario that describes the semantics
of each policy.
Create a prototype of each policy. Instrument and refine the prototype.
Review each policy.
-
8/9/2019 object Oreinted Design
11/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 11
Booch Methodx Release planning
Organize scenarios developed during OOA by
priority. Allocate corresponding architectural releases to the
scenarios.
Design and construct each release incrementally.
Adjust goals and schedule of incremental release as
required.
-
8/9/2019 object Oreinted Design
12/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 12
The Rumbaugh OMT
x Perform system designx Conduct object designx
Implement Control mechanismsx Adjust class structure to strengthen inheritancex Design messaging to implement the object
relationships
x Package classes and associations into modules
-
8/9/2019 object Oreinted Design
13/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 13
OutlineFrom Analysis to
Design
Design Issues
System Design
Object Design
Design patterns&
Conclusion
-
8/9/2019 object Oreinted Design
14/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 14
OOD Process Flow
-
8/9/2019 object Oreinted Design
15/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 15
System Design
x Partition the analysis model into subsystems A subsystem is a package (collection) of classes
and associations, events and constraints that are
interrelated and have a small interface. Usually identified by the services it provides.
x Identify concurrenciesx Allocate subsystems to processors and tasksx Choose a basic strategy for data management
-
8/9/2019 object Oreinted Design
16/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 16
System Design
x Identify global resources and access control
mechanismsx Design control mechanism for systemx Determine how to handle boundary
conditions.x Review & modify if necessary
-
8/9/2019 object Oreinted Design
17/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 17
System Design
Partition the Analysis Modelx Small number of subsystems,
Partition subsystems to reduce complexity
x Well-defined interface, servicesx Intra- (use) and inter- (minimize)
communicationx
Achieve high Cohesion within a subsystemx Communication between subsystems: client/
server (one way) or peer-to-peer (two way)
-
8/9/2019 object Oreinted Design
18/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 18
Communication Models
-
8/9/2019 object Oreinted Design
19/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 19
System Design
Cohesion
Goingtow
ards
Hi
ghCoh
esio
n
x Coincidental
x Logical
x Temporal
x Communication
x Sequential
x Functional
x Data
-
8/9/2019 object Oreinted Design
20/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 20
System Design
Concurrency and subsystem Allocationx Identify active objects (threads of control)x Where to allocate subsystems
same processor? -- need concurrency control independent processor ? -- may still need
concurrency control
x Allocation and design issues:
performance requirements. costs
overheads and efficiency
-
8/9/2019 object Oreinted Design
21/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 21
Concurrency Example
Database
DB access
DB access
-
8/9/2019 object Oreinted Design
22/39Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 22
Concurrency
x Ada -- Use tasks
task type DB_access is end;
type dba is access DB_access;
a, b: dba;
a := new DB_access;
b:= new DB_access;
-
8/9/2019 object Oreinted Design
23/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 23
Concurrency
x Java -- Use threads
class dbAccess extends thread{
public void run () { }
new dbAccess.start();
new dbAccess.start();
}
-
8/9/2019 object Oreinted Design
24/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 24
Some Concurrency Issues
x Mutual exclusion of shared objects
Two objects should not be able to write to the same
shared object at the same time.
x Communication
Allow messages to be sent between objects. When
is an object ready to receive a message?
x Synchronization Ensure that two or more objects are at known
points at the same time.
-
8/9/2019 object Oreinted Design
25/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 25
Data Managementx Generally refers to shared objectsx Concurrency controls essentialx
Often refers to data to have a permanencebeyond scope of program
x Issues Infrastructure for access and storage
Management of datax Often look for interfaces to existing support
subsystems
-
8/9/2019 object Oreinted Design
26/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 26
System design
Resource Managementx Resources: External entities vs. abstractions
E.g., disk, processor, comm line
Databases, objects, interfacesx Guardian object:
Keeper of the resource
Controlling access to the resource Moderating conflicts for requests
x Language support can vary widely
-
8/9/2019 object Oreinted Design
27/39
-
8/9/2019 object Oreinted Design
28/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 28
Intersubsystem Communicationx Create a table for each contract
-
8/9/2019 object Oreinted Design
29/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 29
Subsystem Collaboration Graphx List each request made by a collaborator
-
8/9/2019 object Oreinted Design
30/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 30
Outline
From Analysis toDesign
Design Issues
System Design
Object Design
Design patterns&
Conclusion
-
8/9/2019 object Oreinted Design
31/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 31
Object Design
-
8/9/2019 object Oreinted Design
32/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 32
Key Object Characteristics
(Available from Analysis)x Object name (or name of class of objects)x Descriptionx
Services provided or functionsx How createdx How invokedx Shared resources
x Communication With whom?
Interfaces
-
8/9/2019 object Oreinted Design
33/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 33
Object Design
Object Internalsx Protocol description
List each message type the object can receive, e.g.,
MESS(motion sensor): read RET id, statusx Implementation description
Spec. of objects name and reference to class
Spec. of private data encapsulated Procedural description of each operation
Specification of control structures
-
8/9/2019 object Oreinted Design
34/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 34
Use a PDL to Describe Object
PACKAGEprogram_component_nameIS
type specification of data objects
Proc specifications of related operationsPRIVATE
data structure details for object types
PACKAGE BODYprogram_component_nameIS
PROC operation: (interface specification) IS
PROC operation: (interface specification) IS
END program_component_name
-
8/9/2019 object Oreinted Design
35/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 35
High Level Sensor PDL
PACKAGE sensor ISTYPE sensor_status IS (ON | OFF)TYPE sensor_id, alarm_charPROC read, set, test
PRIVATEsensor_id, IS STRING LENGTH (8)alarm_char DEFINEDthreshold, sig_type, sig_level IS INTEGER
PACKAGE BODY sensor ISTYPE update_rate IS INTEGERPROC read (sensor_id, sensor_status: OUT)...
-
8/9/2019 object Oreinted Design
36/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 36
Object Design
Steps done in object design
x Detail object attributes and operations
x Review object-relationship model
x Describe operations and transitions usingPDLs.
-
8/9/2019 object Oreinted Design
37/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 37
Outline
From Analysis toDesign
Design Issues
System Design
Object Design
Design patterns&
Conclusion
-
8/9/2019 object Oreinted Design
38/39
Chapter 21 -- Assistance -- Magy Seif El-NasrFebruary 1, 1998 R. A. Volz 38
Design Patterns
x An abstraction that conveys meaning about a classsapplicability.
xpattern template Name : (applicability and intent)
Problem description: (env. and conditions) Characteristics
Consequences
xNaming -- choose to aid searchx Two different mechanisms
is-a (inheritance) -- a basis for new subclasses has-a (composition) - ensemble
-
8/9/2019 object Oreinted Design
39/39
What next ?
x From Design to implementationx Success of complex projects relies more on the
design architecture rather than the
implementation. So SW Eng. stresses OOA andOOD
x If you have a good and complete design,
implementation should be straightforwardxNevertheless, language choice does have an
influence.