Designing object-oriented systems by starting with messages rather than classes leads to cleaner, more maintainable code. Using a hotel booking platform as a running example, the post demonstrates how identifying required messages first causes well-structured classes to emerge naturally. Key topics include using sequence diagrams as a design discovery tool, the 'ask what not how' principle, context independence, the Law of Demeter, and concrete decoupling techniques in Ruby: dependency injection, isolating unavoidable dependencies, keyword arguments, and depending on stable abstractions over volatile concretions.
Table of contents
The Problem with Thinking in Classes FirstDesigning from Messages, Not from ClassesSequence Diagrams: Thinking with ArrowsAsk for What You Want, Not How to Do ItContext Independence: Trust Instead of ControlPublic and Private InterfacesThe Law of DemeterConcrete Decoupling TechniquesPutting It All TogetherConclusionSort: