7 Jun 2012 23:59
Re: Multiple Inheritance
Brad Selfridge <bsselfridge <at> gmail.com>
2012-06-07 21:59:51 GMT
2012-06-07 21:59:51 GMT
It might appear to be overkill until the next poor sap comes along and says - Gee, I would like to change the behavior of Foo and then realizes that if he changes Foo he breaks everything else because it's so inter-linked. I realize that single inheritance, delegation may not make life easier on the creator, but may make life easier on the poor schlub that tries to change functionality when the creator is long gone. I written lots of code (over 30 years) and it's always the maintenance that's the most expensive, not the creation. I don't know how many times I've seen software abandoned or re-written because it was so complex that the developer cannot understand it and therefore is too scared to change it. My philosophy has always been - "keep is simple". If I kept it simple, it survived for years - thereby saving the company a lot of money. -- Brad Selfridge On 6/7/2012 3:47 PM, andre wrote: > Am 07.06.2012 um 20:40 schrieb Brad Selfridge: > >> It seems to me that the example you provided should be implemented in several classes that is wrapped in an manager class. Not sure MI is the best solution in this instance. > Yep, one can do that, but it would require all those "several" classes to be subclassed each, because they would have to share a common state with the manager and provide special methods& patterns to do so: > > - Subclass the "Thread" thing > > - Subclass the "Job Queue" thing > > - Subclass the "Broacast" thing > > - Subclass the "Server" thing > > - Subclass the "OS Events" thing > > - Create a "Manager" class that includes instances of all the above. > > - Write a lot of code that makes all these objects communicate with each other in order to share a common state. > > IMO, that's pretty overkill compared to just clicking LEGO blocks together with MI. Chances are also high that some of the objects may include redundant state information that needs to be synchronized. MI would merge them. > > This is really a fundamental problem for which there is no perfect solution. At the end of the day, OO is only an approximation anyway. > > Andre > >
RSS Feed