Sure, we all heard of programming patterns such as MVVM, MVC and such.

But that isn't really what I'm looking into as Layout, Data and Logic is already pretty much split up (XML-Layout markup, Database, insert your language of choice here).

The platform I am developing for is hard to maintain over the updated versions and older OSes. The project significantly grew up over the last few months and dealing with different platform versions really is a pain.

For example simply disabling an user interface control for all existing versions took me around 40 lines of code in the logic layer, wrangling around with invocation, delegation, singletons that provide UI handling and so on.

Is there a clean way to keep track of those "hacks" by maybe excluding it into separate classes or even packages? Should I overwrite existing framework code in order to handle my requirements correctly? If so, does that concept have a name?

  • are your different versions point releases? e.g v1.0 v1.2 v2.0 etc. Jan 10, 2012 at 15:20
  • Charles Lambert: How does that matter?
    – fjdumont
    Jan 10, 2012 at 15:47
  • versions could also mean web version, desktop version, mobile version, etc. Jan 10, 2012 at 15:54
  • 3
    Are you asking about Factory design patterns which provide appropriate objects based on run-time configuration (like OS version)?
    – S.Lott
    Jan 10, 2012 at 16:38
  • 1
    @fjdumont I think a Factory pattern is what you want... the runtime configuration would determine the class of object provided by the Factory, so you could get a subclass that overrides methods appropriately for the platform/environment. Jan 15, 2012 at 2:56

1 Answer 1


Inversion of control could help combined with feature toggles. Try to put your hacks into derived classes that override certain bits. Alternatively you can sometimes do with an interface you could implement in an alternative way. Through dependency injection you can 'configure' any client code to unknowingly use your (temporary) hack.

For instance when using a MVC pattern you could derive from a certain controller. Override a method and make it return a different view then it would normally do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.