views:

24

answers:

2

Anyone have advice on the best way to deal with one-off or special case business rules in large complex web applications?

Most of the time the requests come in from sales people that promise things to the customer. So as a simple example, lets say someone is selling Stack Overflow. Then a customer that is talking to a sales rep says "I'll buy one subscription but only if you change the background color on the site to black and when sending me emails I would like you to send to one address when emails come to me between 9-5 and use this other address any other time of the day". The sales rep says yep no problem sir coming right up. And you wind up with code that is littered with a bunch of

if (customerID == 123) { 
    //do something for this customer
} 
+1  A: 

If you are obliged to do these kind of one-off special cases:

Abstract them out (so you can make these special cases easily configurable / stored in one sensible place instead of being scattered hardcoded into your source).

You'll have a structure in place when the next (identical) one arrives then.

ChristopheD
+1  A: 

Definitely start introducing user profiles and attached it to your customer details. Hard coding conditional logic will introduce duplicate code, maintainability and also make your system very fragile. Anytime you need to add/make changes, you have to introduce downtime to your web application. Wouldn't it be better if they are all data driven?

Fadrian Sudaman