How to separate and maintain customer specific code

Posted by WYSIWYG on Programmers See other posts from Programmers or by WYSIWYG
Published on 2013-06-26T21:27:43Z Indexed on 2013/06/26 22:29 UTC
Read the original article Hit count: 170

I am implementing customer specific code and currently following simple approach like if (cusomterId == 23) do it. I want to separate out all the customer related code in separate place. But I have following problems.

In code is in 1. Stored procs 2. Plain old classes. 3. Controllers 4. Views

I came up with two solutions.

First is to create table CustomerFunctionlity with columns CustomerId, FunctionalityName, method/Proc, inputs/outputs

With this table I can simply check if exists, execute given function.

Another way is creating a factory which returns customer related object for an interface.

I am writting small end to end customer specific functionalities. How can I write maintenable code.

Thanks

© Programmers or respective owner

Related posts about design-patterns

Related posts about object-oriented-design