After so many years of coding in Java, I’ve finally decided that almost universally, stupid (or ignorant) people code EJB’s. Almost every piece of EJB code is nothing more that a data-access layer. Why on earth would you willingly incur the expense of 15 additional stack layers for each call, and the expense of marshaling and marshaling the parameters of each of those calls?
Why? Because then you can load balance the data-access layers across multiple machines.
Databases do load balancing by themselves!
The intention is generally that the business layer will go in the EJB’s and the web / fat-client layer will be a very thin layer that does calls to the EJB’s. Except it almost never works out that way, because most coders are simply to lazy, or figure out theres a huge expense in doing it that way as well (you wind up overloading your network / internet connection with UI related calls). Although with a fat client I can understand the use of an EJB in this way.
So all you ignorant / stupid types, heres what to do:
- Either integrate you EJB’s into your GUI code base and be done with it.
- On a small project, this actually makes things more manageable
- More more of your business logic into you EJB’s
- Changing a users email address on the EJB should send the confirmation email and wait for a “confirmAddressChange” sort of method.