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

Posted on 2006-04-24
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, 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
    LVL 9

    Accepted Solution

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    object oriented javascript web form 8 48
    wordlen challenge 3 26
    Permutation and Combination 9 23
    White board coding practice 3 23
    A short article about problems I had with the new location API and permissions in Marshmallow
    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.
    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 …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now