Você está na página 1de 14

Object design

• Object design emphasis towards computer concepts

• Execution time, memory, cost should be minimum

• Implementation using algorithms in a decomposed


manner

• Class, attributes, associations are implemented as data


structures.

• New object class can use to store intermediate results


and avoids re-computation.
Steps of object design
• Combining the three models
• Design algorithms
• Design optimization
• Implementation of control
• Adjustment of inheritance
• Design of association
• Object representation
• Physical packaging
Combining three models

• Converting the actions and activities of dynamic


model & processes of functional model into
operations attached to classes in object model

• Logical structure of analysis model is converted


to physical organization of a program
Designing algorithms
• Each operation in functional model must be
formulated as algorithms
• Algorithm subdivided into calls and to the lowest
level
• Algorithm design steps
– Choose algorithm that minimize the cost
– Select appropriate data structure
– Define new internal classes & operations
– Assign responsibility for operations
Choosing algorithms :-
• Simple operations does not need algorithms

• Non trivial algorithms are needed for


– Implement functions for which no procedural
specification is given
– To optimize functions which use inefficient
algorithm
Considerations in choosing alternate algorithms
– Computational complexity

– Ease of implementation and understandability

– Flexibility

Choosing data structures


• Choose appropriate data structure, that will permit
efficient algorithm
Defining internal classes and operations
• During expansion of algorithms new classes are
needed to hold intermediate results
• High level operations are decomposed into low level
Design optimization

• Design model uses analysis model as the


framework for implementation
• Optimization is for efficient implementation
• Steps :-
– Adding redundant association for efficient access
– Rearrange the computation for greater efficiency
• Eliminate dead paths
– Saving derived attribute to avoid re-computation
Adjustment of inheritance
• Classes and operations can be adjusted to increase the amount
of inheritance
• Steps
– Rearranging classes and operations
– Abstracting out common behavior
Rearranging classes and operations
– Rearrange the same classes and operations to a common
ancestor if they use in different places
– Adjustments for increasing inheritance
• Some operations have fewer arguments than others. Missing
arguments can be added.
• Some operations have fewer arguments becoz they are special
cases
• Give same name to similar attributes, move them to common class
Abstracting out common behavior
• Examine the object model to find
commonality between classes

• When common behavior has been recognized,


a common superclass can be created that
implements the shared features, leave
specialized features in the subclasses.
Design of association
• During object design we should create a strategy for
implementing the association
Analyzing association traversal
– Analyze traversing direction of association
One way association
– If an association traverse in one direction, it may be
implemented as a pointer
– If multiplicity is one, then it is a single pointer. Otherwise it
is a set of pointers
Two way associations
There are three approaches
1. Implement as pointers in one direction and perform
a search when a backward traversal is required
2. Implement as pointers in both directions
3. Implement as a distinct association object
Object representation

Você também pode gostar