Entity Control Boundary

Entity Control Boundary (ECB) is popular design pattern. I read in book by Adam Bien.
Below is the extract from "Real World Java EE Patterns" by Adam Bien -
"a boundary exposes the interesting functionality, coordinates independent Controls and hides irrelevant details".

Its not like many dead design patterns (Service facade, Business Delegate), and suits well to microservices designs.

I got a project for travel company. Category is like beaches, hills, etc. Destination is place like maldives.

A service (boundary) provides list of categories and hotest destinations in that category.

Entity - Category, Destination, etc.
Control - CategoryController which provides CRUD operations on Category and other operations.
Boundary - Some class with operation "HotDestinationsWithCategory"

No doubt now the most widely used design pattern is ECB (Entity Control Boundary). I am equivocal to some extent and I will say: Its straight, simple and everything. Yes to some extent that's true, You can design smallest to biggest enterprise application using this simple design pattern, and nothing else.

Even if you are not interested in JSF, lets asume its server side java code, which allows user to perform CRUD operations. I got entities, they are related, but I have one controller and one boundary for each entity, separately. We can have "One entity, one control, and one boundary", "Second entity, second control, and second boundary", and so on. Right now everything is in one package, but we can place each combination(entity, control, and boundary) in separate package(jar or even war). But generally boundary will involve multiple controllers.

I am working on an application, called Visit,and below are some classes I have generated (yes you heard right, generated, because I use Netbeans)..;)

In above generated classes, Category is entity and CategoryController is the controller.
If in case we need to write business logic and create business methods, we will use and combine multiple controllers. 


Popular Posts