Friday, March 5, 2010

Spring EYE on JAVA EE - 2

Simple and Straightforward? Let’s start the fun of real coding.


Before we put in the first line, we need to mention a little about the environment. I set the project structure as following. Most are self-explaining while the web part followings Java EE standard. One thing need to be pointed out is that most of the configuration files are saved under config folder while the folder itself is added in the classpath.




Currently all Java EE platform claims to be full Object Oriented but when put in practice there is always debate of the pure business model vs. platform specific implementation. And comprise has to be made in between. Spring’s approach of POJO returns back to basic, makes it possible to model business in a complete Object Oriented way without concerns of platform limitation.


Five entity class created, exactly follow the class diagram.


Product.java Ignore the annotation for now. Although to make it simple, spec says no need to add/remove product, functions still build in.



Now it is time for testing. I am a strong believer of unit test, though have some doubt against TDD, for TDD in practice some times be put ahead of modeling. Anyway, by taking advantage of Annotation driven JUnit test suit, junit-4.4, testing is straightforward. OrderTest.java indicates a typical unit test class.


ProudctTest.java



Previous    Next

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home