in reply to your definition of KISS

The question that matters:

How much work will you have to (want to) do when you get a 3rd tenant?

Figure there's almost never just two of anything -- and there should probably be an acronym for that. Or if there really will never be a 3rd tenant, ever, then arguably both options are are a waste of time.

The answer for your situation depends on stuff you haven't specified, e.g., how much are the various tenants are likely to differ, how much pain is involved in writing a new class for (1) vs. a new constructor call for (2), or the extent to which it's appropriate that new tenant configuration be data-driven rather than code-driven (which would argue for (2)).

Not knowing any of the details, I would fall back on my own prejudice that I generally find inheritance to be overused (and would thus prefer something like (2))...

... it may seem "simpler" to just define a new subclass so that you can re-use a given piece of code, but if this governs how your hierarchy develops, then you risk ending up with a spaghetti hierarchy that's actually more difficult to maintain, whereas if you take the time to figure out where the code in question actually needs to live (so that it'll be where people are expecting to find it), that makes life simpler in the long run.

And one can, of course, take this too far and waste time pre-designing for cases that are never actually going to arise. YMMV

Replies are listed 'Best First'.
Re^2: your definition of KISS
by klekker (Pilgrim) on Feb 08, 2012 at 09:10 UTC
    Thank you for your answer!

    I agree with you about the "spaghetti hierarchy". They 'inherited' the "spaghetti hierarchy" in some parts already because it is an old legacy project.

    So in my experience it is less difficult to judge if a subsubsubsubclass already contains a special form element or not, if you take the getter-approach (1). And if your IDE is fancy enough, you almost get this information for free.
    At least it is easier to see (for me) than 'subclass removes A,B and adds C, subsubclass removes B again and adds E... now what does subsubsubsubsubclass contain' as described in (2)

    Well, the application design is not really a good example for customer related configuration and I would pursue another and less hardcoded approach, too.

    So regarding this context I should have asked which of these two solutions is less painful.

    And I completely agree: there should probably be an acronym for that! ;)
    k