SDSU CS 535 Object-Oriented Programming & Design
Spring Semester, 1999
Heuristics 4
Previous    Lecture Notes Index    Next    
© 1999, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 23-Mar-99

Contents of Doc 14, Heuristics 4


Reference

Object-Oriented Design Heuristics , Riel, Addison-Wesley, 1996, Heuristics 2.11, 4.9, 4.10, 4.11, 4.12

Doc 14, Heuristics 4 Slide # 2
Classes verses Objects

2.11 Be sure that the abstractions that you model are classes and not simply the roles that object play


Doc 14, Heuristics 4 Slide # 3
Constraints
4.9 When implementing semantic constraints, it is best to implement them in terms of class definition.

Often class definition based constraints will lead to a proliferation of classes.

In this case the constraint must be implemented in the behavior of the class.

This is often done in the constructor.

4.10 When implementing semantic constraints in a constructor, place the constraint test in the constructor as far down as a containment hierarchy as the domain allows.

4.11 The semantic information on which a constraint is based is best placed in a central, third party object when that information is volatile.

4.12 The semantic information on which a constraint is based is best placed in the classes involved in the constraint when that information is stable.

Copyright ©, All rights reserved.
1999 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.

Previous    visitors since 23-Mar-99    Next