Sunday, November 27, 2011

Some advice for beginner programmers

In beginning computer science courses (like cs125 here at BSU) there are typically two kinds of students. The first group has programming experience. These students don't have any problems in beginning cs courses. The second group has never programmed before, a lot of these students have real trouble.

About a week ago I was talking with someone in my English class who is planning to take cs125 next semester. When ever I talk to someone like I always ending up telling them the same stuff. So I thought it might be useful to make a blog post to refer to on those occasions. For those of you who already have programming experience, I'd be very interested in what you think of this post and if you have any more thoughts to add or resources to recommend.

The best advice I can give to a beginner is: start programming as soon as possible. Unfortunately, the way most beginning programming courses are taught now you usually don't learn enough to really make anything fun or useful until about the middle of the semester. The reason for this seems to be that teachers think students ought to learn object oriented programming before they learn procedural programming and they spend a lot of time teaching you how to make objects before teaching you what the heck you can do with them. The result is that I see a lot of beginners who just don't have a firm grasp on the basics.

Even if you've only ever taken algebra, procedural programming is easy to understand. It's also called functional programming, remember functions? f(x) = x^2 is an example of a function. Functional programs are essentially more complicated functions, which themselves call functions, and which in turn call more functions and so on. A common functional programming language (although more expert programmers might balk at this classification) is C. A lot of other languages like Python and JavaScript allow you to write in both object oriented and procedural code. What I like about procedural code it's easy to start writing stuff that does useful and interesting things right away. All you need to know are a few basic concepts and you're off and running.

IMHO, object oriented languages like C++ and Java have a bit higher learning curve than procedural languages because they require you to understand abstract concepts like classes and objects. The best way to understand OO (the abreviation of object oriented programming) is through analogies. Think of a microwave. It's got a bunch of buttons that allow you to tell it's innards how long and at what intensity to nuke your burrito. You don't have to understand how the microwave works in order to use it. In fact you'd probably rather not know! Objects are the same way, you put your data and functions together in an object and hide everything except the object's controls. That way anyone who wants to use it doesn't need to know how it works. They just push the buttons. When you make a program in an OO language you model your problem with a bunch of objects and make them interact with one-another in a specified way. For example, you might make player, monster, and map objects for a video game, or you might make checking and savings accounts for an ATM. It's a fine way to make a program, but it's a lot to take in if you've never coded before. Most teachers will disagree with me but my advice is to start with procedural programming.

So, if you're interested in learning to code before you take cs125 at BSU, or some similar programming course, which I strongly recommend, here are some resources that might be useful:

C for dummies
I love this book. The author, Dan Gookin, is entertaining and makes the subject matter very easy to understand. There's a free online copy through the BSU library. You typically have to be logged into both the bsu library (when you click on the link above, a little login link appears just below the listing if you're not logged in) and worldcat (see the upper right link on the page) to access Albertson's Library ebooks. Once you're logged in, click on "other libraries" then hit "ebrary" then click on "ebrary title preview" and you'll see a kind of clunky interface that shows you free copy of the book. For the bigger book (also by Gookin), C for dummies All-in-One you'll have to do an inter-library loan, which is really easy to do. Just click on the handy "request through inter-library loan" link on that page.

You could also try your hand at JavaScript. I should point out that while they have similar names JavaScript has absolutely nothing to do with Java. With JavaScript there is no need to compile and install anything. Any computer is ready for you to start programming right out of the box. All you need is a browser and a simple text editor like notepad. W3Schools is a great resource for all things web-development, and I highly recommend their JavaScript Tutorial. If you don't know HTML, read that tutorial first, it shouldn't take long.

In searching for things to post in this, uh...., post, I found what looks to be a promising book. I've just skimmed this, but Eloquent JavaScript looks to be a very clearly written introduction to programming using JavaScript.

There's also this great interactive JavaScript tutorial. It's called code academy. If you try nothing else in this blog, try this. It's got an interactive command prompt that tells you what to type, then tells you what you just did. It's really slick.

Finally, there's _why. He's the mysterious figure who championed Ruby and then disappeared from the face of the Internet. Thankfully his funny entertaining online book (with comic strips! No seriously, check it out, it's seriously entertaining.) and online interactive programming environment including an interactive tutorial are still available.

No comments:

Post a Comment