Class Design - PowerPoint PPT Presentation

About This Presentation
Title:

Class Design

Description:

Title: Class Design Last modified by: Dilu Created Date: 10/24/2002 2:32:14 PM Document presentation format: On-screen Show Company: www.techstudent.co.cc – PowerPoint PPT presentation

Number of Views:154
Avg rating:3.0/5.0
Slides: 16
Provided by: synt75
Category:

less

Transcript and Presenter's Notes

Title: Class Design


1
Class Design
2
Class Design
  • The analysis phase determines what the
    implementation must do, and the system design
    phase determines the plan of attack. The purpose
    of class design is to complete the definitions of
    the classes and associations and choose
    algorithms for operations.
  • The analysis model describes the information that
    the system must contain and the high-level
    operations that it mush perform. During design,
    you choose among different ways to realize the
    analysis classes with an eye toward minimizing
    execution time, memory, and other cost measures.
    In particular, you must flesh out operations
    choosing algorithms and breaking complex
    operations into simpler operations.

3
Class Design
  • OO design is an iterative process. When you think
    that the class design is complete at one level of
    abstraction, you should consider the next lower
    level of abstraction. For each level you need to
    add new operations, attributes and classes.
    Class design involves the following steps.
  • Bridging the Gap
  • How to allocate available resources to the
    desired features. Your job is to build a bridge
    across the GAP. You must invent some intermediate
    elements to bridge the gap (operations, classes
    or other UML constructs). Inventing good
    intermediate elements is the essence of
    successful design.

4
Class Design
5
Class Design
  • Realizing Use Cases
  • During class design we elaborate the complex
    operations, most of which come from use cases.
    Use cases define system-level behavior. During
    design you must invent new operations and new
    objects that provide this behavior.
  • Designing Algorithms.
  • Formulate algorithm for each operations. The
    analysis specification tells what the operation
    does for its clients.
  • Steps to design algorithms are as follows.

6
Class Design
  • Choosing Algorithms that minimize the cost of
    implementing operations
  • Computational Complexity
  • Ease of implementation and understandability
  • Flexibility
  • Select Data Structures appropriate to each
    algorithms
  • Define new internal classes and operations
    necessary
  • Decomposition of high-level operations. Usually
    you need to add internal operations as you expand
    high-level operations.
  • Assign Operations to appropriate classes

7
Class Design
  • Recursing Downward
  • Organize operations as layers. Operations in
    the higher layers invoke operations in lower
    layers. The design process generally works
    top-down. Download recursion proceeds in tow
    ways
  • Functionality Layers.
  • Functionality recursion means that you take the
    required high-level functionality and break it
    into lesser operations. This is a natural way to
    proceed.
  • Mechanism Layers.
  • This means you build the system out of layers
    of need support mechanisms. In providing
    functionality, you need various mechanisms to
    store information, sequence control, coordinate
    objects, transmit information, etc.

8
Class Design
  • Refactoring
  • The changes to the internal structure of the
    software to improve its design without altering
    its external functionality. It may seem like a
    waste of time, but it is essential to main a
    design.
  • Design Optimization
  • A good way to design the system is to get the
    logic and then optimize it. It is difficult to
    optimize a design at the same time you create it.
    Design optimization involves the following
    paths.
  • Provide efficient access paths
  • Rearrange the computation for greater efficiency
  • Save intermediate results to avoid recomputations

9
Class Design
  • Reification of Behavior
  • It is the promotion of something that is not an
    object into an object.
  • Adjustment of Inheritance
  • As class design progresses, you can often
    adjust the definitions of classes and operations
    to increase inheritance by performing the
    following steps.
  • Rearrange classes and operations to increase
    inheritance
  • Abstract common behavior out of groups of classes
  • Use delegation to share behavior when inheritance
    is semantically invalid.

10
Class Design
  • Organizing a Class Design
  • It is possible to improve the organization of a
    class design with the following steps.
  • Hide Internal information from outside view
  • Limit the scope of class-model traversals
  • Do not directly access foreign attributes
  • Define interfaces at a high level of abstraction
  • Hide external objects
  • avoid cascading method calls
  • Maintain coherence of entities
  • Fine-tune definition of packages

11
Implementation Modeling
  • Implementation is the final development stage
    that addresses the specifics of programming
    languages. Implementation should be
    straightforward and almost mechanical, because
    you should made all the decisions during design.
  • First you should address implementation issues
    called implementation modeling, which involves
    fine-tune classes, fine-tune associations,
    realize associations and prepare for testing.
  • First two are motivated by the theory
    transformations. A transformation is a mapping
    from domain of models to the range of models.

12
Implementation Modeling
  • Fine-tuning Classes
  • Sometimes it is helpful to fine-tune classes
    before writing code in order to simplify
    development or to improve performance. The
    purpose of implementation is to realize the
    models from analysis and design. Do not alter
    design model unless there is a compelling reason.
    If there is, consider the following
    possibilities. Partition a class, Merge classes,
    Partition/Merge attributes or Promote an
    attribute/demote a class.
  • Fine-tuning Generalizations
  • As you can reconsider classes, so too you can
    reconsider generalizations. Sometimes it is
    helpful to remove a generalization or to add one
    prior to coding.

13
Implementation Modeling
  • Realizing Associations
  • Associations are the glue of the class model,
    providing access paths between objects. Now we
    must formulate a strategy for implementing them.
    Either we can choose a global strategy for
    implementing all associations uniform, or we can
    select a particular technique for each
    associations, taking into account the way the
    application will use it. We to consider
    association classes, ordered associations,
    sequences, bags, qualified associations,
    aggregation and composition

14
Implementation Modeling
  • Testing
  • Testing is a quality assurance mechanism for
    catching residual errors. It provides an
    independent measure of the quality of your
    software. Testing should progress from small
    pieces to ultimately the entire application.
    Developers should begin by testing their own
    code, their classes and methods (Unit testing).
    Testing the fitness of classes and methods
    together (Integration testing). The final step is
    system testing, where you check the entire
    application.

15
Thank you....!!!
Write a Comment
User Comments (0)
About PowerShow.com