Pat Gunn (dachte) wrote,
Pat Gunn
dachte

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
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment