CSC/ECE 517 Fall 2011/ch4 5a sp: Difference between revisions
Line 50: | Line 50: | ||
* Defining objects, creating [http://en.wikipedia.org/wiki/Class_diagram class diagram] from conceptual models and map the entities to classes. | * Defining objects, creating [http://en.wikipedia.org/wiki/Class_diagram class diagram] from conceptual models and map the entities to classes. | ||
* Use [http://en.wikipedia.org/wiki/Design_pattern_(computer_science) design patterns] <ref name="Design Patterns">[http://www.uml.org.cn/c++/pdf/DesignPatterns.pdf Design Patterns Elements of Reusable Object Oriented Software by Erich Gamma], Design Patterns | * Use [http://en.wikipedia.org/wiki/Design_pattern_(computer_science) design patterns] <ref name="Design Patterns">[http://www.uml.org.cn/c++/pdf/DesignPatterns.pdf Design Patterns Elements of Reusable Object Oriented Software by Erich Gamma], Design Patterns</ref> | ||
= OOD: The CRC Method = | = OOD: The CRC Method = |
Revision as of 14:10, 30 October 2011
Introduction to Object Oriented Design(OOD)
This page serves as a knowledge source for understanding the concepts covered in Lecture14- Introduction to Object Oriented Design(OOD).
Overview
Lecture 14 <ref name="CSC517">OOD, CSC 517 Lecture14</ref> of CSC 517 covered various aspects of the object oriented design including the basics of OOD principles along with the design criteria and the Class Responsibility Collaboration card tool.
Object-oriented design can be defined as the process of planning a 'system of interacting objects' for the purpose of solving a software problem. It is one approach to software design.
Need for Design
Basic Object Oriented Concepts
The five basic concepts of object-oriented design are the implementation level features that are built into the programming language. They can be considered as the general vocabulary required to implement an object oriented design solution <ref name="OOD vocabulary">OOD Vocabulary, OOD Vocabulary</ref>. These terms are explained in brief:
- Object: A class is a tight coupling or association of data structures with the methods or functions that act on the data. An object is an instance of the class serving a separate function. An object is defined by its properties.
- Information Hiding/Encapsulation: The ability to protect some components of the object from external entities i.e. protecting parts of the program from extensive modification if the design decision is changed. This is achieved by language keywords to enable a variable to be declared as private or protected to the owning class.
- Inheritance: inheritance is a way to reuse code of existing objects and thus ability for a class to extend or override functionality of another class. Inheritance is realized by establishing a subtype from an existing object, or both, depending upon programming language support.
- Polymorphism: The ability to replace an object with its subobjects. The ability of an object-variable to contain, not only that object, but also all of its subobjects.
- Interface: Interface can be defined as the ability to defer the implementation of a method or the process to define the functions or methods signatures without implementing them.
Criteria for Elegant Software Design
Listed below are the different criteria for elegant software design. There are nine different design considerations, out of which the first five address correctness of the software and the rest consider the performance.
Usability: Usability can be measured by the ease of use for the client.
Completeness: A software program/application is complete if it solves all the client needs.
Robustness: A good design is one that can deal with unusual situations gracefully and avoid crashing.
Efficiency: The application performs the necessary computations in a reasonable amount of time.
Scalability: An application is scalable if it performs correctly and efficiently when the problems grow in size by several orders of magnitude.
Readability: If it is easy for another programmer to read and understand the design and code, the design is readable.
Modifiability: If the software can easily be enhanced or restricted by adding new features or removing old features without breaking existing code, the design is modifiable.
Reusability: Resuability checks the ability to be reused in another completely different setting.
Simplicity: The simplicity criteria check if the design and/or the implementation unnecessarily complex.
Design Concepts
Listed below are the major components for building a design solution for a problem:
- Defining objects, creating class diagram from conceptual models and map the entities to classes.
- Use design patterns <ref name="Design Patterns">Design Patterns Elements of Reusable Object Oriented Software by Erich Gamma, Design Patterns</ref>
OOD: The CRC Method
Class-Responsibility-Collaboration card is a very useful tool for software design that determine the classes needed along with the types of interactions.
CRC cards are created from index cards on which are written:
- The class name
- Its Super and Sub classes (if applicable)
- The responsibilities of the class.
- The names of other classes with which the class will collaborate to fulfill its responsibilities.
- Author
Example 1: Flight reservation system
Example 2: Address Book
Example 3: Course Registration
Example 4: Other Example
Conclusion
References
<references />