[Last Call] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2006-04-24
Medium Priority
Last Modified: 2010-04-17
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.

Question by:PoeticAudio
1 Comment

Accepted Solution

gabeso earned 2000 total points
ID: 16528290
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.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Simple Linear Regression

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question