Sie sind auf Seite 1von 3

news

Society | DOI:10.1145/2716560 Esther Shein

Python for Beginners


A survey found the language in use in introductory programming
classes in the top U.S. computer science schools.

T
H E WAY TAY L O R P O U L O sees
it, learning to code in Python
is comparable “to learning TM

Latin and romantic languag-


es.” Once someone grasps
the logic behind Python, the concepts
can be more easily transferred to other
languages, maintains Poulos, a senior
majoring in industrial engineering at
the Georgia Institute of Technology Python programmer can finish in two overhead in getting to the point
(Georgia Tech). “Once you get com- months what two C++ programmers where people can start to write inter-
fortable thinking in a different type can’t complete in a year,’’ the Founda- esting programs; the syntax is pretty
of logic and using different words, it’s tion’s website states. straightforward,’’ observes John Gut-
much more comfortable to learn new During the summer of 2014, Guo tag, professor of electrical engineer-
things,” she says, adding that she was went to the websites of the top 39 ing and computer science at MIT, and
required to take three computer sci- U.S. schools for computer science as the author of several books, includ-
ence classes at Georgia Tech, all in Py- ranked by U.S. News & World Report ing one about learning to program
thon. “Python did that.” in 2014, and collected as much data in Python. In contrast to Java, which
Python, an open source scripting as he could from looking at their in- has a “fairly complicated syntax and
language, has become the most popu- troductory computer science courses. fairly complicated static semantics,”
lar introductory teaching language at He stopped at 39, he explains, be- Python makes more sense for people
top U.S. universities—Georgia Tech cause there was an eight-way tie for 40 who are writing small programs, he
among them—according to a recent and “we had to stop somewhere.” At says. Java is designed to support peo-
survey by Philip Guo, an assistant pro- schools including the Massachusetts ple writing large, “industrial-quality”
fessor of computer science at the Uni- Institute of Technology (MIT), Carn- programs containing thousands of
versity of Rochester. Guo decided to egie Mellon University, and the Uni- lines of code, says Guttag, who teach-
conduct the research after noticing versity of California, Berkeley, Python es one of two introductory courses of-
anecdotally over the past few years that emerged as the leading language to fered by his department.
Python was replacing languages such teach novices (the full list, along with Another reason Guttag believes
as Java as the de facto introduction to Guo’s blog on the topic, can be found more colleges are using Python as an
programming class in more and more at at http://bit.ly/W0vtox). introductory programming language
computer science classes at universi- Proponents say it is no surprise Python is that it has “a very large set of highly
ties around the country. has become the most popular teaching useful libraries that have been built
Because it is a scripting language, language in colleges, because compared over the years that support things …
Python automates tasks that would to programs like Java, it is easier to learn that are easy to use from language
otherwise need to be performed manu- and to use to write programs that do prac- proper, and that makes Python a par-
ally. Java and C++ also are popular and tical things with very little code. ticularly useful language for scientists
widely used. The main difference is With Python, “There’s very little and engineers who want to take ad-
that Python programs tend to run slow- vantage of those libraries.”
er than Java programs, but they take Python is also very good for “let-
significantly less time to develop, ac- In contrast to Java, ting you teach conceptual material
IMAGE COURTESY OF PY THO N SO FT WA RE FO UNDATIO N

cording to the Python Software Foun- without getting in the way,’’ observes
dation. Python programs also tend to Python makes more Guttag. “So I don’t find myself spend-
be shorter than equivalent programs sense for people ing all my time explaining Python to
written in Java because of “Python’s the students. I get to spend a lot of
built-in high-level data types and its dy- who are writing time explaining what I think are more
namic typing,’’ the Foundation notes. small programs. long-lived concepts,’’ like algorith-
While the same is true of C++, Python mic complexity.
code is generally one-fifth to one-tenth Not everyone agrees Python is the
the length of equivalent C++ code, and be-all-end-all as an introductory pro-
“Anecdotal evidence suggests that one gramming language. Shriram Krish-

MA R C H 2 0 1 5 | VO L. 58 | N O. 3 | C OM M U N IC AT ION S OF T HE ACM 19
news

namurthi, a professor of computer teaching this.”


science at Brown University, acknowl- Guo says he got some backlash
edges Python has many nice features. “Choosing Python from older colleagues who do not
“It offers a pleasant syntax, a large set is the modern view Python as a serious program-
of libraries, and an interaction loop … ming language, along with comments
all of which are very useful for teaching. equivalent of the that it is not as “industrial strength”
Compared to the noise and complex- old adage, ‘nobody as other languages. One comment
ity of Java, it is indeed a very nice step he received after posting his blog on
forward.” He agrees Python has made ever got fired for the topic is that Python is a dynami-
people feel more comfortable about ex- buying IBM.’” cally typed language and “There’s
posing programming to a much broad- fair amount of instructors who prefer
er audience of students. statically typed languages, like Java,’’
“There are many students I would Guo says. “So they aren’t as happy
not dream of teaching Java to that I about this new movement.”
would happily show Python.” That Mark Guzdial, a professor in the
said, however, it does not take long to tive impact on teaching program de- School of Interactive Computing at
discover Python’s weaknesses, Krish- sign,’’ Krishnamurthi says. “The best Georgia Tech, says Guo’s research not-
namurthi notes. Among them are that program design methods we have right withstanding, Java is still the most pop-
“Creating non-trivial data structures now focus on data-driven design, which ular introductory programing language
is onerous, because Python does not derive from the structure of data.” in the U.S. Guo “constrained his search
provide straightforward means for Additionally, Python has limited sup- to top U.S. universities,’’ Guzdial says,
creating new structured data. You port for testing, he says. Even though it “and in general, if you look at book
have to understand a bunch of unre- has professional testing libraries, he sales, Java is still the most common
lated concepts, like classes, and their says they can be “onerous for beginning [language taught] and C++ is second.”
onerous syntax and tricky semantics, students; the language provides no na- Yet, Guzdial agrees that if someone
which greatly reduces the benefit of tive support for it, which makes the user lacks any prior programming experi-
simplicity that Python was supposed interface of testing significantly weaker ence, Python is a good language with
to offer.” than it should be.” Testing is not just a which to start. “There’s a significant
Because of this, he believes more matter of finding bugs, he adds. “It also amount of evidence that graphical
and more curricula are ditching the guides students towards the design of programming languages are easier
idea of structured data—one of the cen- solutions and greatly affects how one for people to get started with than tex-
tral concepts in computer science— views debugging. Thus, another vital tual,’’ he says. “If you understand vari-
and doing one of two things: shaping design and development methodology ables in Scratch, it’ll be easier to un-
their curriculum to avoid them, or is taken away.” derstand variables or conditionals or
pushing students to encode more- Lastly, Python lacks static types, loops in Python.”
structured data in less-structured for- says Krishnamurthi, which “is a cen- Like Krishnamurthi, Guzdial thinks
mats provided by default in Python. tral point in teaching programming, Python may broaden the scope of
“This lack of data structuring and and should not be put off for too long. people being able to code. “It is easier
classification has a significant nega- Python offers no good means for and more accessible and … you can get
more done in fewer lines of code.”
Matt Guthmiller, a sophomore ma-
Number of top 39 U.S. computer science departments joring in electrical engineering and
that use each language to teach introductory courses computer science at MIT, says he was
30
not terribly surprised by Guo’s find-
ing. Guthmiller took his first Python
25
class as a freshman at MIT, but he al-
ready knew how to code in C, C++, and
JavaScript. “It definitely seems to make
20
a lot of sense as an introductory tool
because it’s easy to learn, with lots of
15
functionality built in, and you can do
things that in other languages you’d
10
have to build yourself, and [in Python]
they’re provided for you.”
5
He likes that Python allows you
summarize a list of data in one line
0 of code, whereas in other languages it
Python Java MATLAB C C++ Scheme Scratch
would take multiple lines. “You have
Analysis done by Philip Guo (www.pgbovine.net) in July 2014, last updated 2014-07-29 to think about the order you want to
iterate these items and implement

20 COM MUNICATIO NS O F TH E ACM | M A R C H 201 5 | VO L . 5 8 | NO. 3


news

them, so there’s a lot more function- students,’’ he says, “Python is an ex- Research
ality built into one line, so if there’s a cellent choice as the introductory pro-
problem you want to solve in one line
of code, you get much closer to solving
gramming language.”
Krishnamurthi says Python may be
ACM
the problem than in other languages.”
Like Guttag, Guthmiller feels the
fashionable right now, but he believes
it lacks staying power. “Computer sci-
Europe
biggest disadvantage of Python is that
“the syntax is quite different from
ence programming education goes in
waves of fashion,’’ he says. “Ever since Protests
most other programming languages,”
making it trickier to move on to an-
other language once you get all the
Pascal introduced the idea of ‘one pro-
gramming language for introductory
programming education,’ the com-
H2020
general concepts down. However, he
says, Python’s advantages outweigh
munity has been stuck in a rut of try-
ing to find one and then arguing about
Cuts
its disadvantages. it. Pascal, C++, Java, Python, Scratch ... ACM Europe Chairman Fabrizio
Guthmiller recently used Python to take a number.” Gagliardi recently contacted
build a controller for a robot to make He likens Python to a “package tour: European leaders in opposition
to proposed budget reductions
it follow along a wall, although, gener- safe, comfortable, blandly conven- to Horizon 2020, the European
ally speaking, his go-to programming tional. Choosing Python is the modern Union’s seven-year, 80-billion-
language is C++. Python, he says, “gives equivalent of the old adage, ‘nobody euro research funding program.
you a lot of flexibility, and I’m very famil- ever got fired for buying IBM.’” In January, European
Commission President Jean-
iar with it and I am not concerned about Guzdial is also not sure how long Claude Juncker unveiled
having to remember small details.” Python will be used as the main intro- legislation that would remove
Abbie Burton, a senior majoring in ductory programming language in aca- 2.7 billion euros over 5.5
years from Horizon 2020, the
business at Georgia Tech, was required demia. “I think Python has hit its tip-
EC’s main funding stream
to take a computer science class and ping point, which may mean we have supporting research through the
took “Jython,” a combination of Java a couple more years before people say year 2020, to devote those funds
and Python that business students ‘Python, what?’” to economic stimulus through
the creation of a European
tend to take. She says most engineer- Fund for Strategic Investment.
ing students take Python or MATLAB, That investment, according
Further Reading
and she is not surprised by Python’s to Juncker, would help get the
popularity, “I guess because in the real Guo, Philip J. sluggish European economy
Online Python Tutor: Embeddable moving and create new jobs.
world that’s what people use, so they The largest share of the
Web-Based Program Visualization
want us to be prepared.” for CS Education, Google, Inc. cuts would be directed at
There does appear to be a preference http://bit.ly/1zB7ugb the European Institute of
Innovation and Technology,
for using Python outside of academia. Guttag, J.V. which aims to spur innovation
For the third year in a row, Python was Introduction to Computation and and entrepreneurship across
ranked the number one most popular Programming in Python, MIT Press (2013) Europe by bringing together
programming language by Codeval, a universities, research labs, and
Guzdial, Mark companies to form “dynamic
community of over 24,000 competitive Exploring hypotheses about media cross-border partnerships.”
developers, followed by Java, C++, and computation. Proceedings of the ninth In letters to Juncker,
JavaScript. (http://bit.ly/1vLiuFj). international ACM conference on European Council President
international computing education research Donald Tusk, and European
Guo says he has heard some com- http://bit.ly/13SWMod Parliament President Martin
ments that while easy to learn, Python Shulz, Gagliardi pointed
Enbody, R.J., Punch, W.F., and McCullen, M.,
does not have practical applications in out “the future success of
Python CS1 as preparation for C++ CS2.
the real world and that most coding is Europe requires Europe to
Proceedings of the 40th ACM technical consolidate and advance its
done in MATLAB and other languages. symposium on Computer Science Education position at the forefront of
He says it all depends on the domain. http://bit.ly/1tJjLu7 scientific innovation. This goal
“MATLAB is used in a lot of scientific Pritchard, D. and Vasiga, T. requires major investments
domains. I definitely think it’s less prac- CS Circles: An In-Browser in fundamental research,
Python Course for Beginners. Proceedings especially in such critical
tical in terms of getting an industry job, domains as computing science.”
of the ACM technical symposium on
because most industry coding would Gagliardi said ACM Europe
Computer Science Education
be in other languages, like Java or Java- recommends the European
http://bit.ly/1z7h8UV Commission authorities and
Script. So I would agree it might not be the European Council “preserve,
How to Think Like a Computer Scientist.
the language you’d use in your job.” Learning with Python: Interactive Edition 2.0 in the announced cuts to H2020,
Guttag says Python is a useful tool http://bit.ly/1tJkknG the support to fundamental
for people who do not intend to be com- research and especially in
computing science, given
puter scientists, because it provides a Esther Shein is a freelance technology and business their direct relevance for the
good foundation for learning how to writer based in the Boston area.
focus on innovation of
use computation as part of their work. the Investment Plan.”
—Lawrence M. Fisher
“For those non-computer science © 2015 ACM 0001-0782/15/03 $15.00

MA R C H 2 0 1 5 | VO L. 58 | N O. 3 | C OM M U N IC AT ION S OF T HE ACM 21

Das könnte Ihnen auch gefallen