Encourages loose coupling and makes testing easier. Using interfaces is key so that things can be easily swapped out.
Object Design
Strive for loose coupling and tight cohesion. Relying on another object's behavior is coupling. If an object is cohesive, then its public methods touch much of its state. If subsets of methods only touch a subset of state, then maybe another object is hiding inside and the object is not considered cohesive. Coupling affects adaption more than cohesion. Try to avoid APIs that require too much external context -- accept the minimum information required to get the job done and the object is more likely to be adaptable in the future.
XP Coding Practices
- refactoring
- unit testing
Database schemas will change. How can you make those changes as painlessly as possible? Consider having a table the indicates the current revision of the schema and have the system check that revision at startup to make sure both the object side and the data side of the house are in agreement. Fail Fast and refuse to startup if they don't. Bump up the revision number if the schema itself did not change but the interpretation of the data did.
No comments:
Post a Comment