Presentation is loading. Please wait.

Presentation is loading. Please wait.

Www.techstudent.co.cc Class Design. www.techstudent.co.cc Class Design The analysis phase determines what the implementation must do, and the system design.

Similar presentations


Presentation on theme: "Www.techstudent.co.cc Class Design. www.techstudent.co.cc Class Design The analysis phase determines what the implementation must do, and the system design."— Presentation transcript:

1 www.techstudent.co.cc Class Design

2 www.techstudent.co.cc 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 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. 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 www.techstudent.co.cc 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. 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 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 www.techstudent.co.cc Class Design

5 www.techstudent.co.cc Class Design Realizing Use Cases 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. 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 www.techstudent.co.cc Class Design Choosing Algorithms that minimize the cost of implementing operations Choosing Algorithms that minimize the cost of implementing operations Computational ComplexityComputational Complexity Ease of implementation and understandabilityEase of implementation and understandability FlexibilityFlexibility Select Data Structures appropriate to each algorithms Select Data Structures appropriate to each algorithms Define new internal classes and operations necessary 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 Assign Operations to appropriate classes

7 www.techstudent.co.cc Class Design Recursing Downward 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 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. 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 www.techstudent.co.cc Class Design Refactoring 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 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 pathsProvide efficient access paths Rearrange the computation for greater efficiencyRearrange the computation for greater efficiency Save intermediate results to avoid recomputationsSave intermediate results to avoid recomputations

9 www.techstudent.co.cc Class Design Reification of Behavior Reification of Behavior It is the promotion of something that is not an object into an object. Adjustment of Inheritance 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 inheritanceRearrange classes and operations to increase inheritance Abstract common behavior out of groups of classesAbstract common behavior out of groups of classes Use delegation to share behavior when inheritance is semantically invalid.Use delegation to share behavior when inheritance is semantically invalid.

10 www.techstudent.co.cc Class Design Organizing a 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 viewHide Internal information from outside view Limit the scope of class-model traversals Limit the scope of class-model traversals Do not directly access foreign attributes Do not directly access foreign attributes Define interfaces at a high level of abstraction Define interfaces at a high level of abstraction Hide external objects Hide external objects avoid cascading method calls avoid cascading method calls Maintain coherence of entitiesMaintain coherence of entities Fine-tune definition of packagesFine-tune definition of packages

11 www.techstudent.co.cc 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. 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 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. First two are motivated by the theory transformations. A transformation is a mapping from domain of models to the range of models.

12 www.techstudent.co.cc Implementation Modeling Fine-tuning Classes 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 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 www.techstudent.co.cc Implementation Modeling Realizing Associations 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 www.techstudent.co.cc Implementation Modeling Testing 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 www.techstudent.co.cc


Download ppt "Www.techstudent.co.cc Class Design. www.techstudent.co.cc Class Design The analysis phase determines what the implementation must do, and the system design."

Similar presentations


Ads by Google