Want your code "pimped"?

by Andrew | October 7th, 2008

We decided it’s finally time to implement an idea we had long ago.

I’m an avid reader of the blog of Wil Shipley, a man in the business of writing great apps for OS X. His running code improvment series, Pimp My Code, takes submissions from readers who think their code needs refactoring. Then Shipley refactors them, explaining the whys and hows along the way. The submissions are small (never more than 75-100 lines), but in rewriting them Shipley always happens upon specific, useful programming tips. I don’t know the first thing about Objective-C, but I find the series fascinating and instructive.

So we’re going to do something similar on this blog. Do you have a piece of JavaScript you want refactored? Does it use Prototype? Do this:

  1. Sign up for a GitHub account if you don’t have one. It’s free and quick.
  2. Go to Gist, GitHub’s pastebin app, and paste the code you want us to refactor. Mark it as “private” if you like.
  3. Message me on GitHub with the URL to your code snippet. If necessary, explain a bit about what the code does (or should do), but don’t write an epistle or anything.

I’ll share the submissions with the rest of the team and we’ll pick a few that we like. Then we’ll dedicate a post to each one, refactoring out loud along the way. We won’t be mean or snarky; this is not a DailyWTF-style exercise.

To pre-empt the obvious rebuttal: we do not consider this to be an act of charity, or code manna from computer heaven, or a gift from the light-bearers to the huddled masses. Whether we actually “improve” your code is not for us to say. It will, however, illustrate our coding style.

If that sounds useful to you, then step up! Give us code and ask that it be pimped!

Comments

  1. Gary Haran #

    Wow this is the kind of thing I always dreamt of having but thought that asking would be a bother.

    I converted an old calendar library I started years back to use prototype and scriptaculous. I open sourced it and uploaded it to github here: http://github.com/garyharan/kalander/tree/master

    It’s available for demo here: http://www.garyharan.com/kalander/

    Would I be so lucky to be selected I’d gladly get any kind of tips from you guys. I hadn’t dared to ask.

    October 7th, 2008 @ 10:14 PM
  2. Dennis Calazans #

    This kinda huge! =)

    I shared at gist my CyberForms, a code i did long time ago to deal with forms.

    October 8th, 2008 @ 07:44 AM
  3. David Dashifen Kees #

    What type of size limit on the code should we be expecting? You mention 100 lines in the article. Is that the ceiling for submissions?

    October 8th, 2008 @ 08:12 AM
  4. Andrew Dupont #

    @David: Yeah, shoot for 100. Anything larger is hard to write an interesting blog post about.

    October 8th, 2008 @ 09:36 AM
  5. Dan #

    I’m glad to see that you’re doing this. Thank you!

    October 20th, 2008 @ 11:37 AM
  6. Nick #

    THis is very exciting and I’m anxious to browse the results. Are you handling this individually, or do you intend to ‘show your work’ so to speak. I don’t have anything to submit, but would love to see what you to do others

    October 21st, 2008 @ 08:32 AM

Sorry, comments are closed for this article.

Search Blog


Search the prototype blog.

Subscribe to the blog

Akismet badge