Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #61554 > unrolled thread

Re: Experiences/guidance on teaching Python as a first programming language

Started byOscar Benjamin <oscar.j.benjamin@gmail.com>
First post2013-12-11 11:46 +0000
Last post2013-12-12 07:13 +1100
Articles 11 — 7 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Experiences/guidance on teaching Python as a first programming language Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-12-11 11:46 +0000
    Re: Experiences/guidance on teaching Python as a first programming language rusi <rustompmody@gmail.com> - 2013-12-11 06:44 -0800
      Re: Experiences/guidance on teaching Python as a first programming language Chris Angelico <rosuav@gmail.com> - 2013-12-12 02:24 +1100
        Re: Experiences/guidance on teaching Python as a first programming language rusi <rustompmody@gmail.com> - 2013-12-11 07:41 -0800
          Re: Experiences/guidance on teaching Python as a first programming language Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-11 15:53 +0000
          Re: Experiences/guidance on teaching Python as a first programming language Chris Angelico <rosuav@gmail.com> - 2013-12-12 03:04 +1100
          Re: Experiences/guidance on teaching Python as a first programming language Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-11 16:18 +0000
            Re: Experiences/guidance on teaching Python as a first programming language Roy Smith <roy@panix.com> - 2013-12-11 20:50 -0500
            Re: Experiences/guidance on teaching Python as a first programming language "Rhodri James" <rhodri@wildebst.org.uk> - 2013-12-12 23:50 +0000
          Re: Experiences/guidance on teaching Python as a first programming language Chris Angelico <rosuav@gmail.com> - 2013-12-12 03:25 +1100
          Re: Experiences/guidance on teaching Python as a first programming language Tim Delaney <timothy.c.delaney@gmail.com> - 2013-12-12 07:13 +1100

#61554 — Re: Experiences/guidance on teaching Python as a first programming language

FromOscar Benjamin <oscar.j.benjamin@gmail.com>
Date2013-12-11 11:46 +0000
SubjectRe: Experiences/guidance on teaching Python as a first programming language
Message-ID<mailman.3887.1386762439.18130.python-list@python.org>
On 11 December 2013 08:43, Chris Angelico <rosuav@gmail.com> wrote:
> On Wed, Dec 11, 2013 at 7:34 PM, Devin Jeanpierre
> <jeanpierreda@gmail.com> wrote:
>
> When you tell a story, it's important to engage the reader from the
> start. Sometimes that means starting the story in the middle of the
> action, and filling in the important-but-less-exciting details later,
> when they mean something. [1] Teaching a skill often hits the same
> sorts of issues. Rather than explain "This is how to manipulate
> registers in a CPU", explain "This is how to print Hello World to the
> console" and worry about what exactly the console is (and how
> redirection affects it) later. My tutorial on assembly language
> programming did the same, though it used a one-character-output
> operation so it printed a single asterisk to standard out. (Manually
> setting CPU register AX to 0200 and DX to 002A, placing an INT 21
> command in memory, and single-stepping it.) Learning how all that
> functions - or even what the INT opcode means - came later. Start with
> something visible and engaging.
>
> After that, learn/teach as much background as is of interest, and
> improve skills. But start with something that gets something done.

I certainly agree with this for our students. Explicit computing
courses make up about 30 credits (~16%) of the whole degree program
for the Engineering Mathematics students (if they don't take
additional optional units). They are however many units that
implicitly require computing skills, so we really need them to be able
to be productive quickly. Some of them will focus on programming and
get really good at it. Some do go on to become programmers but most do
not.

The Electrical Engineering students will subsequently do low-level
programming with registers etc. but at the earliest stage we just want
them to think about how algorithms and programs work before going into
all the hardware specific details.

While reading around this subject I found this interesting (although
verbose) speech from Dijkstra advocating the opposite point of view:
http://www.cs.utexas.edu/~EWD/transcriptions/EWD10xx/EWD1036.html

This definitely wouldn't work for my students but a friend of mine
studied CS (at Warwick?) and his course worked as Dijkstra describes.
In the first year they don't touch a real programming language or
write any actual programs. They take exams in pseudocode and formal
proofs of correctness. Then after a year of studying algorithms,
linguistics, semantics, proof, mathematics and so on they write their
first hello world program in a real programming language. I don't
really know whether he's any good at programming but he's certainly a
good mathematician.


Oscar

[toc] | [next] | [standalone]


#61578

