Coupling • Limit Use of Globals and Singletons • Small Interfaces with Simple Signatures • Prefer Composition over Inheritance Wednesday, August 15, 12
one conceptual “responsibility” • Classes should be small and focused • The less an object does, the easier it is to change (or remove) Wednesday, August 15, 12
• Algorithms should be thought about and broken down into steps • Steps should be given names • Individual steps can be ‘stubbed’ in tests • Steps can be reused from different algorithms Wednesday, August 15, 12
logic from AR • Move into application-specific business logic objects • Detach from AR concerns such as callbacks, validations, etc. Wednesday, August 15, 12
algorithms into “Strategy” classes • Calculations can be performed in one way initially, but new “strategies” can be plugged in should requirements change Wednesday, August 15, 12
dependencies into object, through constructor or setter method • Implementations can be changed at runtime • Tests can stub out heavyweight implementations Wednesday, August 15, 12