Distributed Object Architectures
To understand EJB, you need to understand how distributed objects work. Distributed object systems are the foundation for modern three-tier architectures. In a three-tier architecture, as shown in Figure 1-1, the presentation logic resides on the client (first tier), the business logic resides on the middle tier (second tier), and other resources, such as the database, reside on the backend (third tier).

Figure 1-1. Three-tier architecture
All distributed object protocols are built on the same basic architecture, which is designed to make an object on one computer look like it’s residing on a different computer. Distributed object architectures are based on a network communication layer that is really very simple. Essentially, there are three parts to this architecture: the business object, the skeleton, and the stub.
The
business object
resides on the middle tier. It’s an instance of an
object that models the state and business logic of some real-world
concept, such as a person, order, or account. Every business object
class has matching stub and skeleton classes built specifically for
that type of business object. For example, a distributed business
object called Person would have matching
Person_Stub and Person_Skeleton
classes. As shown in Figure 1-2, the business object and skeleton reside on the middle tier, and the stub resides on the client. ...