Fromrusi <rustompmody@gmail.com>
Date2013-12-11 06:44 -0800
Message-ID<05fc5a48-576d-4eb9-a714-96df39f0ef1f@googlegroups.com>
In reply to#61554
On Wednesday, December 11, 2013 5:16:50 PM UTC+5:30, Oscar Benjamin wrote:
> The Electrical Engineering students will subsequently do low-level
> programming with registers etc. but at the earliest stage we just want
> them to think about how algorithms and programs work before going into
> all the hardware specific details.

> While reading around this subject I found this interesting (although
> verbose) speech from Dijkstra advocating the opposite point of view:
> http://www.cs.utexas.edu/~EWD/transcriptions/EWD10xx/EWD1036.html

> This definitely wouldn't work for my students but a friend of mine
> studied CS (at Warwick?) and his course worked as Dijkstra describes.
> In the first year they don't touch a real programming language or
> write any actual programs. They take exams in pseudocode and formal
> proofs of correctness. Then after a year of studying algorithms,
> linguistics, semantics, proof, mathematics and so on they write their
> first hello world program in a real programming language. I don't
> really know whether he's any good at programming but he's certainly a
> good mathematician.

A government form -- say for filing income tax -- and poetry may both
be in English but one doesn't read them with the same attitude!

Dijkstra talks in so much hyperbole that one does not take him
literally.  In particular if you want to take him seriously, you must
not take him literally.  [I remember reading somewhere that in CS
arrogance is measured in nano-dijkstras]

I believe there is a truth in the line that Chris and Gene take of
getting students' hands dirty early.
Equally there is truth in Dijkstra's line that students need the habit
of thinking and reflecting before diving in.

Now if you believe that one is clearly more important than the other,
your way is clear.

However what if you want to balance both? Its a challenge...

It is this need to balance that makes functional programming attractive:

- implemented like any other programming language
- but also mathematically rigorous

No python is not strictly a functional language but it can be bent to seem
that way more than C/C++/Java/what-have-you

[toc] | [prev] | [next] | [standalone]


#61583

FromChris Angelico <rosuav@gmail.com>
Date2013-12-12 02:24 +1100
Message-ID<mailman.3902.1386775479.18130.python-list@python.org>
In reply to#61578
On Thu, Dec 12, 2013 at 1:44 AM, rusi <rustompmody@gmail.com> wrote:
> It is this need to balance that makes functional programming attractive:
>
> - implemented like any other programming language
> - but also mathematically rigorous

Attractive *to the mathematician*. A more imperative style makes sense
to someone who's grown up with... well, parents...

clean_room()
eat_dinner()

One won't start till the other finishes.

ChrisA

[toc] | [prev] | [next] | [standalone]


#61584

Fromrusi <rustompmody@gmail.com>
Date2013-12-11 07:41 -0800
Message-ID<ce3f38a2-a726-4d71-b538-3606a4d1ee54@googlegroups.com>
In reply to#61583
On Wednesday, December 11, 2013 8:54:30 PM UTC+5:30, Chris Angelico wrote:
> On Thu, Dec 12, 2013 at 1:44 AM, rusi wrote:
> > It is this need to balance that makes functional programming attractive:
> > - implemented like any other programming language
> > - but also mathematically rigorous

> Attractive *to the mathematician*. A more imperative style makes sense
> to someone who's grown up with... well, parents...

> clean_room()
> eat_dinner()

> One won't start till the other finishes.

Yes its always like that:
When you have to figure 2 (or 10) line programs its a no-brainer that
the imperative style just works.

When the ten becomes ten-thousand, written by a nut who's left you with
code whose semantics is dependent on weird dependencies and combinatorial
paths through the code you start wishing that

- your only dependencies were data dependencies
- "Explicit is better than implicit" dinned into the nut's head

which BTW are the basic tenets of FP.

We have functions in C, in Scheme and in Haskell. The difference is that

- in C its impractical and unrealistic to have all functions as
  (mathematical) functions of the arguments
- in Scheme its natural but not enforced
- in Haskell its enforced

The nice thing about python is that one can (kindof) teach it in the
Scheme-like way before showing the C-like side.

[toc] | [prev] | [next] | [standalone]


#61589

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2013-12-11 15:53 +0000
Message-ID<mailman.3907.1386777182.18130.python-list@python.org>
In reply to#61584
On 11/12/2013 15:41, rusi wrote:
>
> When the ten becomes ten-thousand, written by a nut who's left you with
> code whose semantics is dependent on weird dependencies and combinatorial
> paths through the code you start wishing that
>

