Blogit (weekly)

  • Interesting guide about writing testable code.
  • Nice manifesto for team of developers.
  • Some good points on legacy code and why we are so eager to throw it away but shouldn't.
    • It’s harder to read code than to write it. This is why code reuse is so hard. This is why everybody on your team has a different function they like to use for splitting strings into arrays of strings.
    • The idea that new code is better than old is patently absurd. Old code has been used. It has been tested. Lots of bugs have been found, and they've been fixed.
    • Each of these bugs took weeks of real-world usage before they were found. The programmer might have spent a couple of days reproducing the bug in the lab and fixing it. If it's like a lot of bugs, the fix might be one line of code, or it might even be a couple of characters, but a lot of work and time went into those two characters.
    • These problems can be solved, one at a time, by carefully moving code, refactoring, changing interfaces.
    • Even fairly major architectural changes can be done without throwing away the code.
    • So half the functions started with "_" and half with "m_", which looked ugly. Frankly, this is the kind of thing you solve in five minutes with a macro in Emacs, not by starting from scratch.
    • You're just going to make most of the old mistakes again, and introduce some new problems that weren't in the original version.
Posted from Diigo. The rest of my favorite links are here.