Welcome

Welcome to our blog about all kind of topics that are related to software development. We blog about:

SOA, BPM, EDA, ECM and all the other buzz words. Beware some post might not be so common as you think. We are not scared to go against main stream thoughts.

Technologies like java, maven, springframework, OSGi and front end technologies and frameworks like jQuery, DWR, Flex.

Finally to make this happen we need tools and of course a Mac (well some of us do). So we blog about that as well.

Technorati

Add to Technorati Favorites

Linked in

We now have a linked in group, join the group if you are a regular reader and want to see who else reads this blog.

The final problem

A while ago it happened to me again. I was working on a piece of code for which I had to extend a class and override a method; while doing so I ran straight into a brick wall in the form of that miserable throwback of the Java language, the final method. Let me tell you about it….

About a week and a half ago (from the time of writing), I had to adapt some code in the codebase of one of my projects. The code in question was business rule validation code that was being applied to a data set. It had worked fine in the past, but now the business wanted an exception made to the general rule. In other words, in certain circumstances the business rule validation should not take place. Being a well-mannered developer I work test-first, which meant creating a test to prove that certain code wasn’t being called. So how do you do that? Well, in my case it meant subclassing the class with business rules in my unit test and overriding the method in question to throw an exception if it was called. That, and overriding a setter that I needed to work slightly differently.

So that was the plan and that was what I did. I created my subclass with the overridden methods, created an instance of it and used a setter to inject my new object into the class that the unit test was testing. At least, that was the plan. Really, people, who makes a setter method final?

Continue reading The final problem