views:

16792

answers:

83

Original Question

I am currently engaged in teaching my brother to program. He is a total beginner, but very smart. (And he actually wants to learn). I've noticed that some of our sessions have gotten bogged down in minor details, and I don't feel I've been very organized. (But the answers to this post have helped a lot.)

What can I do better to teach him effectively? Is there a logical order that I can use to run through concept by concept? Are there complexities I should avoid till later?

The language we are working with is Python, but advice in any language is welcome.


How to Help

If you have good ones please add the following in your answer:

  • Beginner Exercises and Project Ideas
  • Resources for teaching beginners
  • Screencasts / blog posts / free e-books
  • Print books that are good for beginners

Please describe the resource with a link to it so I can take a look. I want everyone to know that I have definitely been using some of these ideas. Your submissions will be aggregated in this post.


Online Resources for teaching beginners:


Recommended Print Books for teaching beginners

+4  A: 

If he's interested, aren't the minor details the good parts? Using python, you've already cut the GUI off of it so that confusion is gone. Why not pick a project, a game or something, and implement it. The classic hi-lo number guessing game can be simply implemented from the command line in 20-30 lines of code (depending on language of course) and gives you variables, conditions, loops, and user input.

jj33
W.r.t. hi-lo: http://stackoverflow.com/questions/811074/what-is-the-coolest-thing-you-can-do-in-10-lines-of-simple-code-help-me-inspir/811759#811759
Stephan202
+2  A: 

First of all, start out like everyone else does: with a Hello World program. It's simple, and it gives them a basic feel for the layout of a program. Try and remember back to when you were first programming, and how difficult some of the concepts were - start simple.

After Hello World, move on to creating some basic variables, arithmetic, then onto boolean logic and if/else statements. If you've got one of your old programming textbooks, check out some of the early examples and have him run through those. Just don't try to introduce too much all at once, or it will be overwhelming and confusing.

bcwood
A: 

I would actually argue to pick a simpler language with fewer instructions. I personally learned on BASIC at home, as did Jeff. This way, you don't have to delve into more complicated issues like object oriented programming, or even procedures if you don't want to. Once he can handle simple control flow, then move on to something a little more complicated, but only simple features.

Maybe start with very simple programs that just add 2 numbers, and then grow to something that might require a branch, then maybe reading input and responding to it, then some kind of loop, and start combining them all together. Just start little and work your way up. Don't do any big projects until he can grasp the fundamentals (otherwise it may very well be too daunting and he could give up midway). Once he's mastered BASIC or whatever you choose, move on to something more complicated.

Just my $0.02

Mike Stone
+2  A: 

Something you should be very mindful of while teaching your brother to program is for him not to rely too heavily on you. Often when I find myself helping others they will begin to think of me as answer book to all of their questions and instead of experimenting to find an answer they simply ask me. Often the best teacher is experimentation and every time your brother has a question like "What will happen if I add 2 to a string?" you should tell him to try it out and see for himself. Also I have noticed that when I cannot get a concept through to someone, it helps to see some sample code where we can look at each segment individually and explain it piece by piece. As a side note people new to programming often have trouble with the idea of object oriented programming, they will say they understand it when you teach it to them but will not get a clear concept of it until actually implementing it.

Anton
+23  A: 

You could try using Alice. It's a 3D program designed for use in introductory programming classes.

The two biggest obstacles for new programmers are often:

  • syntax errors
  • motivation (writing something meaningful and fun rather than contrived)

Alice uses a drag and drop interface for constructing programs, avoiding the possibility of syntax errors. Alice lets you construct 3D worlds and have your code control (simple) 3D characters and animation, which is usually a lot more interesting than implementing linked lists.

Experienced programmers may look down at Alice as a toy and scoff at dragging and dropping lines of code, but research shows that this approach works.

Disclaimer: I worked on Alice.

Jason Pratt
+11  A: 

A good python course is MIT's A Gentle Introduction to Programming Using Python. It's all free online, and you don't have to be an MIT uberstudent to understand it.

Edit [Justin Standard]

This course uses this free online book: How To Think Like a Computer Scientist
I'm definitely finding it quite useful.

Mark Harrison
+85  A: 

I've had to work with several beginner (never wrote a line of code) programmers, and I'll be doing an after school workshop with high school students this fall. This is the closest thing I've got to documentation. It's still a work in progress, but I hope it helps.

1) FizzBuzz. Start with command line programs. You can write some fun games, or tools, very quickly, and you learn all of the language features very quickly without having to learn the GUI tools first. These early apps should be simple enough that you won't need to use any real debugging tools to make them work.

If nothing else things like FizzBuzz are good projects. Your first few apps should not have to deal with DBs, file system, configuration, ect. These are concepts which just confuse most people, and when you're just learning the syntax and basic framework features you really don't need more complexity.

Some projects:

  • Hello World!
  • Take the year of my birth, and calculate my age (just (now - then) no month corrections). (simple math, input, output)
  • Ask for a direction(Up, down, left, right), then tell the user their fate (fall in a hole, find a cake, ect). (Boolean logic)
  • FizzBuzz, but count once every second. (Loops, timers, and more logic)
  • Depending on their age some really like an app which calls the users a random insult at some interval. (Loops, arrays, timers, and random if you make the interval random)

