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=0.1 required=5.0 tests=BAYES_05,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,7f8fc37d854731d6 X-Google-Attributes: gid109fba,public X-Google-Thread: 1108a1,7f8fc37d854731d6 X-Google-Attributes: gid1108a1,public X-Google-Thread: 10461e,7f8fc37d854731d6 X-Google-Attributes: gid10461e,public X-Google-Thread: 114809,7f8fc37d854731d6 X-Google-Attributes: gid114809,public X-Google-Thread: 103376,7f8fc37d854731d6 X-Google-Attributes: gid103376,public From: malak@access5.digex.net (Michael Malak) Subject: Re: Interesting but sensitive topic to discuss (HELP: - OOP and CASE tools) Date: 1996/11/20 Message-ID: <56v4kc$89k@access5.digex.net>#1/1 X-Deja-AN: 197646936 references: <32813322.41C6@kyebek3.kjist.ac.kr> <32891BA4.4AA5@concentric.net> organization: Express Access Online Communications, Greenbelt, MD USA newsgroups: comp.object,comp.lang.c++,comp.lang.ada,comp.lang.smalltalk,comp.ai Date: 1996-11-20T00:00:00+00:00 List-Id: In article , Robert C. Martin wrote: > >Sure. Imagine a program that trasmits files between computers using >modems. That program could deal with lots of different kinds of modems in >several different ways. It could use a switch statement every time it needed >to interact with a modem, choosing the correct modem each time and executing >the right code. Or it could create an abstract Modem class and then create >derivative for each type of modem. > > [snip] > >This is an architectural choice; and it is based upon which kind of change >is more likely. If it is more likely that new functions will be added to >existing modems, then the switch statement is probably the better choice. >If it is more likely that new kinds of modems will be added, then the class >structure is probably better. THANK YOU! for confirming my conjecture. I posted this idea a few weeks ago on comp.lang.c++.moderated to see if it was valid, and I got blasted. Response 1: Use templates My unspoken response: I still have to write a bunch of functions for every new method I wish to implement Response 2: Arthur Reil's book says you're in danger of creating a "God" class My unspoken response: none, since I don't have the book Response 3: This is the Visitor pattern; buy the Gamma book My unspoken response: Yes, I have the Gamma book, and yes, I was familiar with the Visitor pattern, but the Visitor pattern looked too complicated to achieve what I wanted. As "bad" as "switch/case" is, it appears to minimize the complexity in this situation. I was just a meek C++ student back then, so I didn't post any responses. I put those bad old thoughts of "switch/case" out of my mind. If you are interested in seeing the thread, search for this message ID in DejaNews: <54titl$imt@netlab.cs.rpi.edu> -- Michael Malak Home: malak@access.digex.net Washington, DC Work: malak@notes.sonix.com