From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public From: "Robert Martin" Subject: Re: Which wastes more time? (Was Re: Software landmines (loops)) Date: 1998/09/06 Message-ID: <6su5ir$co8$1@hirame.wwa.com>#1/1 X-Deja-AN: 388407229 References: <6rfra4$rul$1@nnrp1.dejanews.com> <35DBDD24.D003404D@calfp.co.uk> <6sbuod$fra$1@hirame.wwa.com> <6sebjr$b69$1@nnrp1.dejanews.com> <6sff74$q0s@gurney.reilly.home> <6sh2j5$jnl$1@nnrp1.dejanews.com> <35EC2E5A.16DB6CB1@bigfoot-.com> <6sjc0a$1lk$3@news.indigo.ie> <35EFB09E.15412933@s054.aone.net.au> <35f2bd98.40599408@news.erols.com> <35F06A58.F968BDE1@s054.aone.net.au> <35f48276.90997557@news.erols.com> <35F0C3C9.D1E56FF3@s054.aone.net.au> <6srh67$sj5$1@hirame.wwa.com> <35F1C0B9.8A50CEB0@s054.aone.net.au> <6ssmjd$h0l$1@hirame.wwa.com> <35F20C37.89A79442@s054.aone.net.au> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: WorldWide Access - Midwestern Internet Services - www.wwa.com Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-09-06T00:00:00+00:00 List-Id: Loryn Jenkins wrote in message <35F20C37.89A79442@s054.aone.net.au>... >> >As far as I'm concerned, this flouts basic classification theory. As far >> >as I'm concerned, this is *wrong*. (How can you claim to be programming >> >for reuse, as Meyer so eloquently points out as a fundamental goal, and >> >model things so rigidly? So incorrectly?) >> >> With respect, I think you have our roles reversed. Your position is the >> rigid one, since you are insisting on there being only one solution to this >> problem. I, on the other hand, am suggesting that there are circumstances >> where other models (such as Meyers) may be valid. > >Sorry. I used general person "you" here. "You" might like to read it as >"one". Ooops, I'm embarrassed. I guess I'm just used to confrontational posts. Something I'll have to get un-used to now that I have adjusted my filters. >Therefore: > >> >As far as I'm concerned, this flouts basic classification theory. As far >> >as I'm concerned, this is *wrong*. (How can one claim to be programming >> >for reuse, as Meyer so eloquently points out as a fundamental goal, and >> >model things so rigidly? So incorrectly?) > >> Writing a book is one of the hardest things a human can do. It is harder >> than writing software, believe me. Writing a book of *significance* (for >> which OOSC2 certainly qualifies) is even harder. > >Yes, I agree with this. So many points Bertrand makes are so valid. Thus >the (minor) imperfections stand out even more. > >> So I am not going to >> complain too loudly about an imperfect example. I am more likely to >> complain about his rather flippant criticism of Somerfield; which I think >> detracts from the credibility of the work. > >Perhaps, perhaps not. It is clearly an example of inheritance "done >wrong". Agreed. > >> Be that as it may, the example in question is not incorrect as it stands. >> It's just not correct in all, or even most, contexts. > >Hmm. True. (That I've already granted previously, I believe.) > >Perhaps you may agree with me if a took a little weaker position, and >claim that Meyer would have been better off choosing an unambiguously >correct example. (And provided evidence of the context that makes is >unambiguously correct. After all, if he dropped the Somerfield >criticism, he'd certainly have the page count for it.) Yes, that makes sense. >By the way, can you conceive of a situation in which it would be >incorrect to model a role of some class using the Role Pattern? (Just >wondering, because whenever I come across a situation like this, I >reflexively reach for this 'tool'.) Have you ever seen the game program "Sim Tower"? This is one of those interesting simulation programs. You are the manager and architect of a skyscraper. You must put rooms, lobbies, elevators, restaraunts, condos, etc, etc, into the building. Simulated people are attracted to the building by your amenities and they either buy condos or rent hotel rooms. You slowly grow the skyscraper, floor after floor, adding more and more amenities while more and more people use your services. The process of growth is delicate. If you over invest, or if you do not provide the right ratio of amenities, or if you under spend on maintenance, people start to move out, your income base crumbles, and you face a downward spiral. Now, the simulated people come in many forms. Lets consider two, the breadwinners and the homemakers. In the morning the breadwinners take the elevators to the garage where they drive to work, whereas the homemakers use the amenities of the skyscraper to buy groceries, etc. etc. These are certainly two different roles. However, in the context of the simulation, the objects are born and die in that role. Therefore it would not be incorrect to model this with a PERSON base class and with BREADWINNER and HOMEMAKER deriving from PERSON. Indeed, since we have to deal with thousands of these little objects, we will be strongly motivated to eliminate the pointers and delegations that a ROLE relationship implies.