Like most engineering teams, we at Rapleaf do not write perfect code. Whether because of design shortsightedness, changing requirements, poor style, obsoleted functionality or a host of other factors, we often find ourselves wanting to clean up parts of our system. The need to clean up code is common to every individual and development organization, and lots has been written about the costs of technical debt and tips for effective refactoring. Somewhat less discussed are the procedural strategies that organizations employ to effectively encourage code cleanup; a team may know how to refactor, but without an effective mechanism may still find itself paralyzed by too frequent, too infrequent, or unmotivated practices.
One of the core cleanup strategies that we use at Rapleaf revolves around an event we call “Sweepleaf”. Roughly every 6 weeks, we designate a day to be a special Sweepleaf day during which engineers set aside their regular work and focus exclusively on cleanup tasks. These tasks often involve rewriting or eliminating code, decommissioning obsolete services, or other work that yields a healthier codebase. At the end of the day, we all share in the catharsis of reporting how many lines of code we deleted or files we removed.
The key benefits of our Sweepleaf process are twofold. First is the obvious: Our code is much leaner, more readable, and generally healthier than it would be otherwise. In the absence of Sweepleaf, a multitude of cleanup tasks might not get addressed before they become crippling. One way I like to think about Sweepleaf is that it is an opportunity to take care of those tasks that are eternally 2nd priority; they are the tasks that you really, really want to take care of when you run across them in the code, but a higher priority deliverable is always in the way.
The less obvious benefit is psychological. Because of the regularity of Sweepleaf, engineers are aware that they will have a cleanup opportunity in the near future, mitigating the frustration of living with imperfect code. They can immediately record the item in our active list of Sweepleaf tasks (maintained in Jira). Further, the simple knowledge that others are improving code quality is a boon to morale. One engineer on the team expresses his feeling that “there’s this great relief – your life just got easier. You get to bask in the glow of an agile culture. You’re lean and mean, and everyone on your team knows it.”
Sweepleaf on its own does not solve every cleanup issue. Some tasks are too large to be addressed within a day, and some are too urgent to be left alone for 6 weeks. In those cases we’ll spend time where it’s needed and make sure the job is done right, regardless of the day. On the whole, though, Sweepleaf both raises our “cleanup consciousness” and motivates us as a team to keep it clean.








4 Comments
One issue though which i can see is that coders(coz lack of time) would write smelly / duplicated code and add a task to Sweepleaf tasks to get off the gilt.
How to make sure that Sweepleaf tasks are not used as alibi to write crappy code.
Good stuff. Thank you for sharing!
That is a great idea. Can you afford to spend one full day refactoring?
Yes, our feeling is that the one day we spend every 6 weeks is well worth the investment. Conversely, if we didn’t spend the day that way, we feel we would end up paying a larger price later.
4 Trackbacks
[...] and long debugging hours after a lot more code has been written on top. Rapleaf holds “Sweepleaf” days semi-monthly where engineers do nothing but cleaned up and streamline [...]
[...] and long debugging hours after a lot more code has been written on top. Rapleaf holds “Sweepleaf” days semi-monthly where engineers do nothing but cleaned up and streamline [...]
[...] setbacks and long debugging hours after a lot more code has been written on top. Rapleaf holds "Sweepleaf" days semi-monthly where engineers do nothing but cleaned up and streamline code. People – [...]
[...] Managing multiple schemas has been a bit of a pain point for us in the past, and during our latest Sweepleaf we set out to create a tool that would help us run multiple sets of migrations from within a single [...]