• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

Design ideas for this situation... should I use a design pattern of some sorts?

Okay, here is a situation that I have at work. The way it's designed now sucks bad, so i'm trying to re-design it so it's a lot more object oriented. I'm just in need of some opinions. This is purely an architecture question

Here it is:
In our application there are different situations when a user needs to submit data to an attorney. For example, the user might submit sales information, or the user might submit Cure information. There are other situations like this, but we'll take these 2 as an example.

What happens is when the user submits, say, sales information, 4 or 5 values are sent through a web service and that web service calls a stored procedure to store those values into the attorney database. There are 2 or 3 different attorneys that all use instances of this database. So CMS uses this database (it's called FIPS) and HAS also uses FIPS, but these attorneys are in different locales so my web service has to determine which attorney to submit this data to. This is done via a value on the client end. If the value is "CMS" then the IP address for the web service is xxx.xxx.xxx.xxx, but if the value is "HAS" then the web service IP address is yyy.yyy.yyy.yyy There can be any number of attorneys that use this "FIPS" database in the future, so this needs to be flexible. IE: when a new attorney signs up and uses the FIPS database, I don't want to have to go to every client and write some conditional logic to accomidate for the new FIPS user.

There is one other situation. Some attorneys don't want to use FIPS but they want an email to be sent when the client submits data (for example, sales data). So if the value in the database on the client end is "OSB" the an email needs to be sent to that attorney instead of pushing data through a web service.

1.) User clicks Submit Sales Information
2.) Is this an "OSB" attorney?
3.) If so, then generate an email and in that email include the 4 or 5 sales related fields
4.) If not then get the attorney code ("CMS", "HAS"...etc)
5.) Based on the attorney code set the IP in the web service to the correct IP and submit data directly into FIPS (database)

This can all be done rather easily using conditional logic (which is how it's setup right now) But I am aiming for a really flexible solution. One that allows me to submit other data in the future with relative ease (ie: right now we might not submit Withdrawal information to the attorney, but it could happen in the future) Also, when a new attorney uses the FIPS database I want it to be as easy as possible to add this new attorney.

Any ideas on design patterns, or any other suggestions? I am open to anything.

1 Solution
gabesoSolution ArchitectCommented:
Sounds like you need a workflow engine in there to handle asynchronous processes - i.e. fire-and-forget calls to services. Then all of the logic can be re-implented as workflow logic.

e.g. On some service call, check this and that and if this condition is true then send an email here, run this process and exit, otherwise notify accounts department.

Then all of this 'conditional logic' can be centrally managed.

Look at (open-source Java):

and (Commercial .Net):

and (open-source Java):

In fact if you are thinking about doing it 'properly' you may want to start thinking about a jboss based architecture.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now