Archive

Archive for the ‘Practical Programming’ Category

Another Introduction to Programming With Python

December 29th, 2009

The field is becoming increasingly crowded: the second edition of Al Sweigart’s Invent Your Own Computer Games With Python is now available.  It’s aimed at kids and teens, but doesn’t condescend — I’m looking forward to going through it.

Practical Programming, Python, Teaching

Feedback on the Python Book

November 26th, 2009

71 people have answered our questionnaire about Practical Programming. Here’s some of what they told us; I’ll summarize the questions about use of online programming resources and what we could do differently next time in a subsequent post.

Read more…

Books, Practical Programming, Python, Teaching

What Would You Ask?

October 25th, 2009

We’re putting together a (very) short survey for people who have bought Practical Programming (our intro to CS using Python). What do you think would be the most useful questions to ask readers?  The three I’ve thought of so far are:

  1. How much general programming experience did you have before you bought this book?
  2. How much Python experience did you have before you bought this book?
  3. How many of the exercises in the book have you done?

Others?

Practical Programming

Our Experiences Switching to Python

August 25th, 2009

In response to a question about what it’s been like switching to Python as a first-year programming language, Paul Gries wrote the following. It might be of interest to other instructors who are thinking of changing over.

And in related news, we’re compiling errata and solutions to even-numbered exercises for a fresh printing of Practical Programming. We’re pleased with how well it’s doing; in particular, we’ve been pleasantly surprised by the number of inquiries we’ve had from people who are home schooling. If you have questions, suggestions, or experiences to share, we’d love to hear from you.


The switch to Python was quite smooth, except for the following items:

  • We decided to write a textbook because we didn’t think we could live with the options at the time.
  • We decided to use Mark Guzdial’s excellent multimedia approach, but ended up almost completely rewriting his media module to use standard Python instead of Jython and had many issues with his development environment. Mark had a proof of concept that we worked from, but it used Java naming conventions and since it was designed and written by undergrads it needed a lot of cleaning up. You can find installation instructions for all of the packages that we use at . A team of about 4 people worked roughly 1 day a week throughout the summer in 2007 to put together the lectures, assignments, labs, and tests, and we’ve been refining that since then.

We love most of Python, especially the clean, readable, minimal syntax. However, there are several Python gotchas, and we were bitten by almost all of them. Here are some of the major ones that confused either students or instructors:

  • There are no good GUI packages; Swing was at least teachable, but Tkinter has lots of warts and none of the others (e.g., wxPython, PyQt) seem to be usable on all three major OSes. We’ve dropped Tkinter this fall in favour of EasyGUI, which has major limitations but is much more teachable.
  • It’s hard to know when to stop. List comprehensions, for example, are really cool and natural, but they make a surprising number of problems too easy and allow students to avoid writing loops. We show them toward the end of our intro course but don’t require the students to use them.
  • Aliasing is surprising and comes up naturally and even accidentally, especially in lists. This is not necessarily Python-specific, but it sure comes up more in Python than it did in Java.
  • Default values for parameters are created once. Students (and some instructors) hate this.
  • Simple classes are harder to teach than in Java. Also, “self” confuses a large subset of the students. Since dictionaries are so accessible they do whatever they can to avoid using and understanding classes.
  • Global scope is hard to explain: it’s actually module scope and not global, and in the three examples below there are different behaviours; the last example in particular really confuses students. They do all of these things naturally, so we can’t prevent them getting confused.
    # Example 1
    i = 1
    def f():
        print i
    
    f()
    print i
    # Example 2
    i = 1
    def g():
        i = 2
        print i
    
    g()
    print i
    # Example 3
    i = 1
    def h():
        print i
        i = 2
        print i
    
    h()
    print i
  • More scope: nested functions baffle students.

    On the positive side, some students LOVE putting functions into dictionaries and getting rid of huge if/else statements. They also find passing functions as parameters to be natural; we introduce this idea to write a timing function that returns how long its argument runs. This is a lovely thing to do when we get to searching and sorting.

    In CS2, we’re struggling with how much information hiding to do; we’re conflicted about whether __var plus set_ and get_ helpers is what we should do or if we should get into properties. We’re leaning toward the former, but we’re not certain.

Practical Programming, Python, Teaching

Guido van Rossum reviews “Practical Programming”

June 1st, 2009
Comments Off

Nice to have our book reviewed by the creator of the language we’re using :-) More reviews would be welcome (especially on Amazon.com) — we’d really like to hear what current and potential readers/users think.

Practical Programming

A Package Just Arrived

May 13th, 2009

There was a box waiting for me in the mailroom today.  “Oh,” I thought, “That was quick—Amazon usually takes at least a week.”  But it wasn’t Amazon—no, it was my first five copies of Practical Programming, each in its own individual bubblewrap sleeve.  W00t!  And woo hoo!  And don’t you dare say “errata” or “second edition”, at least not yet—I have a moment I’d like to savor.

Thanks again to Jennifer, Paul, and Jason (co-authors) and to Dan Steinberg at Pragmatic—yay!

Books, Practical Programming, Teaching

