Domain Driven Design – Chapters 7 to 9 – Refactoring and other things
October 10, 2006
Discussion: People who talk about XP often make re-factoring sound magical. Evans makes it sound like hard work, and, though necessary, not sufficient. What are some things he talks about in these chapters that you need in addition to re-factoring to come up with a great model?
Introduction:
As with most things, models are meant improve (mature) over time. These chapters discuss various ways in which this can happen or be achieved. Lots of these methods are eventually implemented by re-factoring the already existing model. The author (rightly) does not present re-factoring as a silver bullet that will solve all the problems with a model. Instead it is presented as a tool that needs to be used to implement necessary changes that are recognised through the various strategies discussed in these chapters. Depending on the situation, re-factoring can be hard or easy.
Breakthroughs and Deeper Models:
During the lifetime of most projects, if there is a constant effort to improve the model, there will be a time when a major breakthrough presents itself in terms of an opportunity to deepen the model and achieve a multitude of improvements that solve many problems. To demonstrate this, the author presents an excellent example of a breakthrough in one of the projects that he worked on. To improve the chances of achieving such a break through, the project members should focus on the basics like knowledge crunching and developing a robust UBIQUITOUS LANGUAGE and they should not shy away from making modest, piecemeal improvements to the model, because they will eventually lead to a breakthrough. When the opportunity for a breakthrough presents itself, it can sometimes seem daunting and risky due to the size of the changes required, but at the same time, it also presents an opportunity for significant improvements and future benefits in terms of modifiability and maintainability of the model.
Towards Deeper Models:
After illustrating what it means to make a model deeper and the benefits that can be obtained by having a deeper model, the author presents some techniques that can used to create a deeper model. These techniques are divided into two categories as follows:
Digging Out Concepts:
- Listen to Language
- Scrutinize Awkwardness
- Contemplate Contradictions
These techniques are related to the UBIQUITOUS LANGUAGE and knowledge crunching and are about the better usage of UBIQUITOUS LANGUAGE and knowledge crunching in order to extract important domain concepts and hence deepen the domain model.
Modelling Less Obvious Concepts:
- Explicit Constraints
- Processes as Domain Objects
- SPECIFICATION
- Validation
- Selection (Querying)
- Building to Order (Generating)
These techniques are about better representations for less obvious concepts which can greatly improve the model. The author as usual, provides concrete examples for all these techniques.