views:

287

answers:

8

So you've got someone who hasn't done any programming at all in their life. They want to try out programming. How would you suggest they learn? (the method used might vary with beginner's age)

Please state the logic behind your choices

+6  A: 

I would start by asking why they want to learn programming. Eventually, they'll probably end up learning lots of different types and usages of writing your own code, but first: ask what their main interest is. Do they want to do web programming? Desktop? Something else? Are they interested in programming because they have a specific task they want to complete, or just because it sounds so exciting? Do they want to learn quick and hacky stuff for personal use, or do they want to learn in "the right way" from the beginning? Also, are you going to be the teacher, or is it OK to forward them to a local university to take a class or two?

Depending on the novice's answer to those first questions, there are a couple of different ways to proceed.

To someone who has never ever seen a line of code before, and has no particular goal with learning, for example python could be a good place to start - mainly since it's quite readable compared to many other languages (no confusing { } blocks or other confusing symbols), and also because it forces the programmer to learn indenting from the beginning (which you'll want if you're going to be the teacher...).

If they are interested in a more specific task, and you know an environment in which that task can be fulfilled, just start showing the basics that they'll need to get the job done, and explain programming theory along the way. If they're interested, they'll learn the rest on the internetz ;)

On the other hand, if they want to learn "real" programming, and - say - start their own business, recommend them a book. Someone who gets paid to teach programming (hopefully) does it better.


Sorry for the long post - but it's not an easy question to answer... =)

Tomas Lycken
This is great, save the part about python; lua has several features specifically designed to make it friendlier to the non-programmer.
RCIX
@RCIX: I don't know lua very well so my following comments might be amiss, but I think visual results are often important for beginners and PyQt is what I wished I had when I was stuck with BASIC on the Acorn Electron when I started! The documentation for both Python and Qt is fantastic, it works on many platforms and introduces beginners to many OOD techniques and design patterns from the beginning.I feel like the future of software development will be quite bright if we raise them on technologies like this.
That's very true, in that case i would recommend another language, like SmallBasic http://msdn.microsoft.com/en-us/devlabs/cc950524.aspx That offers stuff like Flickr access and a Logo Turtle!
RCIX
In my opinion, the ultimate language/environment for instant visual feedback is Processing. It's based on Java but pretty easy for beginners to pick up. You can draw something with literally a single line of code, or you can have a function for a draw loop for more complex things. http://processing.org/
jtbandes
You pretty much covered everything, so I won't post my own answer. But I will stress that you don't start by teaching pseudo-code. That's how my college professor did it and it was a HUGE mistake. There are little to no rules in pseudo-code, so when the students got to use an *actual* programming language, they thought they could bend the syntax whenever they wanted and were completely stumped when it didn't work.
David Brown
A: 

Obviously the first thing is to choose a language. It's important that beginners use a language that is simple yet powerful but doesn't teach bad habits. Beginners often need visual results quickly to kick off their enthusiasm. In that case my recommendation would be Python, followed by PyQt. For power users Python has some flaws but overall it is excellent.

Start with some simple programs,"Hello World", some loops, some function calls in individual scripts.

After that, introduce programs that create a few classes and try to explain Object Oriented Programming.

You don't mention how much time you have with this beginner but toward the end of the "education" I would introduce them to PyQt. Whether they are using Windows, Linux, or OSX, it is important that prospective programmers realise that they are writing their program on a particular platform and it might need to be ported to another. Say their nice program needs to write it's output to DVD - well that's platform specific so you need to demonstrate abstraction, in this case how to perform the operation dependent on the platform.

A: 

The curriculum should encourage putting the learned programming constructs to practical use in various different ways. Different people find different things interesting, so it should be possible to try out different things (text processing, graphics, GUI/Web programming) with minimal extra learning curve. Python is the ideal choice for a beginners curriculum, because

  • It's easy to learn
  • Standard and 3rd party libraries are great
  • Plenty of resources on using it to teach programming
  • Used in real world programming
Imran
like http://msdn.microsoft.com/en-us/devlabs/cc950524.aspx ?
RCIX
A: 

I would start by asking them what they're interested in other than programming. This is so I can choose good motivating examples for exercises -- I think that motivation is the most important factor for success.

I usually recommend Python as a starting language. It's nice, clean, imperative/oo language, and there are libraries for all sorts of stuff, so you can actually do some pretty impressive things without heroic effort.

Also, Python has an interactive console, so you can start teaching small: start with expressions and work your way up to loops, functions, et cetera.

It is true, as you say, that it strongly depends on their age, their mathematical maturity, and their preferred style of learning. As long as you take that into account, though, I can't really think of much I would change from the above. Ultimately, the most important thing is to keep track of what works and what doesn't; and, if what you've been doing isn't working, try something else.

comingstorm
+1  A: 

Note: This came out rather long. Sorry. Also, I speak of the student as "he". This is obviously meant to refer to either men or women trainees, no offense meant to anyone.

It definitely depends on why they want to start learning, and relatedly, how much they want to learn. If you're trying to get someone who's a little interested hooked on programming, as it were, your job is part marketing (i.e., get them to something they can actually use asap). If they want a thorough course in programming spanning half a year to actually take it up as a profession, that's a whole other story.

I'll assume the person wants to learn, for real, and your job is mainly filling that desire:

First things first

There is absolutely no better way to get started programming than by, well, getting started. I'll second a lot of recommendations for using Python as a first language. It doesn't teach everything he'll need (we'll cover that later), but it's just so easy to get neat stuff out right away.

