Xref: utzoo comp.lang.c++:8823 comp.software-eng:4029 Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!abvax!iccgcc!klimas From: klimas@astro.pc.ab.com Newsgroups: comp.lang.c++,comp.software-eng Subject: Re: Project experience with C++ Message-ID: <350.26bd5757@astro.pc.ab.com> Date: 6 Aug 90 16:41:11 GMT References: <812@agcsun.UUCP> <222.26a42b7d@astro.pc.ab.com> <13038@yunexus.YorkU.CA> <294.26b56ac2@astro.pc.ab.com> <1030@pi19.pnfi.forestry.ca> Lines: 37 > I'm fairly new to C++ and often find myself struggling with the "old ways" > while trying to implement the new. This often occurs when I need to do some > rather simple task that, by appearances is unique to the situation at hand. > I'm wondering if others have run into this problem and do you solve them by > writing straight C to solve these problems or is there a better way. > > An example of this came up the other day. I needed to read a simple text > file. > Each line needed to be parsed and actions taken elsewhere in the program > depending upon what was found. Of course this problem is trivial but it > serves as an example. Should I write a class to do this? Should the class > be a text file class, a "line" class, a parse class, ... ??? Since the > parse is unique (I was looking for two different words) should I build a > virtual class and derive something unique to that parse or pass the two > words to a more general parse class? Possibly you can see why I'm doing > so much head scratching. All of these solutions would require me to write > a lot more code than the simple, unique parse function required in ANSI C. > That's ok if I end up with something re-usable but I have a hard time > "seeing" that in cases like this. Any edification you could give a an > old evolutionary biologist who's strugglng to learn this new paradigm would > be appreciated. > > Larry Marshall > Petawawa National Forestry Institute > Chalk River, Ontario K0J 1J0 The above phenomena is not unique. The paucity of good stable C++ class libraries has often been cited as one of the difficulties of learning OOPs with C++ and is a prime example of why some institutions are requiring people who want to develop in C++ to first become familiar with OOP via Smalltalk. The Smalltalk class library provides a good library of examples of how the C++ classes might be organized for a particular function. The best C++ programmers I know learned OOP from Smalltalk initially and then transfered their experiences to C++.