Experiences/guidance on teaching Python as a first programming language

Larry Martell larry.martell at gmail.com
Mon Dec 9 08:39:36 EST 2013


On Mon, Dec 9, 2013 at 8:24 AM, Gene Heskett <gheskett at wdtv.com> wrote:
> On Monday 09 December 2013 07:51:12 Oscar Benjamin did opine:
>
>> Hi all,
>>
>> I work in a University Engineering faculty teaching, among other
>> things, programming. In our last meeting about improving our teaching
>> syllabus and delivery we've identified the first year programming
>> courses as an area where there is room for improvement and we're
>> considering (mainly on my suggestion) switching to using Python as the
>> first programming language that we use to introduce our students to
>> programming. I'm interested to know if anyone can share experience of
>> a similar situation or can point to any case studies about this.
>>
>> The course is for ~100 1st year students with half studying
>> Engineering Mathematics and the other half Electrical Engineering.
>> Currently we introduce programming with C for the 1st semester and
>> then C++ for the 2nd semester. In the 3rd semester they learn Matlab
>> and following on from that they can take optional units run by the CS
>> department in Java, Haskell and many more. Our faculty does not
>> currently offer any Python courses for students at any level in CS or
>> Engineering.
>>
>> Many of the students complain that the C course is too hard and my
>> experience is that it doesn't equip them with the general
>> understanding of programming that we really want them to get from the
>> first programming course. I'm not sure about the Electrical
>> Engineering students but the Engineering Mathematics students tend not
>> to use C/C++ once they have covered Matlab and just use Matlab for all
>> future projects, including in situations where it is highly
>> inappropriate.
>>
>> In our recent meeting I proposed that Python should be the first
>> programming language, and others proposed that Java should be the
>> second. So we're currently evaluating the option of having Python in
>> the first semester followed by Java in the second. Both courses would
>> have to be created from scratch meaning that we would need to draw a
>> complete outline and syllabus by mid-January in order to roll this out
>> for the next academic year.
>>
>> I think that the benefits of this would be that using an "easy"
>> language would be less distracting while we introduce the general
>> concepts of programming. What we really want is for the students to
>> focus on things like "why would I write a program?", "what kind of
>> things can I do with a program?" and "how would I go about writing a
>> program that does X?". Ideally by the end of the course we want that,
>> given a description of a simple command line program that would
>> perhaps calculate something or do some simple data processing, then
>> the students would feel confident that they could do that. I think
>> that using C distracts them from learning these more important general
>> lessons as they struggle with simple things like how to print output,
>> or avoid segmentation faults. Also ideally they would continue to use
>> the language, where appropriate, for subsequent project work (which is
>> when they would *really* learn the language).
>>
>> Some of the objections to the idea that were voiced in the meeting were
>> that: 1) Some people felt that Python is not an "industry standard"
>> unlike C/C++/Java and that it is not as good for employability.
>> 2) Students should learn to program in a statically typed language
>> because it leads to good programming discipline.
>> 3) Python is too close to Matlab (which is considered essential for
>> some industries our students often go in to).
>> 4) It is better for students to be introduced to programming with a
>> low-level language so that they gain a better understanding of how
>> computers "really work".
>> 5) Learning to program "should be painful" and we should expect the
>> students to complain about it (someone actually said that!) but the
>> pain makes them better programmers in the end.
>>
>> I'm particularly interested to know if anyone can share experience of
>> switching to teaching Python as a first programming language in a
>> similar context. A written up case study that I could circulate among
>> the relevant staff would be especially useful.
>>
>>
>> Thanks in advance,
>> Oscar
>
> I toss out that
>
> 1. a semester is insufficient to gain a working familiarity with either
> python or java.  And neither should be introduced until a decent foundation
> has been laid.
>
> 2. If you want to start at the nuts and bolts level, (and you should) then
> nothing can compare with a semester or more in assembly language for an
> easy to learn 8/16 bit mcu like a 6809.  IMO learning the Intel assembly
> for the 8088 and its git, or even the higher level motorola stuff is
> counter productive because they get lost in the details that are really
> best handled by a compiler.  We actually have a reasonably complete, unix
> like OS for that mcu, used to be os9 30 years ago, migrated to community
> supported now and called Nitros9 as we have about doubled its speed over
> the original.  I helped in its conversion to run on the smarter 6309, and
> I've written some of its lesser used drivers, like a serial mouse.
>
> Once they get the concept of doing operations on registers they have loaded
> with data, and then storing the result, possibly for further use in another
> block of code, C will be much easier to teach well as that background will
> give them the ability to treat C as a higher level, but still close to
> assembly language.  The student can easily envision what C is doing,
> statement by statement, which will help comprehension, a lot.
>
> Then spend at least a semester on methods of looking at a problem, breaking
> it down into pieces to solve, then organizing the code to solve that
> problem, which if done right, should result in their having a view that
> might even be language independent.  This can't help but be good in the
> long run.  The ability to compose a block diagram with the flow, will
> result in a student whose code will be a lot closer to correct right out of
> the gate as opposed to the student and prof doing 2 weeks of back and forth
> until he, sometimes accidentally, finally gets it right.  By that time both
> are cross-eyed from looking at so much code that doesn't work well.
> Here is where the truly high level language like python or java enters the
> conversation.
>
> My $0.02, in 1934 dollars of course. ;-)

I agree with Gene on the benefit of knowing a low level language and
having experience with the hardware and top-down analysis. I went to
college in the late 70's and I find my knowledge of those things helps
me tremendously when debugging. I think college isn't as much to teach
you specific things as it is to teach you how to learn (especially in
this industry). I've encountered many kids today who come out of
school, and think java is the only language and they have no design
skills and no knowledge of how the machine actually works.



More information about the Python-list mailing list