Pain Driven Development
My colleague Pat Fornasier has been using an interesting spin on the idea of making decisions at the last responsible moment by encouraging our team to ‘feel the pain’ before introducing any constraint in our application.
These are some of the decisions which we’ve been delaying/are still delaying:
We decided to just create a trait where we wired up the dependencies ourself and then inject that trait into the entry point of our application. Effectively it acts as the ApplicationContext that a framework like Spring would provide.
I was fairly sure that we’d need to introduce a container fairly quickly but it’s been 10 weeks and we still haven’t felt the need to do that and our application is simpler as a result.
Our initial attempt at writing this code was single threaded and it was clear that there were many places where performance optimisations could be made.
Since we were only ingesting a few thousand documents at that stage it still ran pretty quickly so Pat encouraged us to wait until we felt the pain before making any changes.
That duly happened once the number of documents increased and it started taking 3/4 hours to run the job in our QA environment.
We then spent a couple of days working out how to make it possible to process the documents more quickly.
As I mentioned a couple of months ago the application we’re working on is mainly about taking data from a database and applying some transformations on it before showing it to the user.
We decided to incrementally add different types of documents into the database.
This meant that initially all our transformations involved just getting a text representation of XML nodes even though we knew that eventually we’d need to do more processing on the data depending on which tags appeared.
These data transformations actually turned out to be more complicated than we’d imagined so we might have delayed the pain here a little bit too long.
On the other hand we were able to show early progress to our business stakeholders which probably wouldn’t have been the case if we’d tried to take on the complex markup all at once.
One thing to note with this approach is that we need to make sure there is a feedback mechanism to recognise when we are feeling pain otherwise we’ll end up going beyond the last responsible moment more frequently.
There will probably also be more complaints about things not being done ‘properly’ since we’re waiting for longer until we actually do that.
We have a code review that the whole team attends for an hour each week which acts as the feedback mechanism and we recently starting using Fabio’s effort/pain wall to work out which things were causing us most pain.