Changing requirements
Feature requests
On-going improvements
Bug fixes
Object systems know too much about each other
Changes in one object forces change in another
in turn forces change in it’s collaborators
Objects expect a tightly knit, arranged world
They resist being used in different contexts
They are painful to test
Duplication then appears to be an
escape hatch in the face of inflexibilityTechniques to manage dependencies
The art of organizing and arranging code
Does not predict the future; it preserves your options for accommodating the future
Objects have behavior, and may contain data.
Objects control access to their data.
Objects invoke each others behavior by passing messages
The foundation of OOD
Define the interactions between objects
Most visible structures of OOP
When you make a class, you are making the box it will eventually be hard to think outside of
Define a framework and language we use to reason about our code forever
No unexpected side-effects
Existing code is simple to reuse
The easiest way to make a change, is to add code that is itself simple to change.
T ransparent: There are obvious consequences of change, in code that changes and code that relies on it.
R easonable: The cost of changing code is proportional to the benefit the change achieves.
U sable: Existing code can be reused in new and unexpected contexts.
E xemplary: The code itself should encourage those who change it to perpetuate these qualities.
Please Mr. Gear, what is your ratio? (makes sense)
Please Mr. Gear, what are your gear inches? (a little shaky, depends on wheel, tires)
Please Mr. Gear, what is your tire size? (nonsense)
Please Mr. Gear, what is your wheel size? (nonsense)
Reusable classes are pluggable units of well-defined behavior that have few entanglements.
Hard to reuse classes have many entanglements.
You increase your applications chance of breaking unexpectedly if you depend on classes that do too much.
If being attached to an instance variable is bad, depending on a complicated data structure is worse.