Wildbit

The Blog

Thoughts on building web apps, businesses, and virtual teams.

Twitter

25 Aug Kill Tree, Save Code! ← Go back

Posted by Ilya Sabanin on August 25, 2009 — 3 Comments

Ilya Sabanin

We at Wildbit are very passionate about our code. That’s why we always do refactoring: making our code faster, more efficient, and prettier. I want to share a little tip that make it a bit easier and a lot more fun.

Refactoring of course is not an easy task, and often you need to get a bird’s eye overview of the system before starting to improve it. You should see all classes, methods, modules, how they are structured and interact with each other. In an ideal world you would use a gigantic display for that task that would allow you to see all the stuff simultaneously without scrolling. This would make reviewing big chunks of code much easier. But unfortunately we don’t have such displays yet. Even 30” is not enough for this task. So why not use the space of your desk instead?

So, here is the simple trick. Try printing your code on paper and arrange the sheets on your desk in a way that all of them are visible at once. Now, when you can see all of your classes and methods, you can start re-arranging stuff. Use a red marker to move methods and strike out deprecated code. Don’t hesitate to write-down your comments on the sheets as well. Check out the photo of my recent paper refactoring:

Paper refactoring

This method always works for me, hopefully it will help you too.

3 Comments

What do you use to print your source code out? I like to refactor in this manner as well but I’ve never really been satisfied with the printing capabilities of most of my editors.

Kevin LaCoste — August 25, 2009, 11:23 pm

Kevin: TextMate is pretty good at that.

Ilya Sabanin — August 25, 2009, 11:34 pm

Ilya Sabanin

Thanks Ilya, that’s what I’m using. I seem to recall using an app back in the day that had lots of nifty options for printing source code. Too bad I can’t remember what it was.

Kevin LaCoste — August 26, 2009, 5:21 am

Write a comment

* required
* required

← Go back

Get in Touch

Wildbit, LLC

Work 20 North 3rd St, 2nd Floor
Philadelphia, PA 19106 USA

Google Maps
 
 
Fax
+1 (267) 200 0835
Email
IndyHall

We work at IndyHall. Coworking is more than just space.