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

  • Still alive

    Been feeling a bit nostalgic. Not about to return to LiveJournal - their new ownership is unfortunate, but I wanted to briefly note what's been up…

  • Unplugging LJ

    It's about time I pulled the plug on the LJ version of my blog: 1) I'm much more active on G+ than I am with general blogging. I post many times a…

  • Mutual Trust

    I don't know which should be considered more remarkable: That a cat should trust a member of a far larger and stronger species that it can't…

  • 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