I'd teach all the basics necessary to get a decent command line application out of Python (obviously starting with basics such as "if"s and "for"s and working up to modules etc). You're going to need a pretty good selection of exercises for trying out all the things, which you can probably find online somewhere or borrow from some university's basic programming course.

In this section, the focus should be on the basic constructs of programming (so much so that I'd hesitate to even get into anything too Pythonic, since it's going to be less prevalent). I'd also try to build a "final exercise" that actually does something useful: this will depend on the person actually doing the learning, but some easy examples will be to write command-line programs that do all sorts of processing on his MP3 collection, for example.

This section will probably take something like 2 months or three, give or take (I'm guessing, not sure how accurate this is).

Now that they know the basics

Probably the next thing I'd do is teach them some kind of way to get a nice looking GUI.

There are two possibilities as I see it:

  1. Learn C# or some other language that will make GUIs easily. I'd consider just teaching PyQT, but this might be bad for a couple of reasons. For one thing, it's going to be harder. For another, learning another language is a Good Thing. He can always come back to PyQT later.
  2. Learn Web Programming. This will involve learning HTML/CSS/Javacsript, which will get him learning more languages, and might work out great since web applications are so much fun, really.

This section is focused on learning new stuff very quickly, using the knowledge gained from learning Python to learn new languages. The advantage also being that now he'll actually have usable programs which can make him proud.

Last but not least

This might be the controversial part, but I'd recommend learning C/C++. It's the lingua franca, the thing all programmers should at least be partially exposed to. I'm not saying master the language, just a basic understanding and a basic project would be nice. I really believe that knowing C/C++ helps me in everything I do.

Extra Credit

There are a ton of things I think programmers need to know. You should choose some of these and expose him to them either at the end or as you're going (mixed in with other exercises). For example, complexity theory, data structures, regexps, network programming, etc. All of these are important, all of these can be explained as part of the rest of the training.

Edan Maor
I would look at http://msdn.microsoft.com/en-us/devlabs/cc950524.aspx if the person isn't interested in web programming.
RCIX
A: 

Another useful thing to start with is the turtle programming. It's very simple, and can be used to explain all the basics: variables, functions, loops, etc. The python turtle package docs are here, but I guess other languages have their turtles as well...

Ofri Raviv
A: 

It's not just about the language but also the book or whatever resources they are going to use to learn to program. I have read many books about programming but never really learned anything from any of them other than the proper syntax for the language. This is only useful to a point. How to program is not just a question of syntax but why you should choose one algorithm over another. That seems to be missing in a lot of books or it just isn't introduced early on enough. That's one of the reasons that I like SICP. The scheme programming language isn't very popular compared to say python or C++ but that's not really important when you first learn to program. After you learn the concepts you can apply them to any language. The advantages to learning with scheme is that there is very little syntax to keep in your head (which makes jumping in that much easier) and learning from a language with a REPL makes things fun and interactive.

Chris
A: 

Curriculum for a beginning programmer

Identify area of learning ? Web development or Desktop development

Define a programming language to teach? Vb.net /C#/Java/Javascript/html

Define method of teaching. Not everyone learns in the same way. Examples go a long way to teach people who are visual in nature. Simple sample allow people to grasp concepts.

Include more that one large project that brings the everything into focus so a user can see how different pieces flow together.

Group programming allows people to work as a team an assist each other in learning topics.

Encourage people to explore the internet for answer.

Have them try to develop small applications on their own.

I've been a developer for 14 years and I'm still learning every day.

Show them sites like www.stackoverflow.com where they can go and ask questions of others.

No programmers has all the answers.

Good books for learning programming:

dietel publishing Apress books Wrox books

Each of these publishers provide books that allow beginning programmes to understand topics at there own pace. They provide a lot of exmples for users to work on. Teach the concept of group learning so people are not afraid to ask questions.

Chuckie