08 May 2009

Code Cleanup - Stupefyingly Satisfying

Ctrl-Alt-F is my opiate of choice -- I’m a ReSharper Code-Cleanup junkie.

Ctrl-Alt-F is ReSharper's shortcut to a magical function that transforms all orphaned variables, non-standard formatting snafus, and unneeded C# using statements into a immaculate tray of chocolate chip cookies.


It’s stupefyingly satisfying.

Thanks to Markus, I am mortally dependent on ReSharper. When I used .Net 3.5 for the first time last year, ReSharper offered several intellisense suggestions that helped me adopt the slightly tweaked C# syntax -- namely, var and object instantiation.

Whether ReSharper or CodeRush with Refactor! Pro and others, who isn’t giddy making code cleaner, more granular (one method – one job!), or more uniform readable?

We all want to make code that's
So readable, it comments itself...
uh, right?

That said, such tools create and expose preference and taste issues for agile teams.

Team Manifesto - Code Standards

I like a Team Manifesto - a living document, initiated at team formation, that converges on perfection as the team matures.

All these nit-picky refactoring and reformatting preferences should be discussed, resolved, and adopted in the Team Manifesto -- not with disappearing ink, but in stone, with well-deliberated carvings that are readily updated at the pound of a chisel.

All teams should consider discussing the refactoring/formatting tool and agree upon standards.

A few questions for the team that come to mind are:
  • Which refactoring/formatting tool to use, if any?
  • Should the team establish a template of standard options within the tool that everyone applies uniformly (e.g., naming styles, braces layout, line breaks, type member layouts)?
  • Is it okay for team members to invoke a Code-Cleanup (or analogous) on code someone else has written?
Can you think of other questions related to refactoring and coding standards that teams should address? Please post them below. Thanks!

2 comments:

  1. Excellent post my friend

    ReplyDelete
  2. @Neil - it was inspired by your inquiry about productivity tools. Thanks!

    ReplyDelete