Skip to content


Experiencing Spring WebFlow, part 2

One of the most cumbersome work when developing an application is to debug when errors have occurred. Creating fail-fast applications helps us keep debugging to a bear minimum. This takes us to the second part of my Experiencing Spring WebFlow course.

2. Go For Fail-Fast

Spring WebFlow makes use of ParameterMap to represent the state of the scope’s. They could easily just exposed a Map interface.

ParameterMap’s gives us neat getRequiredXXX methods that let’s us implement Fail-Fast easily. If you rely on a certain object to be in the scope, you should use these methods instead of the normal ones. The getRequiredXXX will throw IllegalArgumentException when the object was not found. This is a far better representation of the error, then a NPE a couple of lines down. Sometimes you don’t really act on the object, but pass it on to let’s say your DAO layer where the exception could be a lot more obscure.

Fail-Fast is a design method that could be incorporated in nearly any method/class. An excellent read about this can be found here.

Posted in Spring, WebFlow.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.