The Facade Layer
The Facade Layer
A facade is an abstraction layer that provides a simplified interface to the underlying implementation.
In previous sections, you saw that SAP Commerce generates Java model classes that represent the different types of item that are stored in the database. These model classes are what you pass as arguments to the different Java services in the SAP Commerce service layer. Nevertheless, there are occasions when the model classes become unwieldy:
- When you need a simpler or more convenient format for some of the data to display in JSPs
- When you need a serializable set of objects to send to another system
- When you want to prevent client code from modifying attributes in a model class object directly
In these cases, you need a simpler representation of the data in the model classes. This representation is the purpose of the Data Transfer Object. In addition, if there is a common sequence of method calls that a client must make against a service object, it makes sense to combine the sequence into one call. You make these simplified calls with a facade object.
Facade classes help simplify the calls made to your service classes. They use simpler plain old java objects (POJOs) as argument and result objects, instead of SAP Commerce model classes. In this step, you create a new BandFacade class.
Comments
Post a Comment