Open minds leads to freedom

Communicating my thoughts on software development

Bean Validation – Emmanuel Bernard on JSR 303

Posted by rnaufal on 22nd March 2009

JavaLobby released an interesting interview with Emmanuel Bernard, the spec lead of of JSR-303: Bean Validation..

One of the important goals of the Bean Validation spec is, as Emmanuel Bernard says, is

to provide a default runtime engine that is used to validate the constraints around the domain model, in Java.

The development team decided to use annotations to express the constraints applied at the domain model. They argued that with annotations the constraints are put directly at the properties in the code, expressing the constraints associated with the property.

I highlighted some interesting parts of the interview:

Bean Validation lets you standardize the way you declare the constraints. So an application developer will just know one way to declare constraints, and just forget about all the different models. There’s no duplication around the validation on the layers.

If you think about a constraint, a constraint is really some kind of an extension of the type system.

Bean Validation lets you validate an object graph using the @Valid annotation. Basically saying, ‘Well, when you validate this object, make sure the associated object is validated as well.’ By the way, even if Bean Validation is primarily annotation focused, there is the equivalent in XML.

Any framework that is having a need to use validation, to apply validation, can either use the runtime engine of Bean Validation or go extract the metadata and play with that. So the user declares it once, in one place, and every framework in the Java space can actually go and either apply the validation routine …

You can listen the podcast of the interview also. It’s very noteworthy to read or listen the interview and see what’s next on validation in Java. Before the Bean Validation API become public to all of us, which framework do you use to validate constraints on the Java platform?

Tags: , , ,
Posted in Uncategorized | 2 Comments »

Google Guice, dependence Inversion in the Java way

Posted by rnaufal on 3rd June 2007

Check out this great video about the new Java based inversion control framework from Google. The guys Kevin Bourillion and Bob Lee explains the concept behind dependency inversion principle (dip) and the core features inside Google Guice, called ‘juice’. The framework embraces and uses annotations instead of string identifiers (heavily used in Spring) to inject dependencies into the code. The most interesting feature is that Guice injects constructors, fields and methods (any methods with any number of arguments, not just setters) . You can also integrate Spring with Guice. Enjoy!

Tags: , ,
Posted in Uncategorized | No Comments »