Home » Archive

Articles in the design Category

design, education »

[10 Nov 2007 | 13 Comments | ]

As a second-generation Iranian American, who has spent practically no time in Iran, I have found it difficult to learn the Persian language beyond mere kitchen talk. In an effort to improve my vocabulary, I sought out a list of the most common Persian words. I could not find such a list, so I searched for a Persian-language corpus that I could use to produce the list myself.
I came across the Hamshahri Persian Corpus and decided to use it. I ran a word count on the corpus to determine what …

design »

[8 Oct 2007 | One Comment | ]

There are two documents that I frequently visit when I’m refactoring code, the first is A Taxonomy for Bad Code Smells, which categorizes various smells in Martin Fowler’s Refactoring book. The other is this Smells to Refactorings PDF file, which lists all the smells and refactorings from Fowler’s book as well as from Joshua Kerievsky’s Refactoring to Patterns book.
I’ve been looking for something that lists the various taxa, the smells, and the associated refactorings in both books, thus consolidating the tables on both of these documents. I couldn’t find one, …

design »

[25 Jul 2007 | Comments Off on Designed vs. Open Inheritance | ]

I like Martin Fowler’s write up on Designed Inheritance, but I’m not so sure I agree with his implied suggestion that you cannot have designed inheritance and provide an enabling design.
If I have a component that is being called by other code, and that component is implemented as an abstract class that only allows subclasses to implement abstract methods (all concrete methods are final), then I cannot override the behavior of the parent class. This is designed inheritance because people can only subclass it in the way that I’ve …

design »

[25 Jul 2007 | Comments Off on Don’t mercilessly refactor unit tests! | ]

I teach TDD courses, and one of the questions that inevitably pops up is whether you should refactor your tests. When it comes to eliminating duplication in tests, my threshold is very high. By that, I mean that the most important thing to me is readability. I want to read a test like a mini story: I set this up, I execute this, I verify that.
One of the biggest annoyances I encounter with experienced TDDers is when they decompose tests to the point where you can’t see what the …

design, process »

[23 Jan 2007 | One Comment | ]

I didn’t find one that I liked exactly, so I just thought I’d post an image that represents the flow of the TDD process.
[click on image to enlarge]

design »

[19 Nov 2006 | 4 Comments | ]

Since Java adopted annotations, I’ve heard a lot of discussion around whether to prefer annotations over external configuration files (often XML) and vice versa.
I think the decision boils down to two criteria:
1) Can annotations simplify the metadata?2) Can changes to the metadata break behavior in your application?
If annotations do not reduce the amount of metadata that you have to provide (in most cases they do), then you shouldn’t use annotation.
I think the more important thing to considered is whether a configuration change could break behavior or not. If not, then …