I am a proud father of two kids – 5-year old girl and 1.5 years old boy. For the most time they are good kids. But with alarming regularity, every couple of months, they turn out into terrifying monsters. For example, the boy would go to sleep at 7:30 pm each day and sleep well till 7am in the morning. Awesome. And then suddenly he would decide to stay awake for the whole nights for extended periods of time, and his poor parents would of course not sleep as well, turning into walking zombies during the day. Curiously, the little guy does not seem to be tired at all, even after his series of sleepless nights. Or my daughter would one day decide that she no longer likes to eat anything – with the exception of ice cream.
My wife and me used to be disoriented and powerless when this happened – until we consulted a child psychology book that described the phenomenon. And what do you know – not only is such a behavior of a child expected and normal – it is essential for the kid's development! Kids have to break the rules regularly, in order to build something new on top of the rubble.
By now, you can probably tell where I am going with this extended tale of my family life: the same rules apply to the software project. Every once in a while – and regularly – break something and re-fix it in a new way. Otherwise, your project, its internal architecture, its priorities, its target audience, its feature set, will petrify and very soon cease to be useful, attractive and desired.
You should explicitly plan for breaking something in your project regularly, so that the impact of the destruction will be minimized. Starting from the micro-level, the rule can say “30% of each iteration goes to refactoring, because as we all know, this code stinks” (yes it does, I am yet to meet a quality software team that would claim otherwise. The teams that refused to admit that their code is no good were without an exception very lousy teams). On a more macro level, during the release planning, it could be specified that twice during the release cycle (say – every two months), the team and stakeholders will reevaluate the ergonomic quality of the UI and rebuild it (from scratch if need be), because it is tough to get it right the first time around. Well, you might not actually have a UI in your product (hello, OS driver developers), but whatever your project domain is, plan to regularly reexamine whether you still like where the project is going and whether you like how the internal design looks like.
How can you tell that it is now time to “launch some grenades into this cesspool of suck”? Your team will know – the right moment is when the developers start to complain that the architecture of the system is too rigid to add new features or when during standups you hear more and more stories of people fighting with some particularly problematic piece. This is when the decision should be made to refactor and redesign.
Be aware that planning the breakage does not make it totally painless – it will still hurt. Agile methods such as regular refactoring, automated testing, CI, help quite a bit, but absolutely do not make the pain go away. After each refactoring and redesigns, the system will be in an unstable, sorry shape. You will have to fix quite a few of bugs and work hard to make it stable again. But the alternative is much much worse – if you fail to refactor your project regularly on a macro and micro level, you will end up painting yourself into the corner, ending up with a product that is not easy to extend or modify any more, with outdated UI, outdated feature set, not attractive to your customers and frustrating to work on for your development team.
| Attachment | Size |
|---|---|
| boxer.jpg | 54.69 KB |
Comments
Problem in chair, not in computer.
May 11, 2009 by Anonymous (not verified), 2 years 39 weeks ago
Comment id: 2540
You FAILED with the first separation - he should have been left in the crib to cry at about the age of 18 months.
It was the toughest thing we had to do.
The child learns to deal with separation on his own, developing a sense of self and independence.
Then you FAILED with respect. You needed to teach the child to be responsible for himself, to control himself and respect himself. This should occur about 2 or three years depending on the child.
INSTEAD, you were to WEAK and you decided to be his best friend no matter what. Well now you have another sociopath developing a self centered entitlement attitude.
Re: Problem in chair, not in computer.
May 11, 2009 by Janusz Gorycki, 2 years 39 weeks ago
Comment id: 2541
Thanks for calling my son a sociopath. No worries though, he is plenty independent and self aware, thank you very much.
Now, how does this relate to the subject of my post?
Watch for side-effects
May 11, 2009 by Mr. Hericus (not verified), 2 years 39 weeks ago
Comment id: 2543
Hi Janusz,
Thanks for this post. To often developers (and management) are afraid to let things break, because they're not confident that they'll be able to fix the breakage after it happens. It's important to re-visit designs, re-think GUI's, and re-invent the wheels every so often to keep things health and vibrant within a code-base.
Something to watch out for, though, and prepare for in advance are all of the side-effects that come from breaking code. You may have broken code in one part of the application, but unexpected (or simply undocumented) dependencies in another area of the system may be discovered.
That's where Continuous Integration, unit testing, and Continuous Testing come into play. They give you the safety net, and the feedback loop to be strong in your decision to break things.
Thanks again!
Beware of the safety net - was: Watch for side-effects
May 11, 2009 by Janusz Gorycki, 2 years 39 weeks ago
Comment id: 2544
You are absolutely right - do set up a safety net of unit tests, CI, peer reviews and whatnot. BUT - do not trust it fully. It WILL let major bugs slip by and you WILL have to go through the pain of fixing stuff broken in awkward ways.
I have pretty much glossed over the subject of safety precautions just to emphasize the main point: breakage is the price you have to pay for letting your code stay alive instead of getting perfified and irrelevant. So plan for it and don't feel bad about it.
wow
May 11, 2009 by laszlos, 2 years 39 weeks ago
Comment id: 2549
I thought the comments on my post were tough. At least no one is attacking my children... wow, I guess I have it pretty good. ;-)
Re: Problem in chair, not in computer.
May 13, 2009 by Datacool (not verified), 2 years 38 weeks ago
Comment id: 2557
Well Janusz, that was indeed well replied. wonder why folks choose to make the wrong comments at the wrong place.
Its funny though how this guy seems to outline so many negative attributes with such precision. A sociopath already made, I think?!!
Holier Than Thou
May 14, 2009 by Anonymous (not verified), 2 years 38 weeks ago
Comment id: 2561
Wow buddy, way to miss the mark entirely. Instead of taking the parable about his children as a launch pad toward the ACTUAL (yes, I can accentuate my meaning by capitalizing it as well...) subject matter, you decided to lambast this person's parenting capabilities so as to justify and inflate your own parenting choices.
If anyone's on the road to sociopathy, it'd be you. You clearly have illusions of grandure about your parenting skills - You tunnel visioned this article so hard, I had to stare in disbelief at the comment for some time - and your choice of accented words causes me to believe you have self-worth issues, but I won't get into any measure of psychological profiling here...
With that out of the way....
Author, I found your argument quite compelling but you never really detailed the costs attributed to such intentional breaking. Surely the work wouldn't be done for free, and obviously these refactor sessions are not outwardly beneficial to the customer - in fact, they won't even know it happened.
So, I'm sort of curious how often this work would actually be approved to be done. It may reflect my inexperience in the field to say this but, it just seems like wishful thinking.
A question of costs
May 19, 2009 by Janusz Gorycki, 2 years 38 weeks ago
Comment id: 2586
Re: last comment
You might have noticed that I am not exactly trying to exhaust the subject in my posts. For one, I am restrict ed to 700 words or so and jam packing too much content would make it too compressed and not attractive. Besides, it is cool to discuss such details in comments, isn't it?
So - the question of costs. I am claiming that refactoring and redesign is inevitable, whether you like it or not, for all non-trivial projects. So you will be better off planning for them instead of letting them catch you by surprise.
Will the customer approve such refactoring? Surprisingly, yes they will. At least the more enlightened, who have been burned in the past by overoptimistic task estimations will actually insist on being able to iterate over the delivered product and fix whatever they don't like. You should encourage them to do this as much as you can, showing the benefits both of the parties will get out of such an arrangement.
Last but not least, may of us are our own customers - i.e. - we produce software which we then sell. In such situations, the cyclic refresh, redesign and refactoring is absolutely crucial. Otherwise you are going to promptly paint yourself into the corner of irrelevance
Post new comment