Archive for the 'Imperfection' Category
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 [...]
Posted in Design, Imperfection, Implementation | Comments Off
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 [...]
Posted in Design, Imperfection | Comments Off
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 [...]
Posted in Design, Imperfection, Implementation | Comments Off
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 [...]
Posted in Agile, Design, Imperfection, Implementation | 2 Comments »
I was extracting smaller methods out of existing big ones, in a class I was working on. Some of these extracted methods became “utility methods”: they would perform some operation on the parameters given to it, but not use any of the fields in the class. These methods could just as well have been static. [...]
Posted in Imperfection, Implementation | Comments Off
When you build a house you have to think about fire safety. For a small cottage it might be enough with simple smoke detector. For a large building must also have fire alarms, extinguishers, sprinklers, emergency stairways, signs of evacuation routes and much more. Exactly what is needed is adapted to house size. All this [...]
Posted in Imperfection, Process | Comments Off
Problem When committing changes to a Cayenne context, you get an exception like the following. org.apache.cayenne.CayenneRuntimeException: (v.3.0.1 Sep 06 2010 15:09:38) Temporary ID hasn’t been replaced on commit Cause You are trying to commit an object for which Cayenne does not know how to generate a permanent id. This in turn typically happens when the [...]
Posted in Imperfection, Solution | Comments Off
Problem When committing changes to a Cayenne context, you get an exception like the following. org.apache.cayenne.CayenneRuntimeException: (v.3.0.1 Sep 06 2010 15:09:38) Error generating PK : entity not supported: SOME_TABLE Cause A column that is part of the primary key of SOME_TABLE has no value. Therefore Cayenne tries to generate one, but does not know how [...]
Posted in Imperfection, Solution | Comments Off
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 [...]
Posted in Design, Imperfection, Implementation | Comments Off
The tram stop next to my apartment has been completely rebuilt during the last few weeks. They removed every part of the old one, including the actual little shelter, the fence, the curb, the pavement — everything. A pretty major change as far as tram stop remakes go. It could be seen as a clear [...]
Posted in Imperfection, Principles | Comments Off