Session Façade v Business Delegate

Business Delegate
The business delegate and session façade patterns are similar, but their motivations are different.

The business delegate motivation is to decouple the presentation/web tier and the business tier. When you make changes to the interface of objects in your business tier, the changes can be handled in the business delegate–without requiring the deployment of an updated presentation/web object.


If you are trying to decouple the presentation/web and business tiers, you will implicitly be using a business delegate pattern to do it.

Business Delegate is to reduce coupling between client and business objects. One of the basic example is, if you use a method from business object in your clients, let say in 10 servlets, if the method signature changes on the business object, you have to change in all(10) your client places(of course, IDE can easily refactor it, but it will be complicated if the project is very big). To avoid this, have a layer of classes/interfaces which have the methods corresponding to each business object.

Session Façade
Facade(s) act as common entry points to business services. They also help reduce network traffic by eliminating the need for the clients to invoke multiple fine-grained methods.
Business delegates( and delegates in general ) provide a clean way for the clients to interact with the service layer. They hide complex things such as service lookups, error handling, remoteness of the service etc. They can also implement additional services such as client caching, thread synchronization, service selection and request routing.

 


Session Facade is to reduce the number of network calls made from client to business objects. As you said, if you implement the business logic in your Business Delegate layer, you will be making multiple fine grained calls to your business objects to complete a Use Case. Network calls are expensive and must be reduced. So instead of implementing the business logic in clients, implement it in business object layer and send required data as a bundle(coarse grained).

The session façade motivation is to simplify the interaction between presentation/web tier and the business tier. For example: If you had three business objects that had methods named cutTheGreenWire, cutTheBlueWire, and cutTheRedWire, your session façade object would like have a method disarmTheBomb that took care of whether or not each method was called, the order in which those methods were called, the time between each method call, and so forth.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s