Xref: utzoo comp.lang.c++:8738 comp.software-eng:4010 Path: utzoo!attcan!uunet!aplcen!samsung!cs.utexas.edu!mailrus!news-server.csri.toronto.edu!torsqnt!lethe!yunexus!ists!pi19!larrym From: larrym@pi19.pnfi.forestry.ca (Larry Marshall) Newsgroups: comp.lang.c++,comp.software-eng Subject: Re: Project experience with C++ Message-ID: <1030@pi19.pnfi.forestry.ca> Date: 1 Aug 90 11:32:40 GMT References: <812@agcsun.UUCP> <222.26a42b7d@astro.pc.ab.com> <13038@yunexus.YorkU.CA> <294.26b56ac2@astro.pc.ab.com> Organization: Forestry Canada, Chalk River, Ont. Lines: 20 klimas@astro.pc.ab.com writes: > trying to be conveyed is that developers of large systems using > C++ seem to feel that their code is more modular than straight C and > hence its a better C. Whether C++ is a better OOP than > one of the other languages I am not going to initiate yet another > language war, I believe that a process of evolutionary natural > selection will resolve the winner much more conclusively than any > articulate debate will. I'll begin by pointing out that there is no such thing as "evolutionary natural selection". Evolution is an outcome; natural selection is one of the processes that causes it. Since learning C++ is often a struggle because we must start thinking about "things" rather than emphasizing "processes" we need to keep those things straight here (grin). But evolution is not really the reason I'm writing. Rather I'm here to ask about the design struggle. 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