should i learn it first ?
G. Sumner Hayes
sumner-nntp5 at forceovermass.com
Mon Mar 11 13:12:04 EST 2002
In article <a6gfo6$b3e$0 at 216.39.172.122>, Bengt Richter wrote:
> On Sun, 10 Mar 2002 17:13:17 GMT, "G. Sumner Hayes" <sumner-nntp5 at forceovermass.com> wrote:
>
>>In article <a6f0fl$u8n$0 at 216.39.172.122>, Bengt Richter wrote:
>>Ugh, I can see learning Python first but definitely learn C before
>>C++. In that order, you won't have to unlearn patterns of design
>>you absorb solving problems with C++.
>>
>>Seriously, the point of using a low-level language like C or C++
>>is to get next to the hardware, and it should be learned from that
>>level first IMO. Otherwise, stay with a more productive language
>> like Python.
>>
> If you are just going to use the low level stuff (unless you are
> talking about assembler within C++), you might as well use C.
Exactly my point.
> ISTM C++ was designed to let you *build* "levels" with layers of abstraction
> through objects and generics.
And IMO it's a really bad language for _learning_ those techniques. Learn
Python and C first, get a clean understanding of C, and then learn C++
if you need to for pragmatic reasons.
> IOW, one group can work at low level
> to produce elements that others can use at high level. E.g., instatiating
> an mp3-playing object and calling the play method is pretty trivial and high level,
> yet the same C++ language can be used to write the guts of almost everything involved.
Sure, you can write that object in C or even asm and have a high-level
interface. If an OO approach is warranted for the problem at hand, C++
offers more language support for that programming style than C, but by
that point you should really be thinking hard about whether either language
is appropriate.
Seriously, C++ was designed with backwards compatibility as a primary
goal and not as a clean OO (or otherwise) language. The language itself
(not incl. the library) is huge, has a lot of warts, and is in my experience
prone to confuse beginning programmers and give them bad habits that are
tough to shake later.
> If you really want to get intimate with the[1] hardware, even C is
> mostly isolating you from true carnal knowledge. Get an assembler[2],
> and choose every instruction and every data location and access thereto.
Right, that's why I listed "some platform's assembler" as one of the 4-5
first languages a beginning programmer who wants to master the craft
should learn (along with "some statically typed functional language"
(e.g. OCAML, Haskell), "some high-level dynamic OO language (e.g. Python,
Ruby), C (as _the_ systems language and the basis for many other language
implementations), and possibly a dynamic functional language (Lisp) or
a declaritive language (Prolog) to expand the mind).
> [2] OTOH, you'd be surprised what level chunks you can build with macros
> in a good macro assembler.
esp. Borland Object-Oriented Turbo Assembly. Double ugh.
>>> If you start with C, you will get used to a procedural way of looking
>>> at problems, and when you get to C++ you will be tempted to see it
>>> as just C with extra features. You'll have to dislodge yourself from C
>>> habits of thinking in order to "think objects" in C++. Coming from
>>
>>Conversely, if you learn in the other order you'll find yourself thinking
>>of it as a limited version of C++ instead of a different language with
>>its own idiom. The point of C is that it's procedural, small, and close
>>to the metal. Viewing without the corrupting lens of C++ is extremely
>>valuable, IMO.
>>
> I don't know what you mean by "corrupting lens of C++,"
> other than a rhetorical counter point ;-)
Rephrase as "learn C without having the C++ way stuck in your head, but
take it as a small procedural language that gets you deep inside details
about memory management and data type implementation".
> But even if you just want to learn C, you can largely use C++ as if
> it were C.
But the point of C is that it's very small (relative to C++) and much
easier to get a handle on. If you need to figure out which subset of
the language to use, you miss the whole point.
C++ is big, gross, and useful. For real-world problems, the useful part
is very important, but I personally think it's a really bad language
to start out in until well after learning OO techniques and C-style
procedural coding.
Sumner
--
rage, rage against the dying of the light
Usenet email address changes periodically. sumner-nntp at forceovermass
period com is more permanent.
More information about the Python-list
mailing list