2) Simple Project Once they have a good grasp of language features, you can start a project(simple, fun games work good.). You should try to have the first project be able to be completed within 6-12 hours. Don't spend time to architect it early. Let them design it even if it sucks. If it falls apart, talk about what happened and why it failed, then pick another topic and start again.

This is where you start introducing the debugging capabilities of your tools. Even if you can see the problem by reading the code you should teach them how to use the tools, and then show them how you could see it. That serves the dual purpose of teaching the debugging tools and teaching how to ID errors without tools.

Once, or if, the project gets functional you can use it to introduce refactoring tools. Its good if you can then expand the project with some simple features which you never planned for. This usually means refactoring and significant debugging, since very few people write even half decent code their first time.

Some projects:

  • Hangman game
  • Experimenting with robotics(Vex and Mindstorms are options)

3) Real Project Start a real project which may take some time. Use proper source control, and make a point to have a schedule. Run this project like a real project, if nothing else its good experience having to deal with the tools.

Obviously you need to adjust this for each person. The most important thing I've found is to make even the first simple apps apply to what the person is interested in.

Some projects:

  • Tetris
  • Text file based blog engine
  • More advanced robotics work
Eric Haskins
Don't apologize for a long post.
Brad Gilbert
This is a great guide. Personally, I cannot code my way out of a paper bag (I'd like to see someone do that in real life, actually), so this looks like a good guide for teaching myself too.
keyofnight
This is a very good answer. My only objection is that Tetris not a good choice for a first or second game. At that level, the collision detection can be a hard problem - it's great if they can solve it.
phkahler
@phkahler I see your point, but I believe Tetris is interesting because there are so many OSS/demo implementation you can analize before and after writing your code.
Eric Haskins
+2  A: 

I used to teach programming and your brother has one main advantage over most of my students he wants to learn :)

If you decide to go with C a friend has a site that has the sort of programs those of use from older generations remember as basic type-ins. The more complex of them use ncurses which sort of negates their use as a teaching aid somewhat but some of them are tiny little things and you can learn loads without being taught to.

Personally I think Python and Ruby would make great first languages.

EDIT: list of beginner programming assignments appeared overnight might be just what you are looking for.

sparkes
A: 

I think the "wisdom of crowds" work here. How did most people learn how to program? Many claim that they did so by copying programs of others, usually games they wanted to play in BASIC.

Maybe that route will work with him too?

Jon Limjap
+1  A: 

If you want to teach the basics of programming, without being language specific, there is an application called Scratch that was created in MIT. It's designed to help people develop programming skills. As users create Scratch projects, they learn to create conditions, loops, etc. There is a also a community of scratch projects, form which projects can be downloaded - that way you can explore other people's programs and see how they were built.

Lea Cohen
+27  A: 

I recently wrote an article titled How to teach your girlfriend programming, it has little to do with girlfriends and everything about teaching something technical to someone that does not understand it.

I'm told it's also funny.

Teifion
Thanks a lot! That one goes to my delicious links. ;)
macbirdie
Happy to have helped :)
Teifion
I let my girlfriend read this and she said it was offensive in its "sexist" assumptions about "girls". (ie. that you must explain things to them on "their terms" -- she takes issue with the idea of "girls" having "terms"). Just FYI.
Rahul
Rahul's girlfriend is a moron. Just putting that out there.
superjoe30
I don't think she's a moron. I emailed Rahul and I think she simply misunderstood what I meant with some parts. You don't need to be moronic to misunderstand someone.
Teifion
If Rahul's GF is a moron so are those privileged morons of SO who marked my question as offensive : "Why there are more men programmers than women programmers". I had stated that all SO toppers are men. Those people who gave me 11 downvotes and 6 offensive votes are morons too. Ate away my 100 rep.
Chandan .
That link is dead now.
HMage
Thanks, I've re-uploaded it somewhere the link won't break so fast.
Teifion
+1 Excellent article. I'm glad I found it.
claws
+2  A: 

It really depends on your brother's learning style. Many people learn faster by getting their hands dirty & just getting into it, crystallising the concepts and the big picture as they progress and build their knowledge.

Me, I prefer to start with the big picture and drill down into the nitty-gritty. The first thing I wanted to know was how it all fits together then all that Object-oriented gobbledygook, then about classes & instances and so-on. I like to know the underlying concepts and a bit of theory before I learn the syntax. I had a bit of an advantage because I wrote some games in BASIC 20 years ago but nothing much since.

Perhaps it is useful to shadow a production process by starting with an overall mission statement, then a plan and/or flowchart, then elaborate into some pseudo code (leaning towards the syntax you will ultimately use) before actually writing the code.

The golden rule here is to suss out your student's leaning style.

CAD bloke
+7  A: 

Try Ruby (In Your Browser)

CodingWithoutComments
Nice! It seems easy and powerful to use Ruby
Luc M
A: 

I agree with Leac. I actually play with Scratch sometimes if I'm bored. It's a pretty fun visual way of looking at code.

How it works is, they give you a bunch of "blocks" (these look like legos) which you can stack. And by stacking these blocks, and interacting with the canvas (where you put your sprites, graphics), you can create games, movies, slideshows... it's really interesting.

When it's complete you can upload it right to the Scratch websites, which is a youtube-ish portal for Scratch applications. Not only that, but you can download any submission on the website, and learn from or extend other Scratch applications.

Kevin
+5  A: 

This is a fantastic book which my little brothers used to learn:

