The using statement is short and concise but does get in the way writing clean code. Do not use it.

I found that my colleagues and I were using the C# using statement as a replacement for try/catch blocks because we assumed it automatically and magically handled exceptions safely. Of course whenever you assume magic in programming, you don’t know what you’re doing and you inadvertently do it wrong.

In actuality, the using statement does no such thing as handling exceptions. It can even hide exceptions from you!

Read the rest of this entry »


I hacked together an Eclipse @Autowired plugin for a 24 hour innovation day challenge at work. I had not written an Eclipse plugin before and it turned out to be a more complex task than I imagined.

What I like about IDEs is that I can navigate quickly between references, declarations, definitions, superclasses, and subclasses. Pretty much all code relationships that are known at compile time can be navigated. Dependency injection, which I use all the time when I program something in Spring, establishes relationships at runtime and IDEs (or at least Eclipse, which is what I mainly use) don’t know anything about them. There seem to be Eclipse plugins that visualise these relationships but what I want is to right-click on a field and ask Eclipse to take me to the definitions of the bean that’s autowired into it (yes, we mainly use the @Autowired annotation at work). What I don’t want is to open a separate view or even a graph showing bean relationships. I want to see them in the code just like normal code relationships.

Read the rest of this entry »