Posted by larryjava
on June 23, 2013 at 11:19 AM PDT
As a developer, when you are building and/or designing a Java application;
the first (or one of the first) question you might ask is...
"What are the objects?"
This seems to be a very simple question. But it is not.
There probably is no single "right" answer to this question.
Nevertheless, careful consideration given to this question will contribute to
a good start to one's Java development efforts.
In our case, we attended "formal" Java training classes (lectures, labs, etc).
In those classes, we often saw examples of Java objects named
"animal", "cat", and "dog". Useful in class. Not very useful in real-life!
We learned to use nouns or pronouns for the names of objects.
We learned how to make a verb into a noun to name our objects.
For example, "controller", "processor", "runner", etc.
We also learned about analysis objects and candidate objects during UML training.
We realized that when you define a name for an object, you imply functionality and scope.
So we had some basic know-how about defining and naming objects.
But applying all this wisdom to a "real life" example was not easy.
When we considered how to build our Java application; we talked about
business requirements, the user experience, and application functionality.
We discussed business practices, application logic, and application processes.
We also talked about data. We had lots and lots of data conversations
(transactional data, persistent data, customer data, etc.)
But after all the talking, we still asked ... "What are the objects?"
One business process we had to build as part of our Java application did the following.
"Take a file containing transactions to customer data and use it to update the customer database.
Create an audit trail of the updates performed to the customer data."
This was our customer file reconciliation or balancing process.
So what are the objects? Customer...perhaps. Updater...maybe. Transaction...close.
We finally settled on the following object names for this process.
BalancerController, BalancerCustTranCompare, BalancerTransactionOnly, BalancerTransactionMissing,
BalancerCustomer, BalancerTransaction, BalancerAudit
Once the main objects were defined, we had a good start to developing
this part of our Java application.
Names are important. Naming is a skill and an art. Names in Java are very important.