[Edu-sig] Progamming advice. (Was: Why MIT switched from Scheme to Python)
Scott David Daniels
Scott.Daniels at Acm.Org
Mon Apr 6 22:35:15 CEST 2009
Gary Pajer wrote:
> ... Just this past weekend I was wondering where I could find such things,
> that is, help at learning good ways to structure a python program (for
> generic python, not specifically Django), written for the non-programmer
> scientist/educator. When I write my programs I always feel that
> certainly I am attacking the problem in the least-elegant,
> least-extendable, least-reusable, most-brute-force way possible. It's
> easy to find beginners manuals, but what's the best way to learn better
> programming techniques / structures / etc?
OK, I may be CS-biased, but I think a data structures course, taught
well, can be the quickest way to get to core structures you'll need.
As to general programming rules: much like in writing in English, go
for short clear exposition. Think of a program not so much as
controlling a computer as describing to another programmer how you
go about accomplishing this computing task. Just as you don't write
twelve-page paragraphs; don't write 12-page functions or methods.
Remember the other programmer may be you in year or two, so be kind
about making details clear.
Although this is tangential, I've recently been remembering one of
the great moments in "Corporate Politics JuJitsu" that I experienced
decades ago. I was working in an OS and Languages group, and we would
regularly get requests for short programs do "just do something simple."
We would give estimates that frustrated the requester, in that we'd be
taking a week for what may well have been a half-day programming task.
Of course, a lot of our maintenance work consisted of coping with hack-
on-hack-on-hack software. Finally, we hit upon a solution. We offered
one day if we delete the source before delivering the program,
or one week if we keep the source.
The dual-estimate satisfied everyone. We had the luxury of getting
things right to support, without "over-charging" for things that were
truly one-off productions. It was amazing how many one-time requests
wanted the full week version when they realized that "what you did
last week with this little change" was going to cost them a full
redevelop. These days I see this as matching the Agile Programming
goal of leaving the customer in charge, but then I just thought it was
a miraculous way of explaining explaining what the extra time went for.
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Edu-sig