... he'd not been a Led Zeppelin fan, whereby every 
variable/module/function name was based on a song title/album 
name/lyric.  Thankfully not on my project, it was a mate's.  Code ended 
up in small, round filing cabinet.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#61591

FromChris Angelico <rosuav@gmail.com>
Date2013-12-12 03:04 +1100
Message-ID<mailman.3909.1386777861.18130.python-list@python.org>
In reply to#61584
On Thu, Dec 12, 2013 at 2:41 AM, rusi <rustompmody@gmail.com> wrote:
> Yes its always like that:
> When you have to figure 2 (or 10) line programs its a no-brainer that
> the imperative style just works.
>
> When the ten becomes ten-thousand, written by a nut who's left you with
> code whose semantics is dependent on weird dependencies and combinatorial
> paths through the code you start wishing that
>
> - your only dependencies were data dependencies
> - "Explicit is better than implicit" dinned into the nut's head
>
> which BTW are the basic tenets of FP.

And since teaching is seldom done with 10KLOC codebases, functional
style can be left till later. I strongly believe that a career
programmer should learn as many languages and styles as possible, but
most of them can wait. Start with something easy, then pick up
something harder later.

ESR in "How to become a hacker" [1] suggests learning "Python, C/C++,
Java, Perl, and LISP" [2], and do take note of his reasons _why_. I'm
not sure that Perl is so important any more (though a Unix sysadmin
should probably have at least a working knowledge of it, given the
likelihood of tripping over it at some point), and for LISP you might
substitute some other functional language, but broadly, those five
recommendations haven't changed in years and years.

Knowing multiple styles lets you learn from all of them. Pure
functional programming means the result of any function can be
determined entirely from its arguments; that doesn't fit into
everything, but it sure does make your code easier to understand when
you (mostly) stick to it. (For instance, the current logging level
might change whether a particular line does something or does nothing,
but it still fundamentally has the same meaning, and it won't change
state magically anywhere else.) And there's a lot of "similarity of
thinking" between a well-written program in one style and a
well-written program in another style, regardless of which two styles
they are.

ChrisA

[1] http://www.catb.org/esr/faqs/hacker-howto.html
[2] http://www.catb.org/esr/faqs/hacker-howto.html#skills1

[toc] | [prev] | [next] | [standalone]


#61596

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2013-12-11 16:18 +0000
Message-ID<mailman.3913.1386778687.18130.python-list@python.org>
In reply to#61584
On 11/12/2013 16:04, Chris Angelico wrote:
> I strongly believe that a career
> programmer should learn as many languages and styles as possible, but
> most of them can wait.

I chuckle every time I read this one.  Five years per language, ten 
languages, that's 50 years I think.  Or do I rewrite my diary for next 
week, so I learn Smalltalk Monday morning, Ruby Monday afternoon, Julia 
Tuesday morning ...

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#61645

FromRoy Smith <roy@panix.com>
Date2013-12-11 20:50 -0500
Message-ID<roy-53A431.20505311122013@news.panix.com>
In reply to#61596
In article <mailman.3913.1386778687.18130.python-list@python.org>,
 Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:

> On 11/12/2013 16:04, Chris Angelico wrote:
> > I strongly believe that a career
> > programmer should learn as many languages and styles as possible, but
> > most of them can wait.
> 
> I chuckle every time I read this one.  Five years per language, ten 
> languages, that's 50 years I think.  Or do I rewrite my diary for next 
> week, so I learn Smalltalk Monday morning, Ruby Monday afternoon, Julia 
> Tuesday morning ...

Not counting little side explorations, I have used in anger (and in 
vaguely chronological order):

Basic
Fortran
C
Various assemblers (pdp-10, pdp-11, IBM-1130, M6800)
Common Lisp
Postscript
Python
TCL
Perl
Java
C++
Javascript

[toc] | [prev] | [next] | [standalone]


#61776

From"Rhodri James" <rhodri@wildebst.org.uk>
Date2013-12-12 23:50 +0000
Message-ID<op.w7z66ve65079vu@gnudebeest>
In reply to#61596
On Wed, 11 Dec 2013 16:18:08 -0000, Mark Lawrence  
<breamoreboy@yahoo.co.uk> wrote:

