Jazoon 2013 – Rocket Propelled Java

25. October, 2013

Jazoon 2013 badgeRocket Propelled Java” is about being more productive by writing less boilerplate code (slides on slideshare).

In his talk, Andres Almiray showed some tools to make your code more compact while keeping or even improving readability.

The first one is lombok and lombok-pg which use Java annotations to generate a lot of boiler plate code (slides 3-6)

Similar, you can use Groovy AST transformations to create things like immutables or singletons correctly (“There are 5-6 ways to create singletons. Only two of them are correct”, slides 7-9)

Note: You might be worried to add Groovy to a pure Java project. You don’t have to. Just use it for the AST transformations to stop wasting time on writing code that only makes your compiler happy. Use Groovy as a “boilerplate code buster.”

If you ever wanted to use “Design by Contract“, GContracts is for you.

Getting Rid of Checked Exceptions in Java

18. March, 2011

So, you’re tired of rethrowing checked Exceptions that you can’t handle? Did you wish a long time ago IOException and SQLException were in fact RuntimeExceptions (as they should be according to Sun’s own definition)? The pain was there but it got kind of dull over the years? Acceptance of the inevitable and all that. How about this:

    public void doSomething() { 
        throw new Exception();

Did I hear a “WTF”? Say hello to project Lombok.

IBM developerWorks has a great article to get you started with your own custom AST transformations.