Stefan Ram said:
Newsgroups: comp.lang.c++,comp.lang.misc
Followup-To: comp.lang.misc
I put comp.lang.c++ back on. Mr. Rice makes some wildly incorrect
assumptions, IMO. Hopefully, it'll also end up indexed in the correct
thread on c.l.c++.
Reading others' code /is/ the way to improve the skills:
Wrong! Wrong! Wrong! Freakin' wrong!
Reading others' code only exposes one to the inherent flaws of thinking and
bad code implementation others, which one - especially the novice,
inexperienced, or average intellect - then accepts as their own - since the
code different, perhaps novel, and therefore *must* be better (sarcasm) -
because they don't yet understand just how truly *bad* the idea they're
reading is. Reading other's code is one of the absolute worst things one
could do, especially for a novice who is one likely to be very accepting
when reading others' code. It's like taking pure water (you) and drinking
polluted river water (others) and ending up with a mix.
- Of course, one should select code written by masters,
not code written by arbitrary authors.
Just how does one judge a master? If you aren't a master yourself, you
can't judge who is a master ...
That entire idea is so flawed. A guy with average intellect will only
recognize a range of intellect similar to his own. He'll recognize that
which is slightly more or less bright than he, but won't recognize dumb and
genius level ideas as such. So, a guy with less than average intellect will
recognize the code by an average intellect guy as being a "master". The
majority - who are supposedly of average intellect - will be scratching
their heads in confusion asking: "Why does this guy think that guy is a
master? That guy's code is no better than my own ... I don't get it." The
same is true for the average guy, the slightly above average guy, the
brilliant guy, the genius guy. It's only partially true for the
super-genius guy who will only recognize code worse than his own ... So, in
effect, you're saying one needs to locate super-genius guy and have him
waste his time reviewing code to classify who is and who is not a master
before anyone can study the other "masters".
For example,
in the realm of C++, one might read boost source code.
In the realm of C, source code for GNU commands.
For Java, read the source code of the standard library.
In the realm of Pascal, "TeX - the program". And so on.
I doubt any of the code produced by the open-source movement could be
classified as "being written by masters". There are too many people with
*widely* varying intellect levels, most of whom are only of average
intellect, to claim that the cited code in it's entirety is somehow
brilliant. For the code to be brilliant, a single brilliant individual
must've coded it or a team of similarly brilliant individuals must've coded
it. Both of those are things which were unlikely to be present during the
codeing of any of the code you've suggested as being "master" level.
- A good way to enforce active reading is a goal, like
porting the code or modifying it.
The way to improve your code is not by reading others' code, but by 1)
really learning what elements the language provides, 2) writing your own
code using the language elements, and 3) learning how that language is
converted to assembly. You can read about implementing something, say a
linked-list, numerous times, but until you've actually done so, you won't be
able to identify and correct your own mistakes of implementation or of your
thought process, which will happen no matter how good your memory or
thinking is.
Rod Pemberton