Categories
Personal

Moving on

As of january 2009 I’m moving on from BBS which has been my current employer.

It has been a difficult decison I really struggled with. BBS is both a good employer as well as a incredibly interesting place to be. The people, products and technologies are at the front of development in the banking sector in Norway, and sometimes also the Java community. I have learned so much, and the spirit and people of the eFaktura department have made going to work something I enjoyed every day.

So now I’m moving on and starting in Capgemini Norway in the position of technology leader for Java. There’s a lot going on, and the people I have met so far have been excellent. I am really looking forward to start as my head has been in two jobs for a little while now. It’ll be nice to have just one to focus on going forward. Exiting times. 🙂

See you in the new year! 🙂

Categories
Development

Norwegian government open sources travel expense project

The norwegian department of renewal and administration has released an open source solution for managing travel expenses (english translation). This is an interesting event and I hope and think that it is a practice that will be followed in the future.

No doubt, I think it is a terrifying experience for most developers to have to publicly publish their code in such a high profile project. And surely it didn’t take long before someone was picking it apart on Twitter, but that’s just part of learning. Quality review is now free, focus on that. 🙂

What is important now is that this is handled as a living product where feedback is included and others get to contribute. And you will need an active core of developers, so the people that did develop it needs to be kept on payroll for a good while to actively improve the product. Over time more developers will hopefully contribute, but in the beginning the core group is extremely important.

I can’t wait to see more projects like this. It will increase reuse and savings in the public sector, and it will put the code out there for everyone to see and contribute. In the case of consultants beeing hired to develop software for the public sector, they can no longer say that a project was successful because it delivered according to contract. They will also need to deliver quality. The code and system will be out there for everyone to scruitinize. Let’s hope more and more projects get open sourced like this.

Categories
Development

Quicker JUnit Spring context tests in Maven

This is probably fairly well known, but I couldn’t find any doc on it when I searched so I’ll put it up here.

First off: Don’t load your Spring Context in your tests unless you absolutely have to. Some integration tests should load it, but keep it to a minimum. Loading the context is expensive, especially if you load up Hibernate and maybe H2 in that context.

Avoid loading the context is important both for speed and design. I have seen way too many tests where the context is loaded just because someone don’t want to do mocking. Besides, if you have to do a lot of mocking your design is usually too coupled, and should be changed.

So how can you speed up your tests in Maven?

Spring will cache the context and make sure it is only loaded once. But due to details I have not studied; in Maven, this only works for the tests that are in the same suite. It should work with fork=once on the surefire-plugin, but for some reason we need the suites too. Test which one works for you.

Drawbacks? If there is state in your context (database, stateful services) you will have created a dependency between your tests. That’s why, when it comes to database-testing you should use the AbstractTransactionalSpringContextTests which will automatically roll back your changes at the end of your tests. If state is modified in a way that has nothing to do with your database use setDirty() to signal to Spring that the context should be recreated for the next test. Of course then you get the time penalty of recreation.