Chapter 20

 < Day Day Up > 



Chapter 19

  1. List and describe the preferred characteristics of an object-oriented architecture.

    Easy to understand - Programmers can get their heads around the design with minimal effort

    Easy to reason about - It's easy to predict the effects of change

    Easy to extend - It's obvious how the make enhancements to the system.

  2. State the definition of the Liskov substitution principle.

    Subtype objects must be behaviorally substitutable for supertype objects. Programmers must be able to reason correctly about and rely upon the behavior of subtypes using only the supertype behavior specification.

  3. Define the term class invariant.

    A condition associated with a particular class or structure property that must always hold true in all valid object states.

  4. What is the purpose of a function precondition?

    A function precondition must hold true before the function can be guaranteed to work properly.

  5. What is the purpose of a function postcondition?

    A function postcondition must preserve the class invariant.

  6. List and describe the three rules of the substitution principle.

    Signature rule - a subtype must support all functions published by the supertype

    Methods rule - calls to overriding functions should behave like the base class functions they override.

    Properties rule - Subclasses must preserve any properties that are provable about the base class

  7. Write the definition and goals of the open-closed principle.

    Software modules must be designed and implemented in a manner that opens them for extension but closes them for modification.

  8. Explain how the open-closed principle uses the Liskov substitution principle and Meyer design by contract programming to achieve its goals.

    Code written with the OCP in mind depends upon behavior promised by abstract base class specification. Depending upon promised behavior enables the subtype reasoning process. The LSP/DbC is used to achieve the proper subtype behavior within a type hierarchy thereby enabling the OCP

  9. Write the definition and goals of the dependency inversion principle.

    A. High-level modules should not depend upon low-level modules. Both should depend upon abstractions.

    B. Abstractions should not depend upon details. Details should depend upon abstractions.

  10. Explain how the dependency inversion principle builds upon the open-closed principle and the Liskov substitution principle/Meyer design by contract programming.

    The OCP and the LSP/DbC, when applied together, result in the realization of a third design principle known as the Dependency Inversion Principle (DIP). The key to the DIP is that high- level software modules should not rely on low-level details, and that software modules at all hierarchy levels should rely only upon abstractions. When a software architecture achieves the goals of the DIP it is easier to extend and maintain (flexible and non-rigid). Software modules that conform to the DIP are easier to reuse in other contexts (mobile)



 < Day Day Up > 



C++ for Artists. The Art, Philosophy, and Science of Object-Oriented Programming
C++ For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504028
EAN: 2147483647
Year: 2003
Pages: 340
Authors: Rick Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net