About

This is the archive page for Head of the Kyu. Click to go to the frontpage of this site.

Last Comments

Ben (Breakthroughs and…): Here is a strange observa…
Carl Manaster (A handy heuristic…): Note on the comment syste…
Carl Manaster (A handy heuristic…): Let’s try that again… www…
Carl Manaster (A handy heuristic…): I once wrote a little vis…
Nico (A handy heuristic…): C# can have multiple clas…
Nat (A handy heuristic…): “an XP project is suppose…
Jim Bullock (A handy heuristic…): Are the class (or whateve…
Ģirts Kalniņš (Head of the Kyu): good to see you back.

Calendar

« May 2008
S M T W T F S
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Archives

Next Archive Previous Archive

01 Jan - 31 Jan 2007
01 Oct - 31 Oct 2006
01 Feb - 28 Feb 2006
01 Jan - 31 Jan 2006
01 Nov - 30 Nov 2005
01 Sep - 30 Sep 2005
01 Aug - 31 Aug 2005
01 Jul - 31 Jul 2005
01 Jun - 30 Jun 2005
01 May - 31 May 2005
01 Mar - 31 Mar 2005
01 Feb - 28 Feb 2005
01 Jan - 31 Jan 2005
01 Dec - 31 Dec 2004
01 Nov - 30 Nov 2004
01 Oct - 31 Oct 2004
01 Sep - 30 Sep 2004
01 Aug - 31 Aug 2004
01 Jul - 31 Jul 2004
01 Jun - 30 Jun 2004
01 May - 31 May 2004
01 Apr - 30 Apr 2004
01 Mar - 31 Mar 2004
01 Feb - 28 Feb 2004
01 Jan - 31 Jan 2004
01 Dec - 31 Dec 2003
01 Nov - 30 Nov 2003
01 Oct - 31 Oct 2003
01 Sep - 30 Sep 2003
01 Aug - 31 Aug 2003
01 Jul - 31 Jul 2003
01 Jun - 30 Jun 2003
01 May - 31 May 2003
01 Apr - 30 Apr 2003
01 Mar - 31 Mar 2003
01 Feb - 28 Feb 2003
01 Jan - 31 Jan 2003

Miscellany

Powered by Pivot - 1.40.0: 'Dreadwind' 
XML: RSS Feed 
XML: Atom Feed 

07 July 05 - 18:10London

Just a note of support for my friends and acquaintances (mostly in the XP community) who live or work in London, especially those of you I just reconnected with in Sheffield. Hope everyone is OK. Congrats about the Olympics, and don't let the killers take anything away from that.

- The Universe And Everything - No comments / No trackbacks - §

05 July 05 - 22:46The value of duplication

If you manage developers, duplicated code might not look all that threatening to you. In fact, you may have sensible reasons to insist on duplication.

I can guess what you might be thinking, but trust me for a little while. Put yourself in that manager's shoes - you're a technically savvy person, or were at some prior point in your career. At any rate, you don't mind looking at code. You don't have the time to actually read any of it - you're way too busy managing.

Suppose you're looking at Bob's code which implements the logic for printing invoices. You've just been looking at Bill's code which implements the logic for printing quotes. Bill is an excellent programmer, and his quotes code looked flawless. You're happy to see that Bob's invoices code looks quite a bit like Bill's code. You make a mental note to give Bob a pat on the back soon.

Bob may or may not be as good a programmer as Bill, but it doesn't matter; he doesn't have to. The fact is, there is a right way to code the kind of reports that include quotes and invoices; or at least, Bill's way is one of the right ways. So why should Bob not copy and paste Bill's code, and tweak it to print the kind of report that's needed ? And if a further kind of report is needed, it's nice to know that whoever is assigned the task of coding it will just have to copy and paste Bill's (or Bob's) code.

Well, you must be on tenterhooks by now. Am I turning apostate from the noble principles of DRY, the Simplicity Rules, and merciless refactoring ? No, I don't think duplication is good, and I don't think it is in software managers' best interests to reward duplication. But I find myself looking at the issue from the other side.

DRY is a strategy. We invest time in refactoring duplication out of the code. That time investment is repaid later. There are fewer places to look for bugs. There are fewer places to apply bug fixes to. There are fewer places to modify when the requirements change. Those are all upsides of merciless refactoring; but all strategies have a downside - or at least the potential for one.

The potential downside of well-factored code is that no two places look the same. It's harder to find formal, superficial regularities that tell you "yes, this is nice code" or "no, this doesn't look right". This ups the ante for someone who would review the code without being intimately familiar with it. Well-factored code is going to be harder to "manage" in this sense than repetitive code.

The good news for the manager is that code which results from factoring out duplication tends to be reusable code. Instead of having Bob code like Bill, you can look forward to having Bob use Bill's components. That's a win too !

- Extreme Programming - one comment / No trackbacks - §

Linkdump