Pat Gunn (dachte) wrote,
Pat Gunn

Lessons from Refactoring

Recently, I've been going through a number of my programming projects and moved any function that's either generally useful or used in more than one project into a common library. Unsurprisingly, as I do a lot of programming this means I'm sometimes merging dozens of implementations of what's roughly the same idea (with different call semantics and return values; usually easily fixable with a bit of reworking of the calling code). I'm doing this in Perl and C (I do have some old Java code and a bit of Python, but I don't code a lot in either language regularly). Chances are when I get this done I'll force the condensed libraries to mirror each other.

I highly recommend this kind of thing. It's a fantastic learning experience; not the kind of thing where you get a particular set of ideas out of it (although using function pointers, be LISPy, and make introspection easy are great particular lessons), but more the kind where when you move your mind over a lot of code you get better instincts on how to code things better the first time.

Utterly conventional knowledge, I know, but just like having a monthly "Happy Backup Day" to remind you to do backups, the reminder can be helpful.

Oh, hey, Happy Backup Day. Go back your shit up so some hardware failure won't make you cry (more than it needs to, anyhow). Your data is more valuable than your machine. Your ideas are more ... nah, no philosophy for this post. ;-)

Tags: programming

  • CMU, the First Amendment, and Indecent Exposure

    Earlier on my G+ stream, I commented on the matter of a CMU student who protested the Catholic church's coverup of sexual abuse by dressing as the…

  • Dilution

    I've been thinking about an issue that's been raised in the secular community; I'm not sure it's a good issue, nor a bad one. Let me lead up to it…

  • Commentary on the Human Rights Campaign

    I recently was pointed at a blog post suggesting people reject the Human Rights Campaign, a large social justice organisation that focuses on…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment