Monday, July 26, 2010

Bhub: building a Business Hub

I have come across this term after long discussions with some coworkers in the last 5 years. As I study business necessities, create architectures and work together with developers on the implementations I am now so convinced about the power of this solution that I feel the need to share my experience.

A Business Hub (BHub) is an entry point to your business services. It is all about APIs. No business rule is excempted from this. Everything you can use from a web application must be available from APIs so that any other application can consume such a service. It is just the MVC pattern applied rigorously. BHub services are not necessarily SOA and actually in my implementations far away from SOAP. The services in a company are entities that accept input variables and provide output variables similar to what a quadripole* does.

Such a simple concept. What do you do with the output variables? Of course you use them. In Web development most likely you will use them from a Controller that later will use a View to render some kind of markup (site HTML). Of course you will use sometimes JSON or XML from Javascript, CSV from Excel and the list goes on.

In a BHub your Controller acts as a quadripole as well. It is in charge of processing input variables which might come the REST, XML-RPC, SOAP (you name it) way. It is again in charge of generating output variables (In a Java world just response attributes).

In a BHub your View decides how to format the response variables. The same entry point to all your business services, the very same logic is applied, the same response variables are generated but the final result depends on the consumer: PC, home appliance, a partner application, mobile devices, spreadsheets, email, printer and more.

Flow or user states of course are reused as well. No matter if you use add-hoc code, Drools, JBPM, or custom Rules Engine your stateless controllers will become stateful at some point but that should never affect the final result: Your quadripole must always return output variables in an idempotent way. Your backend must be in charge of all validations and other business rules.

BHub is MVC with an important statement: the architecture must be reusable and View-agnostic.

So next time you pick your framework be sure you can configure it to get your BHub up and running with minimum effort. You will have no problems exposing business logic at any possible level.

* Thanks to Hector Gessa, my scientist friend, for the quadripole analogy.

No comments:

Followers