Evolving Architectures - Part II but Design is emergent
This is part II of a series on agile architecture.In the previous installment I provided a definition for software architecture and raised the apparent friction between the up front design implied by software architecture and the YAGNI approach and deferred requirements prompted by agile development in the large. This installment take a look at an additional angle of the problem which is the difference between design and architecture (while architecture is a type of design I cam calling design the code or close abstractions of it that don't yet fall under ";architecture"; as defined in the previous post). The difference between the two, as the title suggests, is that while design can be emergent, Architecture, unfortunately needs to evolve.
Unless you've been living under a rock, you've probably already know about Test Driven Development (TDD) or its cousin BDD. If you've actually used TDD, you've probably noticed the impact it has on the actual code. Writing code only to cater for defined tests coupled with refactoring that keeps the design tight we get to a result that, more often than not, simpler than going through the more traditional design first (you can take a look at Uncle Bob Bowling Kata for a simple, albeit synthetic , sample)
In fact, a more accurate expansion of the TDD acronym is Test Driven Design. Yes the tests are there to make sure the code adheres to the specified requirements. However, the iterative process (test,code & esp. refactor) makes the design emerge . The emergent design effect, works very well with the goals and tenets of Agile and Lean methodologies as it helps eliminate wasteful future-proofing code that we don't need; eliminate waste of extra component (due to pre-design) etc.
This sounds great, so it is very tempting to take that to the architecture level, after all Architecture is a type of design, wouldn't it be efficient to do TDA (Test Driven Architecture) as well. I think that in theory it might be possible. However as the old adage goes ";Theory and practice are the same - at least in theory";. So in practice, the problem is that architecture is global and have solution-wide consequences. Time and size (of work) constraints make us want to set the playfield for the solution as soon as possible. Architecture decisions are hard to postpone on the one hand and have extensive influence on the other. E.g. a buy vs. build decision; 3-tier vs. SOA; RDBMS vs a NoSQL solution etc. if we try to have the architecture grew the way ";regular"; design can the ripple effects will be devastating to the development process.
What we have to do instead is evolve the architecture. Start with something that is in the ball park and then when we know more about the problem make changes, evolve the architecture over time. This is beneficial since requirements also tend to change over time so if we find a way to evolve the architecture we can deal with that as well.
In the next part I'll try to give a couple of examples on how this can actually be done i.e. how you can evolve an architecture