http://pine.fm/LearnToProgram/

Of course, the most important thing is to start on a real, useful program of some kind IMMEDIATELY after finishing the book.

Jarin Udom
A: 

I recommend starting them off with C/C++. I find that it is a good foundation for just about every other language. Also, the different versions of BASIC can be pretty dodgy, at best, and have no real correlation to actual programming.

Ed
A: 

I think learning to program because you want to learn to program will never be as good as learning to program because you want to DO something. If you can find something that your brother is interested in making work because he wants to make it work, you can just leave him with Google and he'll do it. And he'll have you around to check he's going along the right path.

I think one of the biggest problems with teaching programming in the abstract is that it's not got a real-world context that the learner can get emotionally invested in. Programming is hard, and there has to be some real payoff to make it worth the effort of doing it. In my case, I'd done computer science at uni, learned Pascal and COBOL there, and learned BASIC at home before that, but I never really got anywhere with it until I became a self-employed web designer back in the 90s and my clients needed functionality on their web sites, and were willing to pay about 10x more for functionality than for design. Putting food on the table is a hell of a motivator!

So I learned Perl, then ASP/VBScript, then JavaScript, then Flash/ActionScript then PHP - all in order to make the stuff I wanted to happen.

Flubba
+1  A: 

I think that once he has the basics (variables, loops, etc) down you should try to help him find something specific that he is interested in and help him learn the necessities to make it happen. I know that I am much more inclined and motivated to do something if it's of interest to me. Also, make sure to let him struggle though some of the tougher problems, nothing is more satisfying than the moment you figure it out on your own.

DanV
+3  A: 

I'd just let him write tons of code. Let him drive in everything you guys do, and just be available to answer questions.

Believe it or not, after a few months of writings tons of crappy code, he'll start to get the idea and start writing better programs. At that point, you can get bogged down in details (memory, etc), and also talk about general design principles.

I've heard that what separates the great artists from the mediocre ones, is that every time they practice, they improve on something, no matter how small. Let your brother practice, and he'll improve every time he sits down at the keyboard.

Edit: [Justin Standard]

Esteban, this reminds me of a recent coding horror post, and I do think you are right. But I think its still worthwhile to find methods to guide his practice. No question, I want him writing as much code as he knows how to do. Thats one reason I'm asking for sample projects.

Esteban Araya
Yes, I know which post you're talking about Justin. Reading it reminded me how most of the things I've learned have come from trying and learning from my own mistakes. I really can't emphasize enought the importance of learning by doing!
Esteban Araya
+1  A: 

I was taught by learning how to solve problems in a language agnostic way using flowcharts and PDL (Program Design Language). After a couple weeks of that, I learned to convert the PDL I had written to a language. I am glad I learned that way because I have spent the majority of my years programming, solving problems without being tied to a language. What language I use has always been an implementation detail and not part of the design.

Having to solve the problem by breaking it down into it's basic steps is a key skill. I think it is one of the things that separates those that can program from those that can't.

As far as how you tackle the order of concepts of a language I believe the easiest way is to decide that is to have a project in mind and tackle the concepts as they are needed. This lets you apply them as they are needed on something that you are interested in doing. When learning a language it is good to have several simple projects in mind and a few with progressive complexity. Deciding on those will help you map out the concepts that are needed and their order.

bruceatk
A: 

First off, I think there has already been some great answers, so I will try not to dupe too much.

  • Get them to write lots of code, keep them asking questions to keep the brain juices flowing.
  • I would say dont get bogged down with the really detailed information until they either run in to the implications of them, or they ask.

I think one of the biggest points I would ensure is that they understand the core concepts of a framework. I know you are working in Python (which I have no clue about) but for example, with ASP.NET getting people to understand the page/code behind model can be a real challenge, but its critical that they understand it. As an example, I recently had a question on a forum about "where do I put my data-access code, in the 'cs' file or the 'aspx' file".

So I would say, for the most part, let them guide the way, just be there to support them where needed, and prompt more questions to maintain interest. Just ensure they have the fundamentals down, and dont let them run before they can walk.

Good Luck!

Rob Cooper
+1  A: 

I would recommend also watching some screencasts - they are generally created in context of a specific technology not a language, though if there's Python code displayed, that'll do :). The point is - they're created by some good programmers and watching how good programmers program is a good thing. You and your brother could do some peer programming as well, that might be an even better idea. Just don't forget to explain WHY you do something this way and not that way. I think the best way to learn programming is from good examples and try not to even see the bad ones.

martinsb
+1  A: 

Robert Read wrote a useful guide, How to be a Programmer, which covers a wide area of programming issues that a beginner would find helpful.

David
+1  A: 

There have already been a bunch of great answers, but for an absolute beginner, I would wholeheartedly recommend Hackety Hack. It was created by the unreasonably prolific whythelucky_stiff specifically to provide a BASIC/LOGO/Pascal-like environment for new programmers to experiment in. It's essentially a slick Ruby IDE with some great libraries (flash video, IM, web server) and interactive lessons. It makes a good pitch for programming, as it chose lessons that do fun, useful things. "Hello, world" may not impress right off the bat, but creating a custom IM client in 20 minutes can inspire someone to keep learning. Have fun!

+1  A: 

