How do you find your classes?
January 15, 2009 · 2 Comments
Thinking in objects can be really hard and one of the biggest stumbling blocks for many who are new to OO design is identifying what are the right things in the problem domain to model as classes. This topic came up in a recent thread on the excellent cfcdev mailing list and Alan Livie shared his recommendation for Robert C. Martin's book "Agile Principles, Patterns, and Practices in C#". In particular, he pointed list members to chapter 20 which discusses the design of objects to represent a coffee maker. That particular chapter is available as a PDF and it's a really good read. It starts off explaining the problem to be solved and then presents the "obvious" object model that most new OO students come up with. Then he takes it apart, explaining why it's a poor design, and goes on to construct a much better model (with fewer objects) that is very elegant and easy to understand. If you're struggling with the OO design process, you need to read this PDF and absorb the lessons laid out within it. Even if you think you're an OO 'guru' you'll probably learn something from it!