Skip to main content

Wiring Java Objects Together - the Object Model

Posted by larryjava on July 16, 2012 at 12:29 PM PDT

As we began our Java adventure at Amway Corp 10 years ago,
one of the most important tasks we had to do was to create our Object Model.
We had a variety of Java objects that we were planning to use in our application.
How were they going to be "wired" together inside of the application?

After 4 weeks of Object-Oriented, J2SE, J2EE training; we set out to define our Object Model.
This model was going to guide all of our Java developers during the creation of our application.
It was important that this model be specific enough to be useful, yet "vague" enough to allow flexibility.

The Java objects we had to work with were the following:

Ejb - stateless session beans, "model" of MVC
Jsp - html forms, "view" of MVC
Servlet - "controller" of MVC
Client - for invoking ejbs to perform batch processes

Helper - plain java objects to provide app support functions, business rules, utility functions
Data base access - jdbc\sql code
Data - plain java objects to hold application data that will be passed from object to object

Our first Object Model looked like this:

figure 1 - original model
This model had too many layers, was not very flexible, and was a bad fit for portions of the app.

Our revised model looked like this:

figure 4 - streamlined paths
In this model, helper objects are optional, stateless session ejbs are the "backbone" object for the app.

For web-based portions of our application:

figure 6 - web based model
This model outlined how to develop the screens in our app.

For batch-based portions of our application:

figure 7 - batch based model -
This model outlined how to develop the batch processes in our app.

This Object Model was easily supported by our Java development tool.
We had Java developers with a variety of skill-levels and experiences.
This model provided the common framework from which they could contribute to a common goal: building our application.
Our Object Model was complete. It was time to get to work!

How did the Object Model hold up after 10 years of use and 1 million lines of code?
Very well.
Entity beans were eliminated very quickly from the Object Model.
There have been very few cases where this model was not followed.
Additional objects have been added to this model (to support JMS, web services and external API integration).
We have not outgrown this Object Model. Work on the application continues to this day.
So far so good.

1_-_original_model.JPG47.34 KB
4_-_streamlined_paths.JPG53.82 KB
6_-_web-based_model.JPG45.22 KB
7_-_batch-based_model.JPG38.13 KB