> On 11/12/2013 16:04, Chris Angelico wrote:
>> I strongly believe that a career
>> programmer should learn as many languages and styles as possible, but
>> most of them can wait.
>
> I chuckle every time I read this one.  Five years per language, ten  
> languages, that's 50 years I think.  Or do I rewrite my diary for next  
> week, so I learn Smalltalk Monday morning, Ruby Monday afternoon, Julia  
> Tuesday morning ...

Welcome to Computer Science lectures :-)

-- 
Rhodri James *-* Wildebeest Herder to the Masses

[toc] | [prev] | [next] | [standalone]


#61597

FromChris Angelico <rosuav@gmail.com>
Date2013-12-12 03:25 +1100
Message-ID<mailman.3914.1386779166.18130.python-list@python.org>
In reply to#61584
On Thu, Dec 12, 2013 at 3:18 AM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> On 11/12/2013 16:04, Chris Angelico wrote:
>>
>> I strongly believe that a career
>> programmer should learn as many languages and styles as possible, but
>> most of them can wait.
>
>
> I chuckle every time I read this one.  Five years per language, ten
> languages, that's 50 years I think.  Or do I rewrite my diary for next week,
> so I learn Smalltalk Monday morning, Ruby Monday afternoon, Julia Tuesday
> morning ...

Well, I went exploring the Wikipedia list of languages [1] one day,
and found I had at least broad familiarity with about one in five. I'd
like to get that up to one in four, if only because four's a power of
two.

More seriously: Once you've learned five of very different styles, it
won't take you five years to learn a sixth language. I picked up Pike
in about a weekend by realizing that it was "Python semantics meets C
syntax", and then went on to spend the next few years getting to know
its own idioms. I'd say anyone who knows a dozen languages should be
able to pick up any non-esoteric language in a weekend, at least to a
level of broad familiarity of being able to read and comprehend code
and make moderate changes to it.

[1] https://en.wikipedia.org/wiki/List_of_programming_languages

ChrisA

[toc] | [prev] | [next] | [standalone]


#61616

FromTim Delaney <timothy.c.delaney@gmail.com>
Date2013-12-12 07:13 +1100
Message-ID<mailman.3930.1386792788.18130.python-list@python.org>
In reply to#61584

[Multipart message — attachments visible in raw view] — view raw

On 12 December 2013 03:25, Chris Angelico <rosuav@gmail.com> wrote:

> On Thu, Dec 12, 2013 at 3:18 AM, Mark Lawrence <breamoreboy@yahoo.co.uk>
> wrote:
> > On 11/12/2013 16:04, Chris Angelico wrote:
> >>
> >> I strongly believe that a career
> >> programmer should learn as many languages and styles as possible, but
> >> most of them can wait.
> >
> >
> > I chuckle every time I read this one.  Five years per language, ten
> > languages, that's 50 years I think.  Or do I rewrite my diary for next
> week,
> > so I learn Smalltalk Monday morning, Ruby Monday afternoon, Julia Tuesday
> > morning ...
>
> Well, I went exploring the Wikipedia list of languages [1] one day,
> and found I had at least broad familiarity with about one in five. I'd
> like to get that up to one in four, if only because four's a power of
> two.
>
> More seriously: Once you've learned five of very different styles, it
> won't take you five years to learn a sixth language. I picked up Pike
> in about a weekend by realizing that it was "Python semantics meets C
> syntax", and then went on to spend the next few years getting to know
> its own idioms. I'd say anyone who knows a dozen languages should be
> able to pick up any non-esoteric language in a weekend, at least to a
> level of broad familiarity of being able to read and comprehend code
> and make moderate changes to it.
>

Absolutely. 10 years ago I was saying I'd forgotten at least 20 languages,
and there have been many more since.

Once you know enough programming languages you (and by "you" I mean "me")
get to the point where if you don't know a specific language you can pick
up enough to be useful in a day or two, reasonably proficient in a week,
and have a fairly high level of mastery by the time you've finished
whatever project you picked it up for. And then you don't use it for a
while, forget it to make room for something else, and pick it up again when
you need it (much faster this time).

Except Prolog. Never could get my head around it - I should go back and
have another try one of these days.

Some languages stick with you (e.g. Python) and I don't tend to learn
languages that are too similar to what I already know unless it's for a
specific project. So I've never learned Ruby ... but I have had to modify a
few Ruby scripts along the way, and been able to achieve what I wanted the
same day.

TimD elaney

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web