Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: c,c++5,c#.

Author: Omid David Tabibi

Date: 14:38:18 08/11/04

Go up one level in this thread


On August 11, 2004 at 15:15:11, Bo Persson wrote:

>On August 11, 2004 at 12:47:43, Anthony Cozzie wrote:
>
>
>>5 weeks C
>>  1 week syntax, types, & printf/scanf
>>  1 week loops and conditionals
>>  1 week arrays & pointers
>>  1 week strings & string libraries
>>  1 week structures
>>3 weeks C++
>>  1 week classes
>>  1 week inheritance
>>  1 week polymorphism
>>
>>which I believe would fit a 1 semester class, if I did my math right.  Assembly
>>is so simple that it practically teaches itself, C is incredibly simple when you
>>know assembly, and C++ is C with a few decorations.
>
>Others argue (intensely) that if you want to learn proper C++, you have no use
>of learning C first. C++ is not just a few decorations, it is an entirely new
>language which requires a different mindset.

When I quote Dijkstra saying "object-oriented programming is an exceptionally
bad idea which could only have originated in California", and I say there is
something in what he said, this is what I mean. You can easily get carried away
by all object oriented things in C++, and throw away C. Sometimes I read C++
code that has so many levels of inheritance that it just drives me crazy (not
speaking of multiple inheritance which is a weapon of code destruction). You
read one class, but oops, it is derived from another. So you go look at that
one, but that is also derived from another class, and so on...

When I write C++ code, I use a simplified set of OOP features. For example, I
never use multiple inheritance, and try to avoid more than one level of
inheritance. And of course I avoid as much as possible expensive C++ features
which slow down the program terribly (BTW, I think only a good C programmer can
write fast C++ code). And I use OOP only when needed. For example my chess
program is in *.cpp files, but is almost entirely written in C.

When you view *every* problem with OOP glasses, that is when hell can break
loose...


>
>*Very* experienced C++ teachers Koening & Moo chose this order for their
>"Accellerated C++" book:
>
>Chapter 1 String literals
>Chapter 2 Looping and counting
>Chapter 3 Working with bathes of data
>Chapter 4 Organizing programs and data
>Chapter 5 Using sequential containers
>Chapter 6 Using library algorithms
>Chapter 7 Using associative containers
>Chapter 8 Writing generic functions
>          (templates and iterators)
>Chapter 9 Defining new types
>          (classes, constructors and stuff)
>Chapter 10 Managing memory and low-level data structure
>           Here, finally, the pointer is introduced to explain array,
>           using the famous words: "A pointer is a kind of random-access
>           iterator that is essential for accessing elements of arrays, and
>           has other uses as well."
>
>Here the novice C++ programmer already knows about iterators, containers,
>overloaded functions, the standard library, templates, and classes. He knows
>nothing about pointers, printf, or scanf, or strcpy! And doesn't need to.
>
>Pointers are introduced just so the authors will be able to explain some strange
>things about arrays.
>
>
>C++ can be seen an entirely new languange, not just some fancy C.  :-)
>
>
>Bo Persson



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.