Programming intro book ch1 and ch2 (Windows/Python 3) - Request ForComments

A

Alf P. Steinbach

* John Posner:
Chapter 2 is about Basic Concepts (of programming). It's the usual:
variables, ...

1. Overall suggestion

You have a tendency to include non-pertinent asides [1]. But then,
rambling a bit endows a manuscript with the author's distinctive voice.
Fortunately, we live in a hypertext-enabled world, where you can have
your cake and eat it, too. I suggest that you go over your manuscript
with a ruthless eye, and turn your rambles into hypertext-accessible
"sidebars". See how much you can reduce the length of Chapter 2, which
current runs 98 pages!

He he. :)

You're right, although the examples you chose were not as I see it rambles, just
short asides within sentences; useful concrete examples; and general background.

I do have a tendency to apparently ramble, especially about technical details
and consequences -- it's not arbitrary but an attempt to bring in important
consequences and/or some more fundamental unifying view. I tried to discipline
myself to not do that, to just let go, to let /the reader/ replace arbitrary
rules with understanding, in time. Like, you don't really need to understand the
physics to do hammering. Even though even a rough understanding of the physics
can help you avoid looking like an effeminate Hollywood movie star acting out
hammering, can help you avoid getting hurt, can get the job done much faster,
and can help you in other situations! But I'll try even harder. :)

2. Comments on Section 2.6.7, "References & automatic garbage collection"

There's a spell-check evader on page 2:49: "trough" s.b. "through". And
your spell-checker should have caught "adressable" on page 2:48.

Sad to say, I'm not using a spell checker. The reason is that for me, in /most/
cases the speling erors marked by Word's spell checker are not speling erors.
The beast is Just Wrong. And it's Wrong-Headed, insisting on "fixing" perfectly
correct text. For example, replacing "southeast" with "southwest" (now, what the
**** does Word's spell checker know about geography? Nothing!) Even worse, as
soon as that beast just gets its little toe inside the door, it tends to invite
in its friends the Grammar Checker and the Auto Formatter. Which feel free to
not only report what they see as improvements, but to just change the text!

So, thanks!

Will be fixed.

I find your sequence-of-attribute-lookups approach to the topic of
"variable assignment" interesting. The directed-graph illustration on
page 2:49 even hints at the fact that in the world of Python, names
("turtle", "forward", etc.) and objects (various kinds of yellow boxes)
are very different things.

(I suggest getting rid of the callout "Very small fixed size variable".
That way, only objects, not names, have the italicized callouts.)

But using the term "references" and the directed-graph metaphor has its
drawbacks. Avoiding the term "reference" will make it easier to navigate
the turbulent waters of call-by-reference vs. call-by-value vs.
call-by-name. (You don't even stick a toe in those waters in Section
2.7.5.) Combining memory addresses with the directed graph metaphor
invites the reader to think at way too low a level, IMHO.

Uhm, discussing call-by-name would really be rambling & anecdotal. AFAIK no real
programming language has had that since Algol, where it was introduced by a too
unclear spec implemented literally (i.e., lack of 2-way communication within the
team introduced a "feature"!). Or am I misunderstanding what you mean?

It's True, as you note, that people tend to get confused. I recently (just weeks
ago) was astounded to see that a C++ "expert" thought that Java had pass by
reference, apparently because in Java only references are passed around. But I
think the cure for that is not to draw a veil over the things that can confuse,
such as avoiding the word "reference", but rather to just discuss the reality.

That is, I think argument passing & associated terminology is not more
complicated than even my mom could understand, if she put her politician's mind
to it. Certainly, anyone young enough won't have any problem. I believe... ;-)


[snip]
I hope these comments help.

Yes, thanks,

- Alf
 
S

Steven D'Aprano

I recently (just weeks
ago) was astounded to see that a C++ "expert" thought that Java had pass
by reference, apparently because in Java only references are passed
around.

The Java community, for some bizarre reason, has a tendency to describe
Java's argument passing model (which is identical to Python's) as "pass
by reference" even though it is nothing like pass by reference in
languages that actually have it (such as Pascal).

There is nothing so simple that it can't be totally confused by
sufficiently stupid terminology.
 
A

Alf P. Steinbach

Hi, 10 details I forgot in my first response...

* John Posner:
[...] Chapter 2, which current runs 98 pages!

The chapter 2 PDF I posted on

<url: http://tinyurl.com/programmingbookP3>

was and is (it's not been updated) 101 pages, with an "-EOT-" at page 102.

I suspect you may have read the previous version.

However, I believe the only difference from the previous version is the added
text, the last three pages, about dictionaries (associative arrays). Did your
PDF have Lewis Carrol's Jabberwocky nonsense poem somewhere in the last three
pages? I used that poem as an example text for word counting?


[snip]
As I've said in this forum (and the edu-sig forum) before, I think the
best metaphor for understanding Python variable assignment is John
Zelle's yellow-sticky-note metaphor. [2] [snip]

[2] "Python Programming: An Introduction to Computer Science" by John
Zelle (Franklin, Biddle & Associates, 2004) See Section 2.5.1, "Simple
Assignment"

I'm unable to find anything about yellow sticky-notes there! However, I can
guess what it was about :), and I only looked in a PDF I downloaded, which
probably was illegal and manually typed in by some kid. He he, they do a great
service for us who don't have ready continuous access to a university library!


Cheers,

- Alf

PS: Argh! Someone did it -- serious programming intro based on Python --
already! However, there's a difference between computer science and programming,
as very clearly explained by Bjarne Stroustrup in his latest book; Zelle uses
Python 2.x in Linux, while I use 3.x in Windows, more accessible to the average
reader; Zelle's book seems to be at least partially assuming a school
environment while what I'm writing is /meant/ to be sufficient for unassisted
self study; and of course I think my progression is better, e.g. introducing
loops and decisions very early. However, all those exercises... I wish
Someone(TM) could cook up Really Interesting exercises for my manuscript! :p
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top