CSC/ECE 517 Fall 2007/wiki3 8 ss

From Expertiza_Wiki
Jump to navigation Jump to search

Topic

O-o design guru Bob Martin has developed a set of design principles that relate to packages (one level above the class-oriented strategies we consider in this course). Report on the

   * Reuse/Release Equivalency principle,
   * Common Closure principle,
   * Common Reuse principle,
   * Acyclic Dependencies principle,
   * Stable Dependencies principle, and
   * Stable Abstraction principle

Find the best descriptions and examples of each that you can find on the Web.

Design principles related to Packages

Bob Martin

Reuse/Release Equivalency principle (REP)

The Reuse/Release Equivalency principle states that

    "The granule of reuse is the granule of release. Only components that are released through a tracking system can be effectively reused. This granule is the package."

According to this package is to be considered as the unit of distribution of software. When one wants to reuse components, package has to be the concrete unit that should be reused. The term package may also be interpreted as library, domain, functionality or a set of classes bound together.

An interesting argument can be that, why not use Classes as the unit of distribution? The reason is that quiet often by design, we end up with more than one class that communicate with each other. If individual classes are released, tracking version and compatibility can become very difficult. Hence, packages which are in the level next to classes, are the granular units of release and therfore reused even if classes can be the units of design.

The tracking system is important because the author owns the responsibility of upgrading the package that is being reused. Changes or enhancements in the package can be triggered by many factors, like new standards, new requirements, bugs or sometimes new methodologies and technologies. The author has to track the changes in the package along with maintaining its source code.

Example

Lets say one wants use a file operations library. The library itself is the unit of distribution and usage (referred to as the package), even if we use only one particular class for reading a file.

Common Closure principle

Example

Common Reuse principle

Example

Acyclic Dependencies principle

Example

Stable Dependencies principle

Example

Stable Abstraction principle

Example

References

Books

Links

See Also