Re: Learning to code by reading code
"Rod Pemberton" <do_not_have@noavailemail.cmm> writes:
Many years ago, I taught myself BASIC followed by 6502 assembly.
This was the same sequence in my case, with the special
twist that I did not have access to a computer in those
days, so I wrote my BASIC code on paper with a pencil and
did not see it run for some months until I then eventually
got access to a BASIC implementation on a personal
electronic transactor.
But there might be a fallacy here: When one has learned
riding horses in a special way, this might stil apply today.
Horses do not change so fast. But the landscape of
processors and programming languages has changed, even
though the 6502 is still manufactured today.
The fallacay could be: ?I learned programming this way,
therefore, every one else also should learn it this way.?
(?Because I only know the way how I did learn it, I cannot
imagine any other possibility.?)
When you learned a language with a 0 pointer, you possibly
understood it in terms of certain 6502 behavior, so it
possibly seemed to you that your 6502 knowledge helped you
to understand the 0 pointer concept. You possibly never made
the experience how it is to learn a 0 pointer concept
without ever having been exposed to an assembler language
before, so you possibly cannot imagine how someone could
grasp the 0 pointer concept without a 6502 model in his
mind. But that does not necessarily mean that it is really
necessary for someone else to learn things in this order.
In my case, for example, I could say: ?The best way to learn
programming for everyone is to write the programs on paper
with a pencil for some months, before one starts to sit in
front of a keyboard.? But soon young people will have to
learn how to use a pencil just for this, because they start
to write using keyboards - there are indeed some schools who
are already dropping the teaching of longhand IIRC.
In my case, the good thing about writing code on paper was
that I did not rush to execute my code, but instead took my
time to write and re-read it carefully and then learned to
?mentally execute? the code: Because I had no implementation,
I ?executed? each statement mentally trying to imitate what
the machine would do. A capability, which surely is helpful
in programming.
PS: I made a spelling mistake in another post, I wrote
?Macchiavelli?, but the correct spelling seems to be
?Machiavelli? - sorry.
PPS: some quotations about pencil programming:
?When I wrote TeX originally in 1977 and '78, of course
I didn't have literate programming but I did have
structured programming. I wrote it in a big notebook in
longhand, in pencil. Six months later, after I had gone
through the whole project, I started typing into the computer.?
http://www.gigamonkeys.com/blog/2009/10/05/coders-unit-testing.html
?He declined offers of typing help, and just kept
writing away in pencil. He rewrote parts, copied
things over, erased and rewrote.
Finally Andr? took his neat final pencil copy to a
terminal and typed the whole program in (...)
the VTOC manager worked perfectly from then on.?
http://www.multicians.org/andre.html