Lukasz Lysik
Lukasz Lysik

Reputation: 10610

Design patterns for sending updates to external system

I'm currently working on refactoring one application. It is an application for a leasing company. The application comminicates with external systems via web services. Some changes in the state or some events require to call external system. We have two types of calls:

The design of the application was not prepared for the growing number of the external system (in every release we add at least one system). We have one layer (Logic) which handles all the bussiness logic and also communicating with external systems (which consists of building request, validating request, sending message, validating response, handling response).

I would like to separate the communication part from the bussinness logic part. What design patterns are good in this situation? I have read the Design patterns @ sourcemaking.com, and also Catalog of Patterns of Enterprise Application Architecture @ Martin Fowler's but either there is nothing I can use or I don't see the way I can use it (most likely it is the later :-) ).

Upvotes: 1

Views: 1460

Answers (2)

Bull
Bull

Reputation: 701

I would suggest try using the mediator pattern ...i took this from your reference urls. http://sourcemaking.com/design_patterns/mediator I think this can easily solve the problem of spaghetti code, since too much communication logic is intermixed with biz logic.

Please let me know if this helps :)

Upvotes: 1

Augusto
Augusto

Reputation: 29857

Hexagonal architecture all the way! :) - http://alistair.cockburn.us/Hexagonal+architecture

It's a great way to separate your business logic from the way your application receives and sends events to the external world.

The Hexagonal Architectural pattern might be a bit too high level, so I usually suggest to read the Dependency Inversion Principle before, to understand how the model should expose interfaces that are later implemented by the adapters.

Upvotes: 1

Related Questions