Thursday, 22 December 2016

Six Stages of Debugging

Found this recently:
  1. That can’t happen.
  2. That doesn’t happen on my machine.
  3. That shouldn’t happen.
  4. Why does that happen?
  5. Oh, I see.
  6. How did that ever work?


Six Stages of Debugging

Thursday, 15 December 2016

New feature in IntelliJ

In the User Interface in the new version of IntelliJ1, version 2016.32, a new feature popped up called "Parameter hints"3.

My colleague at work has some strong feelings about it.

He feels that the feature provides the lazy programmer with an excuse not to provide properly typed parameters in a method definition (too many String/Boolean/Long and not enough OrderedItem for example). It also would allow the lazy programmer to create methods with 5 parameters or more, as the IDE helps you identify what they are.

Uncle Bob4 mentions that anything over three requires some serious soul searching.

My colleague and I both feel that a few of the methods in our software are suffering from an excess of parameters. Even worse, that a lot of these parameters are Booleans that function as switches to alter the behaviour of the method in some way. A code smell, to be sure.

Some solutions, although this blog post does not actually focus on it, is using either a configuration object that contains the parameters4 or perhaps a builder.


[1] IntelliJ IDEA the Java IDE
[2] What's New in IntelliJ IDEA 2016.3
[3] Parameter Hints in IntelliJ IDEA 2016.3 - YouTube
[4] Clean Code, page 40
Robert C. Martin
[5] Introduce parameter object

Thursday, 8 December 2016

Git and Subversion at Work

At my work we are still using Subversion, and some of my colleagues have started using Git locally, coupled to the remote subversion repository.

I am intrigued in how to get this working on my workstation and this contains some of my thoughts on it.


  • since we moved to a virtual svn server, it is becoming impossible to do something worthwhile like request the svn history of a file or use "Annotate" in IntelliJ and receive a result within a reasonable time period. It currently takes 15 minutes or longer. A local git repository alleviates this problem immensely.
  • the creation of branches can be done locally, which is a big help if I need to work on multiple issues at the same time, and I need to switch repeatedly.
  • a local git repository helps me to perform multiple checkins related to the same problem, without inconveniencing any of my colleagues. I can even decide to merge my different checkins together and submit them to subversion as one big changeset.
  • the merging is said to be painless and conflicts are very very few, even with rather complex checkins. One of my experiences with Subversion in combination with IntelliJ, is that IntelliJ sometimes is unable to merge it properly and changed code (or duplicated code) is just added to the top of the code file.


  • retrieving the entire svn repository using git (which is the default) is taking a long time (several days). I let it run, but I decided to switch to selecting only a few branches that interest me.
  • I still am trying to get to grips with the fact that just checking in isn't enough. After I check stuff into my local repository, I still need to merge it to the master branch and then submit it to subversion.
  • it was confusing for a moment, when I noticed that my changes in one branch were automatically visible when I switched to another branch. But this is perfectly normal and happens when you have changes that are yet uncommitted.
  • it takes a bit of effort to keep everything straight in my head. Especially in which branch I am currrently working.

JIRA, Git and IntelliJ

I do like the seamless integration between JIRA, IntelliJ and Git. I can just stay in IntelliJ, and search for specific task in JIRA. IntelliJ will automatically create a Git branch with the appropriate JIRA task number as well as a new Change Set.

It is even possible to automatically move the JIRA task to "In Progress", though for now I do not make use of this functionality as I would like to have a little bit more control.


I like git a lot. In the past I was able to submit my changes into Subversion at the touch of a button. The setup now of a local git and a master branch and a subversion remote repository does require several extra steps to check anything in.

But those added steps are worth the effort, compared to all the extra capabilities I gain.


[1] git website - git-svn Bidirectional operation between a Subversion repository and Git