cppclass_oop - the contained objects The containment...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Object Oriented Theory Design Heuristics Some rules for good class design. You should be aware that they exist, but you won't be tested on them in this course. 1. All data should be hidden within its class. 2. Keep related data and behavior in one place ( cohesion ). 3. Always declare accessors as const. 4. Model the real world whenever possible. 5. Eliminate classes that are outside the system. 6. Avoid all-powerful (omnipotent) classes. 7. Distribute system intelligences among the classes as evenly as possible. The top-level classes in a design should share the work uniformly. 8. Miminize the number of messages between a class and its helper. 9. If a class contains objects of another class, then the containing class should be sending messages to
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: the contained objects. The containment relationship should always imply a "uses" relationship. 10.A class much know what it contains, but it should not know who contains it. 11.Objects that share lexical scope - those contained within the same containing class - should not have a uses relationship between them. (Mercer, 216-19, 440-43, 453-57, 510) Some More Key Terms of Object-Oriented Programming • Object-Based Programming (OBP): • Object-Oriented Programming (OOP): • Inheritance • Polymorphism • Dynamic Binding Works Cited • Headington, Mark A. and David Riley. Data Abstraction and Structures using C++ . Lexington, MA: Heath, 1994. • Mercer, Rick. Computing Fundamentals with C++ . Wilsonville, OR: Franklin, 1999....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online