CSC/ECE 517 Fall 2011/ch4 5a sp

From Expertiza_Wiki
Jump to navigation Jump to search

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/Class: A tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is created based on a class). Each object serves a separate function. It is defined by its properties, what it is and what it can do. An object can be part of a class, which is a set of objects that are similar.
  • Information hiding: The ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.
  • Inheritance: The ability for a class to extend or override functionality of another class. The so-called subclass has a whole section that is derived (inherited) from the superclass and then it has its own set of functions and data.
  • Interface: The ability to defer the implementation of a method. The ability to define the functions or methods signatures without implementing them.
  • 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.

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:

  1. The class name
  2. Its Super and Sub classes (if applicable)
  3. The responsibilities of the class.
  4. The names of other classes with which the class will collaborate to fulfill its responsibilities.
  5. Author

Example 1: Flight reservation system

Example 2: Address Book

Example 3: Course Registration

Example 4: Other Example

Conclusion

References

<references />