A Case for Python?

klipitiklopwarrenΛογισμικό & κατασκευή λογ/κού

7 Νοε 2013 (πριν από 4 χρόνια και 3 μέρες)

76 εμφανίσεις

The First Language

A Case for Python?

Tony Jenkins

School of Computing

University of Leeds

tony@comp.leeds.ac.uk

http://www.comp.leeds.ac.uk/tony/

AMJ, 27th August 2003

The First Language: a Case for Python?

2
.

Shameless
Plug

Only £18.99

Available all good
bookshops.

Get 'em while they're hot.

AMJ, 27th August 2003

The First Language: a Case for Python?

3
.

Another
Shameless
Plug

Only £18.99

Available all good
bookshops April 2004.

Pre
-
order 'em now!

How to Program

Using Java





Tony Jenkins and

Graham Hardman

(featuring Elvis the Duck)


AMJ, 27th August 2003

The First Language: a Case for Python?

5
.

Audience Participation 1


What language do you teach?


What percentage of your students
become "proficient" in it?


What percentage would you hire as
programmers?


Why? Or, indeed, why not?

AMJ, 27th August 2003

The First Language: a Case for Python?

6
.

A Quote


Despite Python's appeal … you may still
wonder … why teach programming using
Python.


Especially when popular opinion is on the side
of more masochistic alternatives such as C++
and Java.


The most direct answer is that programming in
Python is a lot of fun.

AMJ, 27th August 2003

The First Language: a Case for Python?

7
.

It's …

AMJ, 27th August 2003

The First Language: a Case for Python?

8
.

Python


Python is an
interpreted, interactive,
object
-
oriented

programming language.


Python combines remarkable power
with very clear syntax.


The Python implementation is portable.


AMJ, 27th August 2003

The First Language: a Case for Python?

9
.

Python


Python is copyrighted, but free.


It is available for Unix and Windows.


It is part of the "Free Software" world.


http://www.python.org/


Free tutorials (and books) abound …


… many of which are very good.


AMJ, 27th August 2003

The First Language: a Case for Python?

10
.

Python Users


Google


"Python has been an important part of
Google since the beginning".


ILM


"Python is everywhere at ILM."


NASA


"NASA is using Python to implement a
CAD/CAE/PDM repository."


AMJ, 27th August 2003

The First Language: a Case for Python?

11
.

The First Python Program

print "hello, world"

AMJ, 27th August 2003

The First Language: a Case for Python?

12
.

The First Python Program

#!/usr/bin/python

print "hello, world"

AMJ, 27th August 2003

The First Language: a Case for Python?

13
.

C++

#include <iostream>

using namespace std;

int main ()

{


cout << "hello, world" << endl;


return 0;

}

AMJ, 27th August 2003

The First Language: a Case for Python?

14
.

Java

public class Hello {


public static void main (String args[])


throws IOException


{


System.out.println ("hello, world");


}

}


AMJ, 27th August 2003

The First Language: a Case for Python?

15
.

The First Python Program

#!/usr/bin/python

print "hello, world"

AMJ, 27th August 2003

The First Language: a Case for Python?

16
.

Pascal

program Greet (output)

begin


writeln ('hello, world')

end.

AMJ, 27th August 2003

The First Language: a Case for Python?

17
.

The First Python Program

#!/usr/bin/python

print "hello, world"

AMJ, 27th August 2003

The First Language: a Case for Python?

18
.

Not the Messiah

AMJ, 27th August 2003

The First Language: a Case for Python?

19
.

Not the Messiah


I do not bring a new language.


I do not claim that this language solves
all our problems.


I do not claim that we should all start
teaching it.


I do not claim that all our students want
to learn it.

AMJ, 27th August 2003

The First Language: a Case for Python?

20
.

Python


I do claim that Python is interesting.


I do claim that it is worth having a look at.


I do claim that students like it.


I do claim that it helped my students.


I do claim that they enjoyed using it.

I do not want a language war!

AMJ, 27th August 2003

The First Language: a Case for Python?

21
.

Language Wars

AMJ, 27th August 2003

The First Language: a Case for Python?

22
.

Language Wars


These jolly events are …


… regular occurrences.


… fierce.


… interesting (for the psychologist).


… entertaining (to the casual observer).


… futile (for all concerned).


In any case the Professors always win.


AMJ, 27th August 2003

The First Language: a Case for Python?

23
.

Audience Participation 2


What language do you teach?


Why did you choose it?


Did
you

choose it?


Who chose it?


Would the person who chose it own up?


What would make you change?

AMJ, 27th August 2003

The First Language: a Case for Python?

24
.

The Holy Grail

AMJ, 27th August 2003

The First Language: a Case for Python?

25
.

Audience Participation 3


What language did you learn first?


And second?


And third? And so on?


How many languages are you "proficient"
in?


How long would it take you to learn a new
language?

AMJ, 27th August 2003

The First Language: a Case for Python?

26
.

Tony's Languages


Basic


Pascal


COBOL


C


Ingres OSL / OSQ


Ingres ESQL/C


C++


Python

AMJ, 27th August 2003

The First Language: a Case for Python?

27
.

Tony's Languages


Reasonable


Jedi


Reasonable


Quite Good


Jedi


Jedi


Reasonable


Less Reasonable


Ha!


Basic


Pascal


COBOL


C


Ingres OSL / OSQ


