Friday 14 November 2014

Separation of Business logic and Integration logic


Most of the large Integration projects comprise of multiple teams like service teams, UI teams and Integration teams. When a certain complex business capability is being built it would be composed of business logic , application logic and integration logic which then would picked up by the respective teams for implementation. However in real world situations often there is ambiguity on this as there no clear definition within the enterprise of what constitutes a business logic or a integration logic.In fact, the choice may depend on the nature of the enterprise or even a particular situation within the enterprise



We can define Business logic as the logic that refers to the business process requirement which will be used to generate an output or consume an input. Business logic ideally resides in the end systems.


An Integration Logic on the other hand refers to the transformation and modification requirements which arise when different systems communicate with each other. Integration logic is typically owned by IT.


To distinguish between the two better one must understand the difference between syntactic logic and semantic logic.

Business logic creates, reads, updates, or deletes the semantics associated with achieving business goals. Conversely, integration logic only modifies syntax associated with achieving the necessary inter connectivity.

Let take an example where you order a pizza and your order is routed to to nearest branch based on your geographical location. Each branch implements its own version of OrderPizza sevice (Say they were separate pizza delivery stores which have been bought over by large pizza chain)

Some of these services take your postcode as <Postcode><number>1234</number><letter>AB</letter></Postcode> where as some simply take <Postcode>1111AB</Postcode>
This is typically a syntactic logic and needs to be solved in Integration layer. A semantic logic on the other hand would be that if the pizza is not delivered within a stipulated time you get a discount as this logic is related to the core business. 


However now lets look at another situation. The pizza ordering system must now check if the nearest pizza store is closed and if so it must place the order to the next nearest one or the next one till the distance between delivery point and the pizza store exceeds certain specified distance. 

Though this does not change  the semantics of ordering the pizza but this logic is associated with a business rule and not merely an IT logic.  Moreover it cannot be realized by one service provider as the granularity of the business task is larger than any one provider interaction offers.

For such task the Integration layer must be further be split into ones that IT owned non-semantic logic and Business owned non-semantic logic. Typically the former is realized through ESB and later though a orchestration layer. A good architecture should make clear separation of these responsibilities.