From: Foster T. B. <fbr...@ad...> - 2006-01-24 20:07:39
|
David, The simple answer is "programmer's remorse" -- that is, the feeling you get after your code has aged about 6 months that a) it's horrible, b) you were a moron to implement it this way in the first place, and c) given a total rewrite it'd be half the size with half the bugs and twice the features. The long answer is that I was originally hoping the inheritance tree I'd created for the controls would have helped in shoring up some of the more commonly-used functionality into control_t (an internal class from which all the widgets inherit). The problem has quickly become an issue of readability and maintainability. I find that I can't go back in to ui_core_implementation and pick it up very quickly, that the structure in the file (using C++ inheritance) doesn't reflect accurately the structure I'm trying to represent (a bunch of individual widgets). The biggest thing I take issue with is not so much the use of inheritance, but rather the means by which inheritance was introduced into the solution. It was introduced like this: "I'll use inheritance to solve this problem"! And like that -- inheritance was in. I'm not saying that inheritance itself is fatally flawed, and it may turn out in the end that some use of inheritance will prove beneficial to the implementation. The problem is that I used inheritance without really thinking about the problem, and what came about was an implementation that looks 90% "right", but there's some strongarming going on in order to get that final 10% working. A better tack, I believe, would be something of a bottom-up approach. It would involve writing all of the widgets independently of one another, then finding commonalities between the implementations and bubbling them up, hopefully to the point where you can talk in terms of generic concepts about some of them. Another problem we're trying to solve is winning "widget independence". Ralph Thomas has done a lot of work in this direction with the factory code, and we hope to leverage that going forward so you're not limited to "our UI set or theirs" when you are looking to develop the widget set for an app. Inheritance make going in this direction that much more difficult. I hope that answers some of your questions. Blessings, Foster On Jan 24, 2006, at 10:50a, David Catmull wrote: > On Jan 24, 2006, at 10:32 AM, Foster T. Brereton wrote: >> In the current Mac and Win32 implementations we take advantage of C >> ++ inheritance rules to do some of the work for us. In retrospect >> we've found this to be a burdensome way to implement this code, >> and would write it differently if given a second chance. > > I'm curious - why is that? How would you have done it differently? > > -- > David Catmull > unc...@un... > http://www.uncommonplace.com/ > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through > log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD > SPLUNK! > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=103432&bid=230486&dat=121642 > _______________________________________________ > Adobe-source-devel mailing list > Ado...@li... > https://lists.sourceforge.net/lists/listinfo/adobe-source-devel -- Foster T. Brereton <}}}>< Romans 3:21-26 A d o b e S o f t w a r e T e c h n o l o g y L a b "The fact is that the author of STL does not know how to write min, the author of C++ is not quite sure, and the standards committee is at a loss." -- Alexander Stepanov |