Just A Summary

Piers Cawley Practices Punditry

Listen to the Voice! 4

Posted by Piers Cawley Tue, 13 Feb 2007 13:31:00 GMT

You know that voice at the back of your head that says things like “That’s not really a data structure, that’s an object that is!”?

You should listen to it.

I’ve been battling away with having a million and one things monkeying with a result set that consists of an array of arrays, when really it should have been a ResultSet which has a collection of ResultSet::Rows. Once I bit that bullet, I got to do things like add ActiveRecord::Errors to each row and generally start to bring a bunch of big guns to bear on a problem.

So, having listened to the voice at last I’m going through and removing code with gay abandon. Sometimes I think removing code is one of the great joys of being a programmer – it’s the code’s way of telling you you got something right.

So, today’s slogan is “Reify early and reify often”.

Comments

Leave a response

  1. Avatar
    Pete Jordan about 3 hours later:

    Ho yus.

    Just had one of those moments myself, realising that a disparate collection of divs, form controls, CSS, javascript and XMLhttp calls is actually a Filterable object, and ended up discarding over half the code previously involved.

    It’s a nice feeling :)

  2. Avatar
    Piers Cawley about 4 hours later:

    Well, it is once you’ve got past the “Oh, I’m a bloody idiot for not doing this earlier” part.

  3. Avatar
    Pete Jordan about 5 hours later:

    Oh, I’m so used to that feeling, I don’t even notice it most of the time :)

    Refactoring is fun, though.

  4. Avatar
    David Cantrell about 23 hours later:

    Ahhh, reify, one of my favourite words. Thankyou for using it!

Comments



Just A Summary