Learning to program help?
October 2, 2008 10:24 PM

Help me advance my computer education!

I have been teaching myself computer programming over the past few months by working through this online Python textbook, and trying to complete the exercises on MIT's opencourseware Intro to Computer Science.


The tutorial does an excellent job of explaining the fundamentals and I'm now familiar with basic syntax and structures. However, I'm kind of at a stopping point. I've basically read through the tutorial (and one or two others) twice and finished the exercises in it, but I haven't completely submitted to knowledge everything in it. Just as importantly, the exercises provided in the tutorial cover only the basics and I doubt that if I was faced with a "unique", complex problem that I'd be able to write my own code to solve it.

So I have two questions:

First, based on my past experience in mathematics, the best way to learn new material is to go through a set of exercises/problems, try to do them on my own, and then look at the solutions. The MIT site has exactly what I'm looking for but doesn't have solutions or suggested code, and I've already finished going through that site. Surprisingly, I'm having a lot of trouble finding other sources for these type problems. Can anyone suggest a good place to get exercises with solutions that would help me to learn and practice my skills? Perhaps other college's intro to computer science class websites that make their homework available online (preferably in Python)? Or, alternatively, any suggestions for other ways to reinforce the material?

Second, where to next? After I master the basics that are covered in the "Python for non programmers" tutorial, I'd like to continue to get better and learn how to do more complex things. It doesn't seem like learning another language is a great idea at this point; better to master Python rather than gaining a cursory understanding of several languages. How do I get better? (A side note-programming does not come naturally to me at all, so the advice that I've received from my two computer-nerd friends, "Just start messing around, do cool stuff" has not been helpful at all. I do much better with structured stuff like you would get in a academic course).

Thanks!
posted by btkuhn to Computers & Internet (12 answers total) 20 users marked this as a favorite
Previously
-also-
Dive Into Python is quite a bit more comprehensive than the book you used.
posted by rhizome at 10:37 PM on October 2, 2008


The comp.lang.python newsgroup is a great place to hang out if you want to become a Python expert.
posted by grouse at 11:16 PM on October 2, 2008


You could try out the Python Challenge, especially if you're pretty good with non-programming-related logic puzzles already, because that's a large enough part of it that it can distract from the strictly programming-oriented aspects of the challenge.

While I agree that you should probably stick with Python for a while, if you do find that you learn well by following exercises and you come to be interested in C++ (which, incidentally, integrates fantastically with Python via the Boost::Python library) Stroustrups "The C++ Programming Language" has the most instructive exercises I've ever seen, not just about the language but about computer science in general.

I understand you want something structured but I still feel compelled to echo your ostensibly unhelpful computer-nerd friends in that you should just pick an application that interests you and try to make it happen. It doesn't particularly matter what you pick-- a game, a web server, an organizational tool for your music, a web application-- just that you can think of it in manageable chunks, which then become your exercises. The web server example is particularly easy to partition: you need to figure out how to accept a connection, how to interpret HTTP, how to map requests to local files, how to generate appropriate headers, how to support concurrency, and so on. No one part of the whole is very difficult, most of the learning comes from considering how everything fits together once you have discrete pieces done, and in reconsidering solutions that reveal themselves to have been naive or inelegant.

I've only taken a few classes in the area, but they have been focused on applications like this rather than on simple disconnected exercises. One involved developing a client and a server that communicated with a toy protocol that got more and more complex and full-featured over the semester, another similarly grew a "pond" life simulator from random behaviors expressed in raw data to complex behavior expressed graphically.

posted by moift at 12:09 AM on October 3, 2008


Project Euler has lots of hard problems to try, especially suitable if you have a background in math. No solutions, just a way to check if you are right or wrong.

I sort of agree with your friends though. Think of something cool that needs doing, then script it with Python. This is, I think at least, the best way to learn anything.
posted by tracert at 12:19 AM on October 3, 2008


I sort of agree with your friends though. Think of something cool that needs doing, then script it with Python. This is, I think at least, the best way to learn anything.

Me too. In my opinion, code is not cool on its own merits. Code is cool because it can do things and make things. Make something and you will learn more than hundreds of hours of theory.
posted by drjimmy11 at 12:23 AM on October 3, 2008


better to master Python rather than gaining a cursory understanding of several languages

I agree with you in this. And try and get some small projects off the ground.

One underrated part of CS education is reading code. People usually don't become writers without being readers as well, and the same applies to software development. Try to find some source code, preferably annotated, and read it and try to figure out why the developers did what they did. Googling "reading code" turned up some interesting leads.
posted by Harald74 at 1:19 AM on October 3, 2008


nthing the "Just think of some cool problem and code up an answer."

Barring that, I learnt Python as part of a natural language processing course based on the nltk package. The book starts out with Python and then goes on to delve pretty heavily into, well, natural language processing. Might or might not be up your alley, but if it is nltk can do some pretty neat stuff.
posted by Xany at 3:29 AM on October 3, 2008


It doesn't seem like learning another language is a great idea at this point; better to master Python rather than gaining a cursory understanding of several languages.

Mastering programming itself is very different than mastering a specific programming language. Once you have a solid understanding of programming itself, you can switch between language relatively easily.


I do much better with structured stuff like you would get in a academic course

How to Design Programs is very academic, very structured, and very good. It's what I teach from when I teach intro to programing.

The companion book How to Design Worlds has a couple of fun projects.

The solutions to about half of the exercises are available on the web.
posted by gmarceau at 4:25 AM on October 3, 2008


Niklaus Wirth's classic Algorithms + Data Structures = Programs is well worth acquiring, too.
posted by flabdablet at 5:28 AM on October 3, 2008




Here's the class website for a course I took at Cornell called Computational Methods for Nonlinear Systems. It's completely based on coding in Python and offers exercises almost exactly like what you want. For each exercise there's a pdf file with overall instructions on what to do and .py files that lay out the overall structure of the program with instructions to fill in each module. It's a very gentle way to get used to writing programs in modules and just challenging enough without being overwhelming.
posted by peacheater at 9:54 AM on October 3, 2008


I wonder if part of the problem with "think up something cool and go program it!" is (a) you might not have any cool ideas occur to you and (b) writing an entire program can seem pretty daunting.

My standard advice for this sort of question:

Find an open source python project and look for a bug or two to fix. These are typically small, discrete tasks, much like programming exercises.

As a follow-on to Harald74's excellent comment about reading code, I might also suggest blogging about this - reading code out loud. Pick an established program written in python, grab a hunk of code, and read it very deliberately - but read it "out loud", blogging what you're reading for the edification of others who are learning, too.

"The first line names the function. Okay, now, in the second line, there's a call to a function that's interesting because ... "
posted by kristi at 9:22 PM on October 3, 2008


« Older What is the most common aptitude/job suitabilty...   |   Help me Halloween! Newer »
This thread is closed to new comments.