Suitable for High School Students

May 12th, 2009
Comments Off

A couple of people have asked whether Practical Programming is suitable for high school students. The answer is yes, particularly if they’re interested in science as well as programming. And of course, the Wing 101 IDE we recommend is free.

practical-programming-cover

Practical Programming

Instructor Review Copies

May 6th, 2009
Comments Off

If you’re teaching a computer science course, and would like a review copy of Practical Programming, please send email to support@pragprog.com with:

  • Instructor name
  • Institution name
  • Course name
  • Course size
  • Number of times offered per year
  • Whether you’d like paper or ebook (save trees!)

Practical Programming

“Practical Programming” Is Available

May 5th, 2009

Our new book, Practical Programming, is now available from Pragmatic (the publisher) and O’Reilly, as well as on Amazon.com — yay! Topics include:

  • Basic programming from arithmetic to loops and conditionals
  • Using functions and modules to organize programs
  • Using lists, sets, and dictionaries to organize data
  • Designing algorithms systematically
  • Debugging things when they go wrong
  • Creating and querying databases
  • Building graphical interfaces to make programs easier to use
  • Object-oriented programming and programming patterns

Practical Programming

Books, Practical Programming

Things I’d Like To Finish In the Next 489 Days

December 26th, 2008

One of the things I teach my students is that the real purpose of a schedule is to tell you when to start cutting corners and dropping features. The ticker on my web site tells me I have 489 days left in my contract with the university; I signed up hoping to study ways of teaching second-stage novices [1] how to be better programmers, but after four failed attempts to get NSERC funding [2], it’s time to lower my sights. Here are the things I’d like to finish off before my stint at U of T is over:

  1. Help Samira Abdi, Jeremy Handcock, and Carolyn MacLeod finish their Master’s theses, and get Aran Donohue, Alecia Fowler, Alicia Grubb, Zachary Kincaid, Jason Montojo, and Rory Tulk through theirs.
  2. Publish Practical Programming (the “CS-1 in Python” book that Jennifer Campbell, Paul Gries, Jason Montojo, and I have been writing). It’s currently in beta, and due for release in a month or so; we’d like to do a Python 3 update in a year or so, but that’s likely to slip.
  3. Finish the study of how scientists actually use computers. Data from the initial survey is now being processed; we’ll put together a follow-up survey in the next couple of months, write a “popular science” paper for American Scientist in the spring, present results at the SECSE workshop in Vancouver in May, and submit a paper by year’s end.
  4. Co-edit a special issue of Computing in Science & Engineering on “Software Engineering and Computational Science”. Andy Lumsdaine and I have four articles lined up, and are looking for two more—if you’d like to volunteer, please give me a shout.
  5. Submit a proposal for a professional master’s degree in Computer Science to U of T’s School of Graduate Studies. This is mostly a matter of filling in forms, but that’s kind of like looking at Everest and saying, “It’s mostly a matter of going uphill.”
  6. “Finish” a much-improved DrProject. I originally planned to use it as a platform for research, as well as teaching; there isn’t enough time left for that, but I still hope to make it easier for software engineering instructors to introduce students to modern tools.
  7. Rewrite Software Carpentry. Tina Yee has translated some of the lectures into MATLAB; the next step is to make the whole thing look like it was written in the 21st Century [3].

Everything else has to go by the boards. In particular:

  • I have resigned from my contributing editor post at Doctor Dobb’s Journal. It was a lot of fun, and I really enjoyed working with Jon Erickson, but as I said back in October, I’d rather not do it than do it badly.
  • The software developers’ reading group I’d planned to start this January isn’t going to happen. I’d really like something to pick up the slack now that DemoCamp seems to have stalled (if only to provide an excuse to get together with former students on a regular basis), but someone else is going to have to organize it.
  • After this term, I’m going to stop supervising student projects (except those directly relevant to DrProject and/or Software Carpentry). Next to 10:00 am coffee breaks with the lecturers, this is the part of university life I enjoy the most, but there just isn’t time… :-(
  • The Software Project Coloring Book (my attempt to write down everything I try to teach undergraduates about real-world software development) is being put back on the shelf. I have written 35,000 words, but those were the easy bits: conservatively, I’d need 4-6 months of full-time work to finish it off.

On the upside, Sadie got me some biking gear for Christmas, so now I’ll have to shed the twenty pounds I’ve picked up in the last couple of years, and I get to start taking our daughter to music classes every week. To quote a friend, it isn’t what I planned—it’s better.

[1] People who already know how to write programs, but not how to develop applications. I’m specifically interested in undergraduate Computer Science students, and graduate students in other disciplines.

[2] Companies like Nitido, the Jonah Group, Idee, and Rogers have kindly donated a few thousand dollars each to keep things like DrProject going, as have several of my fellow professors, but a $24K grant from The MathWorks is the only “research” funding I’ve been able to raise.

[3] As I said yesterday, I’m looking for a mentor in the Toronto area who can show me how to do this.

Basie, DrProject, Practical Programming, Research, Software Carpentry, Teaching, Writing