Ingres ESQL/C


C++


Python


Java

AMJ, 27th August 2003

The First Language: a Case for Python?

28
.

Choosing a Language


Pedagogic Features


Is it easy to learn?


Does it support a paradigm?


Can it be used throughout the curriculum?


Technical Features


Is it in commercial use?


Are there jobs?

AMJ, 27th August 2003

The First Language: a Case for Python?

29
.

Choosing a Language


There exist languages designed for
teaching.


They are easy to learn.


But we wouldn't teach them …


… because they are not used in industry.

AMJ, 27th August 2003

The First Language: a Case for Python?

30
.

Choosing a Language


There exist languages designed for
commercial programming.


They are easy to learn (for experienced
programmers).


They are not designed for novices …


… but we teach them anyway.

AMJ, 27th August 2003

The First Language: a Case for Python?

31
.

Pascal

program Greet (output)

begin


writeln ('hello, world')

end.

AMJ, 27th August 2003

The First Language: a Case for Python?

32
.

C++

#include <iostream>

using namespace std;

int main ()

{


cout << "hello, world" << endl;


return 0;

}

AMJ, 27th August 2003

The First Language: a Case for Python?

33
.

Java

public class Hello {


public static void main (String args[])


throws IOException


{


System.out.println ("hello, world");


}

}


AMJ, 27th August 2003

The First Language: a Case for Python?

34
.

The First Python Program

print "hello, world"

AMJ, 27th August 2003

The First Language: a Case for Python?

35
.

I didn't want to …

AMJ, 27th August 2003

The First Language: a Case for Python?

36
.

SO13


"Object
-
Oriented Programming".


300 students, assorted.


C++, Unix.


20 credits, 2 semesters, 40 lectures.


The Book.


Coursework and Exam.

AMJ, 27th August 2003

The First Language: a Case for Python?

37
.

Problems


"Object
-
Oriented Programming".


300 students, assorted.


C++, Unix.


20 credits, 2 semesters, 40 lectures.


The Book.


Coursework and Exam.

AMJ, 27th August 2003

The First Language: a Case for Python?

38
.

Specific Problems


C++.


g++.


They don't all learn to program.


Many have failed by Christmas.


Problems settling in?


They don't
enjoy
it …


… and this impression lasts.

AMJ, 27th August 2003

The First Language: a Case for Python?

39
.

Solution


Weeks 1


7:


Python


Unix or Windows


Weeks 8


20:


C++


Unix

AMJ, 27th August 2003

The First Language: a Case for Python?

40
.

Weeks 1


7


History


The Basics (Python)


Variables and Types


Loops


Conditionals


Lists and Sorting

AMJ, 27th August 2003

The First Language: a Case for Python?

41
.

Weeks 8


20


Objects


The Basics (C++)


Classes


Variables and Types


Loops


Conditionals


Vectors and Sorting

AMJ, 27th August 2003

The First Language: a Case for Python?

42
.

The Lab Rats


"Volunteers"


The Extra Python Hour


Objects


Object Instances


Classes


Operator Overloading

AMJ, 27th August 2003

The First Language: a Case for Python?

43
.

Results

AMJ, 27th August 2003

The First Language: a Case for Python?

44
.

Observations


No worse!


Maybe even better.


Quite a good book.


Conditionals by week 2 …


… loops in week 3 …


… functions in week 4 …


… modules in week 5.



AMJ, 27th August 2003

The First Language: a Case for Python?

45
.

Quotes


"Why do you make us do C++?"


"This C++ is a joke, yes?"


"I
hate

things that need compiling!"


"The Python has much less typing."


"Python seems more logical somehow".


"I do Python, then translate it."


"Everyone should do Python."



AMJ, 27th August 2003

The First Language: a Case for Python?

46
.

The Final Coursework


To be completed in C++, Python and Java.


Which would they write first?


I did C++ first.


A Lab Rat did Python.


It took him 20 minutes.


The C++ took me 45 minutes.

AMJ, 27th August 2003

The First Language: a Case for Python?

47
.

Not the Messiah


I do not bring a new language.


I do not claim that this language solves
all our problems.


I do not claim that we should all start
teaching it.


I do not claim that all our students want
to learn it.

AMJ, 27th August 2003

The First Language: a Case for Python?

48
.

Python


I do claim that Python is interesting.


I do claim that it is worth having a look at.


I do claim that students like it.


I do not want a language war!


The Professors always win.

AMJ, 27th August 2003

The First Language: a Case for Python?

49
.

A Quote


Despite Python's appeal … you may still
wonder … why teach programming using
Python.


Especially when popular opinion is on the side
of more masochistic alternatives such as C++
and Java.


The most direct answer is that programming in
Python is a lot of fun.

AMJ, 27th August 2003

The First Language: a Case for Python?

50
.

The Web

http://www.comp.leeds.ac.uk/tony/Python/

Or for the case sensitive:

http://www.comp.leeds.ac.uk/tony/python/

AMJ, 27th August 2003

The First Language: a Case for Python?

51
.

Questions?

AMJ, 27th August 2003

The First Language: a Case for Python?

53
.

AMJ, 27th August 2003

The First Language: a Case for Python?

54
.

Shameless
Plug

Only £18.99

Available all good
bookshops.

Get 'em while they're hot.

http://www.comp.leeds.ac.uk/tony/Python/