Este artículo está basado en el
artículo de Martin Fowler “Is Design Dead?” y en su
traducción al castellano realizada por Alejandro Sierra .
La verdad es que he descubierto en
Martin Fowler una verdadera fuente de inspiración y de ideas sobre la
ingeniería del software . En los últimos tiempos, basándome en sus artículos, estoy encontrando respuestas y reflexiones valiosas sobre los problemas que me afectan como desarrollador de software.
En este caso, llevo algún tiempo en conflicto entre la idea de realizar el diseño the beginning of the project, stopping all development until we have a clear vision, or begin to develop as soon as possible to have something to offer as advocated by Agile
, even if it means redoing what has already been done when the ideas are clarified or vary .
In this article, Martin Fowler
outlines his ideas on the design within an agile methodology
as XP which apparently does not care.
There are two ways to approach the design, evolutionary design and layout planning:
- During the evolutionary design the design is as that the system evolves as part of programming. This type of design usually ends in disaster because it ends up being an aggregation of ad hoc decisions that complicate and deteriorate the code design.
- The planned design corresponds with the vision of any engineering design classic, where it is to anticipate problems in the abstract without entering the code until you have completed the design phase. However, it is difficult to anticipate all problems prior to beginning the program, which brings up tensions between developers and designers. Can also lead to changes in requirements that may be due changes in the business and therefore are very difficult to predict and control their effects.
XP evolutionary design advocates. However, for it calls for a number of practices to control the negative effects of this type of design. According to the curve
software change, the change in programming costs increase exponentially as a project progresses, making the evolutionary design. But this curve can be flattened by a series of practices that reduce the effect of the changes. These practices are:
- tests: to control the effect of introducing changes eviatndo new errors.
- Continuous Integration: Allows the team in sync preventing the changes affect more people.
- Refactoring: to clean the code and make it more maintainable and easy to modify.
In evolutionary design XP says that "we must do the simplest thing that can work" and not carry out anything not necessary (principle YAGNI - "You Is not Gonna Need It") . This is to keep the design as simple as possible doing only what estructamente necessary. For this there are two reasons: If
- does something you do not need right now is committing an effort to hose who it is. In addition, you may be doing wrong for lack of information, it is better to postpone its implementation until we know more detail.
- A complicated design is harder to understand and implement than a simple. Doing what is necasio have a simpler design and easy to implement.
However, this way of keeping the design simple adding later that is becoming necessary to go is only feasible if you are using the practices described above to reduce the cost of change.
As guidelines for what it is a simple design,
Kent Beck exposes the following four criteria:
- Running all the tests. Reveal
- every intention of the code making it easier to read.
- Avoid duplication.
- The smaller number of classes and methods.
No need to waste too much time looking for the simplest design. Refactoring allows simplifying Irlo as to be understood. Nor is it good to use design patterns without rhyme or reason, it is best to let the evolutionary design to guide you to the use of a pattern that enter early.
Regarding the use of diagrams UML and XP
said to be used if they are useful, but not in favor of its use. Diagrams can be useful for communication as long as they kept to the simplest possible. However, the use of diagrams is complicated when there are changes during the course of the project, because it is difficult to keep in sync with the code.
important thing in design is to avoid irreversible decisions. Thus the decision is not dramatic because bad decisions can be undone. In this sense it is important to have code control systems to ensure the reversibility.
is important to have people involved in design. Someone must ejecercer control over the project overseeing the design of the code and takes responsibility for it. These people should act when it detects that the design can be compromised or there are any technical difficulties during the project. This role is the technical leader. It makes no sense the role of architect, as there can be design by someone who then "walk away from the construction of software.
The design of a project can be measured in terms of the quality of the code base. If the quality of a project code base deteriorates and becomes more dificles work, then the design is insufficient. This is a subjective criterion but the technical people who first suffered the difficulty of making changes and who need to hear. According
Martin Fowler, the nature of siden has changed. Now seeking the following skills:
- code is kept as clear and simple as possible .
- be able to refactor , making design improvements where necessary.
- know and recognize patterns and when evolution towards them.
- ability to communicate the design through diagrams, code, and direct communication with other people.
summary,
Martin Fowler calls for an evolutionary design that allows the development start early. But this can not be done anyway, it is necessary to introduce practices that facilitate change during development so that the design can improve and adapt to new needs as they arise.
This goes against a planned design that leaves everything for granted in a long initial phase is followed by a phase of implementation will in no changes are contemplated and, when incorporated it end up being absolutely unavoidable, they are difficult incorporate, breaking the previously established design and introducing a high propensity to errors.
Design many delegates evolutionary design work on the developers. There is no figure of the architect as someone who does all the design work, but as someone who supervises the work of these. There must be a capable and committed team to continue this way of working, otherwise, it is not feasible.
References: Desing
Is Dead? - By Martin Fowler design Is he dead? - Translation of Alejandro Sierra Examining the Cost of Change Curve Agile