Changes between Version 2 and Version 3 of DependencyInjection


Ignore:
Timestamp:
Apr 25, 2008, 9:19:07 AM (11 years ago)
Author:
fake51
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DependencyInjection

    v2 v3  
    3131Now imagine we decide to replace the PPostHandler with something else, that works differently, and has a different classname. We now have to change all the 255 occurances.
    3232
     33* or do you? You could ALSO just change PPostHandler and have it forward the new object you created. In essence, what you're assuming is that we would HAVE to change all 255 occurrances - but that's obviously not the case.
     34
    3335=== Side effects ===
    3436
     
    3638
    3739Now imagine something goes wrong with the object - then we would have to check all the different places where the object is modified.
     40
     41* This is more of an issue but it does NOT mean that Singletons or Registrys are bad designs. What it means is that you have to use them right. So, if you allow code outside a singleton to change it's vars and all other code  depends on it, then log the change. Again, problem solved: you could have a debug function (to switch on or off) that outputs the state of the Singleton on every change, this would also solve the problem. There isn't any basis for assuming that singletons mean we blindly have to look through every piece of code that references the singleton - that is only the case if we implement the singletons badly.
    3842
    3943== Solutions ==
     
    182186
    183187
     188=== Solution VII: Keep most of the existing singletons, but implement logging, debugging and restraints ===
     189
     190Make sure that no vars in a singleton can be changed without it being logged (all vars from a singleton should be fetched by a function).
     191Implement logging of functions that change vars in the singleton.
     192Implement some debugging to allow output on change on vars in the singleton.
     193
     194Upside: you keep the singletons we have now, thus no problems with breaking code.
     195
    184196== Action Plan for BW-Rox ==
    185197