CSC/ECE 517 Fall 2011/ch4 5a sp: Difference between revisions
Line 15: | Line 15: | ||
The five basic concepts of object-oriented design are the implementation level features that are built into the programming language. These features are often referred to by these common names: | The five basic concepts of object-oriented design are the implementation level features that are built into the programming language. These features are often referred to by these common names: | ||
*[http://en.wikipedia.org/wiki/Object_(computer_science) Object]: A tight coupling or association of data structures with the methods or functions that act on the data. | *[http://en.wikipedia.org/wiki/Object_(computer_science) 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. | ||
*[http://en.wikipedia.org/wiki/Information_hiding Information Hiding/Encapsulation]: The ability to protect some components of the object from external entities. This is | *[http://en.wikipedia.org/wiki/Information_hiding 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''. | ||
*[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance]: | *[http://en.wikipedia.org/wiki/Inheritance_(computer_science) 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. | ||
*[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming 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''. | *[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming 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''. |
Revision as of 13:43, 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. These features are often referred to by these common names:
- 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: The ability to defer the implementation of a method. The ability 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.
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 />