Important things to remember:
Good programs are
Flexible
Robust
Extensible
Easy to understand
Easy to maintain
An object oriented program is a collection of interacting objects.
Good OO programs are characterized by
Encapsulation
information hiding
modular design
Reliance on public method contracts not internal implementation
Loose coupling between objects.
High levels of abstraction -- polymorphic behavior
A program starts by creating one object whose job it is to create all objects that are initially needed.
Objects can create other objects.
Objects can be disposed and cease to exist.
Objects do not need names to function.
Objects should only know the minimum of what they need to know and should do only the minimum of what they need to do.
This is called "loose coupling". Don't make "god objects".
Objects should expose the minimum information and methods needed by the rest of the program. This is another aspect of loose coupling.
When using an object, do not concern yourself with how its methods are implemented, only on what that class defines as the function of that method. Thus a method involves more than just code, but also a "contract" with the rest of the program.
No comments:
Post a Comment