The Agile methodology has a lot of pros and cons. In fact, it is one of the most common argument/discussions I have with a mentor of mine. He likes to point out (correctly in most instances) that the Agile approach skips out on important design. It causes a lot of re-work because of that lack of up-front design. This re-work is only partially a problem. The Agile method assumes that changes will come during the implementation of a project. Instead of spending time up front in design on things that end up being thrown away, Agile takes a just-in-time approach to all phases of a project. I have witnessed a lot of good and bad in these type of projects and found a few ways to help your Agile project improve its success rate while still delivering quickly.
Design is not an Option
Although the design phase is not front loaded for Agile like it is for Waterfall it is still required. Coding without design is like driving without a map. You might have an exciting journey, but it will almost never be the most direct route. Teams that have seen success using Agile also have a design portion of every sprint. This step does not have to be highly formal, nor does it have to take long. A day or two of design at the front of a two-week sprint will do wonders for quality and help you meet the estimates. Do not take my word for it, give it a shot for a couple of sprints. This period does need a quick turn around though as there will likely be clarification requested of the business side or critical stakeholders.
Testing is not an Option
In the same vein, testing along the way is critical to Agile success. A primary aspect of this approach is that things will change. A good bed of unit tests and regression testing will allow the changes to made while minimizing the impact on quality. Yes, the tests will have to change and might even need to be rewritten. However, they will be critical for assessing that a change has not broken other areas of code. A team that uses Agile and regularly has to “refix” a bug from QA can help themselves with a good set of unit tests. Of course, tests must be run to be useful so incorporate them into the build process.
Ask About Always or Never
Since Agile assumes requirements will change we need to do our best to limit the impact of those changes on implementation. When processes or objects are being designed that means we need to be careful of our assumptions. Simplicity and performance may imply that we take a design path because of certain assumptions. However, when those assumptions prove incorrect we can find ourselves coded into a proverbial corner. Thus, when faced with the possibility of coding a tight solution based on assumptions it is good to ask the “always or never” question.
This takes the form of “are you sure this will never happen?” or “are you sure this will always happen?” It is worth it to emphasize the question and the assumptions to assure you that the right approach is being taken. When in doubt, avoid coding yourself into a corner. Functionality correct, but less than perfect performance is better than non-functionality. That is what refactoring is designed for.
What This Looks Like
There are many ways to follow these guidelines in practice. Of course, Agile is all about limiting documentation and speeding implementation. I have found that pseudo-code and comments at the start of implementation help enforce both design and testing. When you insist that all functions and methods include comments about inputs, outputs, error-handling and a brief description of functionality all of these concerns will be addressed.
It is not a perfect solution. Nevertheless, it will help with documentation while asking the developer to think about the code before they write it. I have not seen it done, but I think you could even do a comment task on implementation items early in a sprint. Ask the developers to write out the comments, test conditions and parameters for everything first, then the code can follow. This is much like test-driven development. In a similar fashion, it pushes implementors to think about design before they get into the coding.