Tuesday, August 7, 2007

What is Model Driven Architecture?

Why should anyone write getters and setters? I know that it's been made simpler in Java 5, but the whole idea of getters and setters is annoying. Another big annoyance is Object Relational Mapping, but (thank god) we've got Hibernate for that now. Still, you have to write an HBM file for hibernate and you need an object to do that but it helps.

Then you have to worry about the Object XML Mapping. Ug. You could try using JAX-B or another binding technology, but that's not so much fun.

Now you've got documentation to worry about. But now you've got HTML, Java, XSD/XML, and HBM all describing the same freakin' object! That's redundant and boring to write.

The solution:
1) Write your object definitions as XSD using Eclipse:Europa's very nice XSD editor.
2) Use that XSD, to generate EMF which will give you Java objects.
3) Use the Teneo eclipse plugin to generate your HBM objects!
4) Oh! You defined with XSD, so the object to XML mapping is already done!
5) Need documentation? Use the documentation annotations in the XSD and all the code will be commented appropriately! You can even use eclipse tooling to generate beautiful UML diagrams out of the XSD files!

So as you can see, all of this work was driven by the model. Thus, Model Driven Architecture.

(I'll come back and add links to all of these things in later posts where I'll spell out each step one at a time)

No comments: