views:

109

answers:

4

I'm working on Java-based server software that needs to be customized for a few, but large customers. A separate instance of the server runs for each customer.

Each customer has sufficiently differing requirements such that different business logics is required for each of the implementations.

At this time, the different business logics is handled by writing separate business logic classes, and having the "core" classes call the appropriate class, depending on the setting in a property file.

I'd like to know how you've designed your software around the needs of a few (but very important) business customers?

Note: We cannot use reflection due to obfuscation requirements.

+1  A: 

You should seriously consider if there's a domain-specific language to be had there.

DSL's have been a big thing in Ruby, but there's certainly no reason you can't do one in Java, or build a collection of classes with a sufficiently "fluent" interface to serve the same purpose.

Ideally, the notation would be simple enough your customers can read and verify their business rules as implemented in the DSL; that gives you the best leverage in terms of getting rules correct.

Implementing one probably implies applying the Command and Template Method patterns.

Also see Martin Fowler's site. Here's an interesting paper on building DSLs in java.

Charlie Martin
What do you mean by domain-specific language?
Jin Kim
@Jin, sorry, I saved a draft before starting to add links. There's a bunch more there now.
Charlie Martin
A: 

We use SOA (Service Oriented Architecture) - the correct service is called with the correct business logic is called according to the client. The locations of these services are configurable from the database.

ck
A: 

I would look strongly at a rules engine (like Drools - although performance can be an issue with what you choose, so you should consider the commercial alternatives as well). Such customers tend to like the configuration ability that a rules engine represents, rather than feeling they have to come back to the developers to adjust the business logic.

Yishai
A: 

Spring is a really useful tool for doing dependency injection; you might find it useful in your needs. Using Spring, you can substitute in the business objects for each of your customer implementations while maintaining a common application framework. Very useful.

McWafflestix