O'Reilly logo

Building Java Enterprise Applications by Brett McLaughlin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Business Layer

Next in the design process is the task of creating a business layer. This portion of the application is wedged between presentation (what the user sees) and data (what the application depends on). The business layer, then, does just what it implies: it performs business (logic). Data on its own is rarely relevant, and often makes no sense without some context applied to it. In the same fashion, the presentation layer must have something to present (no rocket science here!). In this business layer, then, data is manipulated, transformed, and converted into content suitable for presentation.

The core of this layer is the code that actually executes business logic. This code maps to a company’s business processes; in the best case, a single module of code represents a single business process. These modules can then be called to obtain a client’s outstanding balance, for example. This figure is rarely stored in the database, but instead is calculated from the client’s purchases subtracted from his or her assets. This allows the raw data to be masked from the presentation layer of an application; instead of asking for data and performing calculations, the application needs to request only the business process that results in a client’s account balance, and format the result.

Business Logic

With entity beans in place for handling data access to most of our application, it makes sense to continue to leverage EJB for the business logic in our application. In this case, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required