Archive for the 'Design' Category

Separate class for each id type
Wednesday, December 21st, 2011

The code I’ve been looking at recently has quite some problems with managing various ids. The ids in the system are confusing on many levels, both syntactically and semantically. To begin with, there are a lot of them. They are represented using a mix of ints, longs and strings. Even the same id may be [...]

Two types of design
Wednesday, November 2nd, 2011

Lately, I’ve been thinking about two ways to design a system. I’m having trouble with figuring out which one I actually prefer. I’ll try to describe them below. If you would like to read through the description and leave a comment or two I would be very grateful! Feel free to just add a comment [...]

Name classes for content, not usage
Wednesday, October 26th, 2011

To make a class as universally usable as possible, name it after its content, not its intended usage. After all, the usage might change, and you may find a new area of use for the class which you didn’t foresee. Example In the project I’m working on, I had a class called SelectedInstalledBase which represented [...]

What I learned from Kent Beck
Thursday, September 8th, 2011

This is a summary of what learned from a “Mastering TDD” course with Kent Beck. Given he is the creator of JUnit, I guess his thoughts on unit testing are worth considering. In some cases I might have rewritten, changed, extended or simply misunderstood what he was saying, but these were my notes from the [...]

Two kinds of interfaces
Tuesday, November 23rd, 2010

An interface is a point of interaction between two systems and they are used extensively within the Java world. While the mechanics of interfaces always are the same, the semantics may differ. There are (at least) two rather distinct types of uses for interfaces in Java. One type of interface, which we might call separation [...]

Don’t peek
Monday, April 26th, 2010

When I talked to Michael Feathers about why constraints are good, he also mentioned an example of where he thought things were going wrong. Some people who use test-driven development, also use tools that allow the to peek into classes and read private variables. That is an efficient way to ensure that some method altered [...]

Exception Handling Policy – Catching Exceptions
Monday, July 6th, 2009

This is the third installment in my series on sensible exception handling and will cover when and how to catch exceptions. To quickly summarize, the series looks as follows: Throwing Exceptions Using Assertions Catching Exceptions (this one) Logging Exceptions The [...]

Exception Handling Policy – Using Assertions
Monday, June 29th, 2009

This is the second part in a series of four on exception handling and it focuses on an area related to exceptions — assertions. A quick summary of posts in this series: Throwing Exceptions Using Assertions (this one) Catching Exceptions Logging Exceptions

Exception Handling Policy – Throwing Exceptions
Monday, June 22nd, 2009

This is the first post in a series of four on exception handling. The series will cover what I think is a good and sound strategy for handling exceptions and errors in your application. It is written with Java in mind, but is applicable to most languages which feature exceptions. This first issue will go through the art of throwing exceptions.

Common Conception Of Agile Missing The Point?
Monday, March 9th, 2009

This is a bit of a rant, but I just gotta get it out of my system. I’m getting frustrated by people I talk to who seem to misunderstand the whole point of agile software development (IMHO). Different ways of reducing risk The point with agile, as far as I understand, is to reduce risk [...]