Pure RMI or EJB?
Why use EJB when RMI enables you to easily do the same things without it? The answer depends on many factors, but perhaps a better question is 'why not use pure RMI to work with distributed objects even if your architecture partially uses EJB?' In fact, the example application in the previous section would work much faster this way, since you described practically everything independently.
The EJB framework is sufficient as a general framework that you can use in most cases where distributed components are necessary. And with such general use, its code should carry out many checks and have enough logic layers to solve practically any type of problem that comes up. All this results in significant productivity loss, however. Therefore, if the top priority of the application is productivity, the benefit of pure RMI code makes it the logical choice. Besides, you can always bypass the RMI framework altogether and work directly with the Sockets API. But again, understand that whether you choose RMI or EJB depends almost completely on your needs and the required scalability of your application.