Copy some simple code line by line and get them to read and interpret it as they go along. They will soon work it out. I started programming on an Acorn Electron with snippets of code from Acorn magazines. I had no idea about programming when I was 6, I used to copy the text, but gradually I learnt what the different words meant.

Mark Ingram
A: 

I would recommend in first teaching the very basics that are used in almost every language, but doing so without a language. Outline all the basic concepts If-Else If-Else, Loops, Classes, Variable Types, Structures, etc. Everything that is the foundation of most languages. Then move onto really understanding Boolean, comparisons and complex AND OR statements, to get the feeling on what the outcomes are for more complex statements.

By doing it this way he will understand the concepts of programming and have a much easier time stepping into languages, from there its just learning the intricate details of the languages, its functions, and syntax.

Tanerax
A: 

My favourite "start learning to code" project is the Game Snakes or Tron because it allows you to start slow (variables to store the current "worm position", arrays to store the worm positions if the worm is longer than one "piece", loops to make the worm move, if/switch to allow the user to change the worm's direction, ...). It also allows to include more and more stuff into the project in the long run, e.g. object oriented programming (one worm is one object with the chance to have two worms at the same time) with inheritance (go from "Snakes" to "Tron" or the other way around, where the worm slightly changes behavior).

I'd suggest that you use Microsoft's XNA to start. In my experience starting to program is much more fun if you can see something on your screen, and XNA makes it really easy to get something moving on the screen. It's quite easy to do little changes and get another look, e.g. by changing colors, so he can see that his actions have an effect -> Impression of success. Success is fun, which is a great motivation to keep on learning.

BlaM
+1  A: 

This may sound dumb, but why are YOU trying to teach your brother to program?

Often the best learning environment consists of an goal that can be achieved by a keen beginner (a sample program), an ample supply of resources (google/tutorials/books), and a knowledgeable source of advice that can provide guidance when needed.

You can definitely help with suggestions for the first two, but the last is your primary role.

Andrew Grant
because hanging out is fun.
Yar
+1  A: 

I'd suggest taking an approach similiar to that of the book, Accelerated C++ in which they cover parts of C++ that are generally useful for making simple programs. For anyone new to programming I think having something to show for a little amount of effort is a good way to keep them interested. Once you have covered the fundamentals of Python then you should sit back and let him experiement with the language.

In one of my University subjects for this semester they have taken an approach called Problem Based Learning(PBL) in which they use lectures to stimulate students about different approaches to problems. Since your brother is keen you should take a similiar approach. Set him small projects to work on and let him figure it out for himself. Then once he is finished you can go through his approach and compare and contrast with different methods.

If you can give him just the right amount of help to steer him in the right direction then he should be fine. Providng him with some good websites and books would also be a good idea.

I'd also recommend sticking away from IDE's at the starting stages. Using the command line and a text editor will give him a greater understanding of the processes involved in compiling/assembling code.

I hope I've been of some help. :)

Nexus
A: 

This thread is very useful to me as a beginner (>100 lines of code) programmer.

Based on what I have been through, once I finished with the "Hello World" and move to variables and "if/else" statement, I got zapped with too much syntax; not knowing what to do with them.

So with an interesting simple project, I might get my interest up again. There are quite alot of project suggestions here.

Can I ask a questions here?

Is it better to learn a scripting language like Autohotkey first?

Edit: [Justin Standard]

I think learning something macro-based like Autohotkey will only help minimally. Try learning a "real" programming language first. The easiest to get started with (according to most people) are python and ruby. I favor python, but both are pretty simple. There is also a full stackoverflow post that answers the question of which language to start with.

qwertyuu
A: 

At first I was interested in how different programs worked, so I started by looking at the source code. Then when I began to understand how the program worked, I would change certain parameters to see what would happen. So basically I learned how to read before I learned how to write. Which coincidently is how most people learn English.

So if I was trying to teach someone how to program I would give them a small program to try to read and understand how it works, and have them just just play around with the source code.

Only then would I give them "assignments" to try to accomplish.

Now if they had a particular reason for wanting to learn how to program, it would certainly be a good idea to start with something along the lines of what they want to accomplish. For example if they wanted to be proficient in an application like blender, it would definably be a good idea to start with Alice.

I would absolutely recommend sticking with a language that has garbage collection, like D, Perl, or some interpreted language like javascript. It might be a good idea to stay away from Perl until Perl 6 is closer to completion, because it fixes some of the difficulties of reading and understanding Perl.

Brad Gilbert
A: 

Plenty of things tripped me up in the beginning, but none more than simple mechanics. Concepts, I took to immediately. But miss a closing brace? Easy to do, and often hard to debug, in a non-trivial program.

So, my humble advice is: don't understimate the basics (like good typing). It sounds remedial, and even silly, but it saved me so much grief early in my learning process when I stumbled upon the simple technique of typing the complete "skeleton" of a code structure and then just filling it in.

For an "if" statement in Python, start with:

if  :

In C/C++/C#/Java:

if () 
{

}

In Pascal/Delphi:

If () Then
Begin

End

Then, type between the opening and closing tokens. Once this becomes a solid habit, so you do it without thinking, more of the brain is freed up to do the fun stuff. Not a very flashy bit of advice to post, I admit, but one that I have personally seen do a lot of good!

Edit: [Justin Standard]

Thanks for your contribution, Wing. Related to what you said, one of the things I've tried to help my brother remember the syntax for python scoping, is that every time there's a colon, he needs to indent the next line, and any time he thinks he should indent, there better be a colon ending the previous line.

Wing
A: 

My personal experience started back in elementary using Logo Writer (which in a way has evolved into Scratch), granted I was a little kid and computers where not as awesome as they are nowadays, but for the time being it took me places I hadn't been before... I think that's how I got hooked in the business... I could say that it was these first impressions based on such simplicity and coolness that made the goods that stick into my head for life. That's how basics in teaching programming should be taught... a simple process that yearns magic.

Back to my first CS 101, I started with notions of what an algorithm was by building a Tequila Sunrise (a step by step process that could be repeated at any time with the right ingredients, that will result in the same output), from there we move on to basic math functions using Scheme (like EHaskins was saying... start small and then build up), and from there to notions of loops, Boolean logic, structures and then building into concepts of objects and some simulation executions...

One of the good things about this approach is that language was not a goal but just a tool in the process of learning the concepts and basics of programming (just like operators, functions and else are in mathematics).

IMHO learning the basics of programming and creating a foundation is probably the best thing you could teach your brother, once the goal is covered then u can move on into a more general use language like python and teach them higher concepts like architecture and design patterns (make them natural in the process so he will get use to good practices from early stages and will see them as part of the process)... we are far from reinventing the warm water, but we always have to start by creating fire.

From there on the sky is the limit!

Cheers!

samiq
+1  A: 

How about this: Spawning the next generation of hackers by Nat Torkington.

Peter Stuifzand
A: 

In my biased opinion, C is the best point to start. The language is small, it's high level features are ubiquitous and the low level features let you learn the machine.

I found the C Primer Plus, 5th Edition very helpful as a beginning programmer with almost no programming experience. It assumes no prior programming experience, fun to read and covers C in depth (including the latest C99 standard).

Imran
+1  A: 

There is a book called Code. I can't remember who wrote it, but it goes through the basics of a lot of stuff that we (programmers) know and take for granted that people we talk to know also. Everything from how do you count binary to how processors work. It doesn't have anything dealing with programming languages in it (well from what I remember), but it is a pretty good primer. I will admit that I am also of the school that believes you have to know how the computer works to be able to effectively program things for it.

Kevin
Guess it is the Charles Petzold Book http://is.gd/3oes
rshimoda
+20  A: 
Magus
+2  A: 

If your brother has access to iTunes, he can download video lectures of an introductory computer science course given by Richard Buckland at the University of New South Wales. He's an engaging instructor and covers fundamentals of computing and the C language. If nothing else, tell your brother to play the vids in the background and some concepts might sink in through osmosis. :)

COMP1917 Higher Computing - 2008 Session 1 http://deimos3.apple.com/WebObjects/Core.woa/Browse/unsw.edu.au.1504975442.01504975444

If the link doesn't work, here's a path:

Home -> iTunes U --> Engineering --> COMP1917 Higher Computing - 2008 Session 1

A: 

For me, exploring and experimenting within the IDE itself helped me to learn Java and Visual Basic, but I learnt the basics of programming the hard way: Perl 5. There wasn't a free IDE back then, so it meant typing codes into Notepad, saving it, and then run the perl interpreter.

I'd say that IDEs make learning the basics of programming easier. Try playing around with control structures and variables first. Say in Java:

int a = 5;

for (int i = 0; i < a; i++) {
     System.out.println("i is now " + i);
}

Basically, simply learning the control structures and variables would allow a beginner to start coding fun stuff already.

pkchukiss
+7  A: 

The key thing is that the person in question needs to have some problem that they want solving. If you don't have a program that you want to write (and something sensible and well-defined, not "I want to write the next Quake!") then you can't learn to program, because you have nothing to motivate you. I mean, you could read a book and have a rough understanding of a language's syntax and semantics, but until you have a program that you want written you'll never grasp the nettle.

If that impetus exists then everything else is just minor details.

DrPizza
The best way to learn any technical subject, I think, is by learning to solve small, incremental problems.
banzaimonkey
+1  A: 

Python is easy for new developers to learn. You don't get tangled up in the specifics of memory management and type definition. Dive Into Python is a good beginners guide to python programming. When my sister wanted to learn programing I pointed her to the "Head Start" line of books which she found very easy to read and understand. I find it's hard to just start teaching someone because you don't have a lexicon to use with them. First have him read a few books or tutorials and ask you for questions. From there you can assign projects and grade them. I find it hard to teach programming because I learned it over nearly 15 years of tinkering around.

Acuminate
+1  A: 

Project Euler has a number of interesting mathematics problems that could provide great material for a beginning programmer to cut her teeth on. The problems begin easy and increase in difficulty and the web is full of sample solutions in various programming languages.

Jared Updike
+1  A: 

I'd recommend Charles Petzold's book Code - The Hidden Langauge of Computer Hardware and Software as an excellent general introduction to how computers work.

There's a lot of information in the book (382 pages) and it may take an absolute beginner some time to read but it's well worth it. Petzold manages to explain many of the core concepts of computers and programming from simple codes, relays, memory, CPUs to operating systems & GUIs in a very clear and enjoyable way. It will provide any reader with a good sense of what's actually happening behind the scenes when they write code.

I certainly wish it was around when I was first learning to program!

Jonathan Webb
+2  A: 

there's a wikibook that is pretty good for learning python.

I don't know how the wikibooks are for other languages, but I personally learned python from the wikibook as it was in Feb 2007

ps - if you're unfamiliar with wikibooks, it's basically the wikipedia version of book authoring. it's sort of hard to describe, but if you check out a few of the books on there you'll see how it works

Jiaaro
+1  A: 

I don't know for sure what will be the best for your brother, but I know I started with python. I've been playing various games from a very early age and wanted to make my own, so my uncle introduced me to python with the pygame library. It has many tutorials and makes it all easy (WAY easier than openGL in my opinion). It is limited to 2d, but you should be starting out simple anyway.

My uncle recommended python because he was interested in it at the time, but I recommend it, now fairly knowledgeable, because it's easy to learn, intuitive (or as intuitive as a programming language can get), and simple (but certainly not simplistic).

I personally found basic programming simply to learn programming obscenely boring at the time, but picked up considerable enthusiasm as I went. I really wanted to be learning in order to build something, not just to learn it.

dwestbrook
A: 

The best way to learn anything is to start with the basic. You can find any good text book to explain what programming is, memory, algorithms.

The next step select the language which it just depends on what the teacher knows or why the student wants to learn.

Then it is just code, code, code. Code every example right from the book. Then change it slightly to do another action. Learning to program is an active process not a passive one. You can't just read C++ How to Program by Dietal and then expect to code C++ without having actively done it while reading.

Even if you are an experienced coder it helps to write the code in the book to learn something new.

David Basarab
+1  A: 

Begin by asking him this question: "What kinds of things do you want to do with your computer?"

Then choose a set of activities that fit his answer, and choose a language that allows those things to be done. All the better if it's a simple (or simplifiable) scripting environment (e.g. Applescript, Ruby, any shell (Ksh, Bash, or even .bat files).

The reasons are:

  1. If he's interested in the results, he'll probably be more motivated than if you're having him count Fibonacci's rabbits.
  2. If he's getting results he likes, he'll probably think up variations on the activities you create.
  3. If you're teaching him, he's not pursuing a serious career (yet); there's always time to switch to "industrial strength" languages later.
joel.neely
+1  A: 

A good resource to teach young people is the free eBook "Invent your own games with Python":

http://pythonbook.coffeeghost.net/book1/IYOCGwP_book1.pdf

Martin Salias
A: 

Something to consider ... not everyone is capable of programming:

Some people just cannot get past things like:

A = 1

B = 2

A = B

(these people will still think A = 1)

Jeff has talked about this too. In fact, my example is in the link (and explained, to boot).

Ja7on
A: 

It may seem weird, but I got started writing code by automating the tasks and data analysis at my former job. This was accomplished by recording then studying the code an Excel macro generated. Of course this approach assumes you can learn via VB.

deadbug
A: 

Some additional information that someone could attach to Jason Pratt's earlier post on Alice ... specifically, a Storytelling Alice variant.

Although the study presented targets middle school girls, you may find the white paper written by Caitlin Kelleher interesting.

Luther Baker
A: 

One I used with my kids is CEEBot. It's not python, but it teaches C / Java style programming in a fun, robot-programming kind of game. It is aimed at 10-15 year olds, but it is a really good one.

GrizzlyGuru
A: 

Having small, obtainable goals is one of the greatest ways to learn any skill. Programming is no different. Python is a great language to start with because it is easy to learn, clean and can still do advanced things. Python is only limited by your imagination.

One way to really get someone interested is to give them small projects that they can do in an hour or so. When I originally started learning python I playing Code Golf. They have many small challenges that will help teach the basics of programming. I would recommend just trying to solve one of the challenges a day and then playing with the concepts learned. You've got to make learning to program fun or the interest will be lost very quickly.

David Lambert
+1  A: 

If he is interested than I wouldn't worry about focusing on games or whatnot. I'd just grab that beginners 'teach yourself x' book you were about to throw and give it him and let him struggle through it. Maybe talk about it after and then do another and another. After then I'd pair program with him so he could learn how shallow and lame those books he read were. Then I'd start having him code something for himself. A website to track softball stats or whatever would engage him. For me it was a database for wine back in the day.

After that I would start in on the real books, domain design, etc.

Jake Hackl
+2  A: 
J.F. Sebastian
+10  A: 
J.F. Sebastian
Good for just after they've learned the basic concepts. Creating visuals is a great way to motivate people to learn programming.
phkahler
+1  A: 

I skimmed through the comments and looks like nobody mentioned Foundations of Programming from www.CodeBetter.com. Although it requires a bit of foundation, it can certainly be a next step in the learning process.

Gürkan Yeniçeri
A: 

As a non-programmer myself, I found the book "How to Program" from Pragmatic Programmers very helpful from a rudimentary standpoint. It's approachable and easy to read for a beginner. It won't take you from beginner to expert, but it will prepare you for what to do once you pick a language and pick up your first "Learn to Program in (language here)" book.

BrewinBombers
A: 

A couple of other starting platforms:

  • A good programmable calculator (that's what I learnt on back in the 70s), and HP25 then HP41, now TI69, etc.
  • Interactive Fiction platforms, like "Inform 7" provide another angle on the whole thing
  • Flash/ActionScript

All of these are different and engaging, and any one of these might spark the kind of interest that is required to get a beginner of and running.

LBB

leeborkman
A: 

I'd recommend Think Python.

Jean Pierre Rupp
+1  A: 

Once he has the basics, I suggest the Tower of Hanoi as a good exercise. I recommend beginning with the wooden toy if you have one; let him try to solve the problem by himself and describe his method in a systematic way. Show him where recursion comes into play. Explain him how the number of moves depends on the number of disks. Then let him write a program to print the sequence of moves, in your language of choice.

Federico Ramponi
A: 

Your question quite depends on age and education of your brother, but if he is a child/teenager, I would recommend to do some GUI programming or graphic programming first (with Canvas etc.). It looks good, and you have immediate results. Algorithms are boring, and too abstract for young people (before say 15 years old).

When I started programming on ZX Spectrum (I was like 12 years old), I liked to draw various things on the screen, and it was still interesting. I didn't learn about real algorithmic techniques until I was maybe 18. Don't be mislead that such "simple" programming is a wrong start; the interest of the person learning it is the most important part of it.

So, I would look into PyKDE, PyGTK, PyQt or Python + OpenGL (there are certainly some tutorials on the net, I know of some Czech ones but that won't help you :)).

Of course, if your brother is older and has education close to mathematics, you can head directly to algorithms and such.

J S
+1  A: 

Very good video introduction course by Stanford university (no prior knowledge required):

Programming Methodology

Will teach you good "methodologies" every programmer should know and some Java programming.

Gu1234
A: 

Whatever language and environment you choose, if the student wants to learn for professional reasons or to do "real" programming (whatever that is), have them start by writing their starter programs1 on paper and taking them away to run. Come back with the output and/or error results and have them fix things on paper.

This isn't especially harder at first than doing it on-screen and hitting run, but it will make things much easier when they start to discover the wonderful world of bugs.

1) short, "Hello, World!"-type programs that still have some logic and/or calculations, do this up to a few programs that can have bugs

Seth Morris
A: 

Whatever they write, have them step through it in a debugger line-by-line on the first run. Let them see for themselves what the computer is doing. This takes a lot of mystery out of things, reduces intimidation ("oh, each line really is that simple!"), and helps them learn debugging skills and recognize why common errors are common (and why they're errors)

Seth Morris
A: 

+1 to Stanford university lectures. http://see.stanford.edu/see/courseinfo.aspx?coll=824a47e1-135f-4508-a5aa-866adcae1111

They're simple, of high quality and I can vouch for their ability to teach beginners(me being one of them).

Glitch
A: 

I suggest "Computer Science Unplugged" as a complementary didactical material.

A: 

"Who's Afraid of C++" By Heller

Might be worth a shot

Tim
A: 

Microsoft Small Basic is a free .NET based programming environment aimed to be a "fun" learning environment for beginners. The language is a subset of VB.NET and even contains a "Turtle" object familiar from the Logo language. The website contains a step-by-step tutorial.

A: 

I agree with superjoe30 above, but I don't have enough reputation yet to leave a comment.

I was a C.S. professor for 4 years. The languages were Basic, and then Pascal, but it doesn't really matter what the language is.

The biggest lesson I learned as a new prof was, no matter how simple I thought a concept was, it is not simple to a newbie. Never go any faster than your student can go. I can't emphasize that enough. Go really, really slow.

I would start with very simple stuff, read and print, maybe a simple calculation, just to get the student used to putting something in and getting something out. Then IF statements. Then really simple FOR loops, always in terms of something the student could write and have some fun with.

Then I would spend about 3 weeks teaching a very simple sort of machine language for a phony decimal machine called SIMPL, that you could single-step. The reason for doing this so the student could see where the "rubber meets the road", that computers do things step-by-step, and it makes a difference what order things happen in. Without that, students tend to think the computer can sort of read their mind and do everything all at once.

Then back to Basic. A couple weeks on arrays, because that is a big speed bump. Then sequential files, which is another speed bump. What I mean by "speed bump" is the student can be sailing along feeling quite confident, and then you hit them with a concept like arrays, and they are totally lost again, until you ease them through it.

Then, with those skills under their belts, I would have them pick a term project, because that is what makes programming interesting. Without a use for it, it's really boring. I would suggest a variety of projects, such as games, accounting programs, science programs, etc. It's really great to see them get turned on. Often they would ask me for help, and that's great, because you know they're learning.

While they were doing their projects, we would continue to cover more advanced programming techniques - searching, sorting, merging, how to make a simple database, etc.

Good luck. Teaching is hard work but satisfying when you see students grow.

Mike Dunlavey
A: 

Book: Java Programming for Kids, Parents and Grandparents (PDF)

I don't have personal experience about learning using that book, but it appears to be nice because it quickly goes into producing something visible, and not spending too much time with the syntactic itty bitty details. Has someone here tried using that book?

Esko Luontola
+4  A: 

Begin with Turtle graphics in Python.

I would use the turtle graphics which comes standard with Python. It is visual, simple and you could use this environment to introduce many programming concepts like iteration and procedure calls before getting too far into syntax. Consider the following interactive session in python:

>>> from turtle import *
>>> setup()
>>> title("turtle test")
>>> clear()
>>>
>>> #DRAW A SQUARE
>>> down()        #pen down
>>> forward(50)   #move forward 50 units
>>> right(90)     #turn right 90 degrees
>>> forward(50)
>>> right(90)
>>> forward(50)
>>> right(90)
>>> forward(50)
>>>
>>> #INTRODUCE ITERATION TO SIMPLIFY SQUARE CODE
>>> clear()
>>> for i in range(4):
        forward(50)
        right(90)
>>>
>>> #INTRODUCE PROCEDURES   
>>> def square(length):
        down()
        for i in range(4):
            forward(length)
            right(90)
>>>
>>> #HAVE STUDENTS PREDICT WHAT THIS WILL DRAW
>>> for i in range(50):
        up()
        left(90)
        forward(25)
        square(i)
>>>
>>> #NOW HAVE THE STUDENTS WRITE CODE TO DRAW
>>> #A SQUARE 'TUNNEL' (I.E. CONCENTRIC SQUARES
>>> #GETTING SMALLER AND SMALLER).
>>>
>>> #AFTER THAT, MAKE THE TUNNEL ROTATE BY HAVING
>>> #EACH SUCCESSIVE SQUARE TILTED

In trying to accomplish the last two assignments, they will have many failed attempts, but the failures will be visually interesting and they'll learn quickly as they try to figure out why it didn't draw what they expected.

Cool! I had no idea this is part of Python
Eli Bendersky
Agreed...this is very awesome.
Cal Jacobson
This is awesome!
claws
A: 

once you've taught them how to program, they might want to learn how to develop software.. for that I think Greg Wilson's Software Carpentry course is great.. it also uses Python as the student's language.

jbdavid
A: 

I think Python is a really great Language to start with: :-)

I suggest you to try http://www.pythonchallenge.com/

It is build like a small Adventure and every Solutions links you to a new nice Problem.

After soluting the Problem you get access to a nice Forum to talk about your Code and get to see what other people created.

bastianneu
A: 
cool-RR
+1  A: 

I think Python is a great idea. I would give him a few basic assignments to do on his own and tell him that any dead ends he hits can probably be resolved by a trip to google. For me, at least, solving a problem on my own always made it stick better than someone telling me the solution.

Some possible projects (in no particular order):

  • Coin flip simulator. Let the user input a desired number of trials for the coin flipping. Execute it and display the results along with the percentage for heads or tails.

  • Make a temperature converter with a menu that takes user input to choose which kind of conversion the user wants to do. After choosing the conversion and doing it, it should return to the main menu.

    Here's an example of an extended converter with the same idea: http://pastebin.org/6541

  • Make a program that takes a numeric input and displays the letter grade it would translate to. It'll end up evaluating the input against if and elif statements to find where it fits.

  • Make a simple quiz that goes through several multiple choice or fill in the blank questions. At the end it will display how the user did. He can pick any questions he wants.

  • Take an input of some (presumably large) number of pennies and convert it into bigger denominations. For example, 149 pennies = 1 dollar, 1 quarter, 2 dimes, and 4 pennies.

  • Create a simple list manager. Be able to add/delete lists and add/delete entries in those lists. Here's an example of a christmas list manager: http://pastebin.org/6543

  • Create a program that will build and then test whether entered numbers form a magic square (with a 2D array). Here's some sample code, but it should really print out the square at each step in order to show where the user is in terms of buliding the square: http://pastebin.org/6544

I would also suggest doing some stuff with xTurtle or another graphics module to mix things up and keep him from getting boring. Of course, this is very much practice programming and not the scripting that a lot of people would really be using python for, but the examples I gave are pretty much directly taken from when I was learning via python and it worked out great for me. Good luck!

Sean O'Hollaren
A: 

Try to find a copy of Why's (Poignant) Guide to Ruby online. The original site is offline but I'm sure there are a few mirrors out there. It's not your typical programming guide; it puts a unique (and funny) spin on learning a new language that might suit your friend. Not to mention, Ruby is a great language to learn with.

Rob Sobers
A: 

Use real world analogy and imaginary characters to teach them programming. Like when I teach people about variables and control statements etc.

Usually I start with calculator example. I say imagine u have a box for every variable and u have 10 card boards with numbers 0 - 9 printed on them. Say that the box can hold one cardboard at a time and similar ways to explain how programming elements work

And emphasis on how every operator works.. like the simple '=' operator always computes the right hand side first into one value. and put that value into box named "num_1" (which is variable name)

This has been very very effective, as they are able to imagine the flow very quickly.

Quakeboy
A: 

Just make it fun !

Amazingly Scala might be the easiest if you try Kojo

Łukasz Lew
A: 

If your brother likes puzzles, I would recommend Python Challenge. I wouldn't use it as a formal teaching tool in a 1 on 1 tutorial, but it's something he can do when you're not together to challenge himself and have some fun.

Jacinda S
A: 

Academic Earth offers links to free Computer Science courses from top universities. They have a section geared towards Beginning Computer Science. The languages taught in the beginning courses vary:

  • MIT - Introduction to Computer Science and Programming - Python
  • Stanford - Computer Science I: Programming Methodology - Java
  • Harvard - Introduction to Computer Science I - C (main focus), with a few others sprinkled in for good measure (e.g., SQL, PHP, LISP, Assembler, etc.)
  • Berkeley - a dialect of the LISP language
Mithrill
+3  A: 

I don't know if anyone has mentioned this here, yet, but You might want to check out Zed Shaw's Learn Python the Hard Way

Hope this Helps

inspectorG4dget
This Q was asked 2 years ago; Zed's book is new, FWIW.
Jeremy Dunck