Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Possible Duplicate:
How can I teach a bright person, with no programming experience, how to program?

I'm in an unusual situation. A colleague of mine wants to "learn programming" and, being a developer I have been tasked with teaching him "programming".

Personally, I am self taught, and have never taught any sort of skill to anybody else before so I am not quite sure where to start. Also, I still have a heck of a lot to learn myself (although don't we all)!

I write in C# but is C# a good language for a beginner? I was thinking that Visual Basic .Net would be a better starting point, so was considering getting him setup with Visual Studio Express 2010, teaching him a few basics (variables, functions, classes etc) then finding some programming challenges and asking him to work through these. Does anybody have a good source of these sorts of challenges?

Also is this a good strategy?

Finally, what are your experiences of teaching programming to somebody else and what advice would you give?

share|improve this question

marked as duplicate by gnat, Walter, jmquigley, Joel Etherton, ChrisF Mar 21 '12 at 16:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Eww no, not VB! –  Rachel Mar 20 '12 at 18:01
How much does the guy you are teaching know? Is he "Where is the power button on the computer?" or does he spend time in excel and have a working of at least excel functions? You could always send him to learn python the hard way or some other tutorial type site for C# and just be there to answer questions. That is what I have been doing with my brother and it has gone well. –  asjohnson Mar 20 '12 at 18:07
Yeah he can do some stuff in Excel and can even design queries in MS Access, anything GUI based he seems ok with but has never written a line of code before. Also, that's not a bad idea! –  JMK Mar 20 '12 at 18:09
I'm just a beginner myself, but I would say, hands down, that Javascript was immensely helpful in breaking me into programming. Nothing needed to be compiled, you just type it into Chrome's console and it runs. You can instantly see the results, and you feel closer to the code you're writing. –  mowwwalker Mar 20 '12 at 21:20
@Shauna then this is very gullible... the difficulty of programming does not lie in understanding that "{" begins a block of code while "}" ends it. If that's giving somebody a headache, how could they ever grasp what a block of code (or scope) is; however delimited? It's down to the capability of abstract thinking. If "(2+3)*4" in place of "add two to three then multiply by four" baffles someone, they shouldn't study math at all. When we teach kids mathematics, we start with "(2+3)*4" straight away. –  Konrad Morawski Mar 21 '12 at 14:11

14 Answers 14

up vote 2 down vote accepted

Personally, I am self taught, and have never taught any sort of skill to anybody else before so I am not quite sure where to start.

... snip ...

teaching him a few basics (variables, functions, classes etc) then finding some programming challenges and asking him to work through these. Does anybody have a good source of these sorts of challenges?

I do: it's MIT OpenCourseWare's Introduction to Computer Science and Programming.

Here's the most important thing: if your situation is like everyone else's when they are asked to "teach programming" to someone, you're expected to add this onto your existing job. Worse, it's sometimes not clear if the student is actually interested in learning to program or not.

These lectures are excellent. They use Python: it's low friction (no major IDE requirements) and generally pretty useful. They take students from zero knowledge of computer science up to a functional level that's based on sound knowledge of fundamentals (in contrast to some "Learn Java is Five Minutes" book).

Finally, what are your experiences of teaching programming to somebody else and what advice would you give?

I've done a lot of teaching at this level in the university and on-the-job. The critical point that I've come to understand is that the student must demonstrate that they want to learn. Programming is hard to learn and quite hard to teach. If the student isn't willing to invest their own time, you're going to feel like you're pushing string.

Here's my specific suggested procedure:

  1. Assign the first video to the student. Ask them to work through all of the in-class examples and homework.
  2. When they've done that, the two of you can meet to go over the student's work, answer questions, etc. Note - you'll likely want to watch the videos as well for background (they're really good).
  3. Repeat from step 1 until all videos are completed.

At the end of this time, the student will have experienced a good first undergraduate class in computer science and will be able to write some code in an actually useful language. You will have contributed to the learning while also getting your "real job" done.

share|improve this answer
Just including another helpful link that has open course ware including the MIT one you pointed out: edx.org –  Mallow Nov 26 '12 at 20:24
@Mallow, in addition, many of these courses are on ITunes U: whatever it takes to get the content in front of the student! –  Bob Cross Nov 27 '12 at 3:15

You are self-taught and have never taught anyone else and you "...still have a heck of a lot to learn." This is going to be challenging.

Make sure you have a very good understanding of what you're about to teach this other person. They will ask questions and some of them will be questions you won't anticipate. So be very well prepared with the material or be prepared to admit you don't know, look up an answer and get back to them. Go slowly and adjust for their skill level/learning pace.

Also, I don't think it matters much if you use C# or VB. You know C#, and if you are inexperienced with teaching, changing your tools at the same time as teaching someone else could make things difficult.

share|improve this answer

My opinion only: teach user the basics first, use this link: http://www.tedfelix.com/qbasic/ but ignore the fact that it says qbasic, and ignore the fact that it says for kids. Start at chapter 4. Teach him the following (in your language C#)...

  1. Print
  2. Taking User Input
  3. If...Then
  4. Do...Loop (while, until)
  5. Case...Select
  6. Random Number (Why not?)
  7. For...Next
  8. Some String functions if applicable to your job.
  9. How to make functions
  10. Saving and Reading Data
  11. Error Checking

This list is just some fundamentals that everybody should understand. I am sure C# has it's on little tidbits like library and what not, teach that too. Whenever you need a deceptively simple module(function) give it to them to write. Otherwise, while you are still in the teaching mode make them do simple programs what use the above in order to reinforce concepts.

This might not be the best approach but it is the one I would think off hand.

share|improve this answer

Sorry to say this but I think starting programming in C# and especially by using Visual Studio is a bad idea. C# got alot libraries and therefor a lot of things can be done without any understanding about programming just browsing throught the documentation. I know many C# devlopers that after years still don't know what realy happends in there programmes. By using Visual studio with auotocompleat and telling you what functions are available and what parameters they expect.

Start simpel without flashy editors and GUI. Take the oppertunity to learn somthing youself and pick a language you don't know and you can learn it together.

share|improve this answer

The only thing, IMHO, that makes this question not a duplicate is that you are teaching a colleague how to program.

In that particular case, I would give him some of your real work to try to at least get something directly productive out of that time. Ideally you would have some tasks that are so simple you could almost write a program to generate the code for you, except the generator would need to be able to read English to do it (I've had some tasks like that on rare occasion).

I would give him the easiest stuff I could find, then review it all with him. Depending on how much time you have it may be more or less a sink-or-swim experience, but in the long run if he can't teach himself for the most part he probably won't be a very good programmer, and if he can you are doing him a favor by teaching him the real things he needs to know.

Make sure to do it all right though - have him check everything in to a local repository as he goes, push to your central branch once you are both done with it (or whatever your process is), etc. Again, might as well learn the real thing as something made up.

share|improve this answer

Easier languages for beginners are python or ruby. Complex syntax can really slow down learning so I'd pick one of those two. It's also nice to have an interpreter where you can test out short snippets of code quickly (like with python or ruby). Having to compile things just slows down the process. MIT, by the way, uses python to teach their beginner programming classes.

As for challenges/exercises, I'd start with Project Euler (projecteuler.net). It's language agnostic so you can use any. It starts off easy but gets increasingly harder. You don't have to do all the exercises as there are a lot of them, but just maybe the first 40 or so. I found the site very helpful for getting the hang of new languages.

The ones who do well in this are people who have a lot of initiative and don't need too much hand holding. You can explain variables and all that, but they should be doing a lot of the learning themselves. Have the student practice on different problems and get into the habit of figuring out things on their own. Of course they'll get stuck here and there and you help them out of those situations.

share|improve this answer
+1 For the link, this is exactly the kind of thing I'm looking for, a language agnostic platform for learning programming concepts, I will hopefully learn a thing or two myself! –  JMK Mar 20 '12 at 18:35
Here are one useful link to learn the beginning concepts of ruby rubymonk.com –  nist Mar 20 '12 at 18:49

One strategy, for an inexperienced teacher and student combination, is for both of you to learn a new programming language (or topic) at the same time, but for you to stay one or two steps ahead. Then what you just learned will be fresh in your mind as something that needs to be taught.

Pick a new programming language that you want to learn (and that is reported suitable for educational purposes, e.g. lots of teaching materials available at multiple levels).

share|improve this answer

They say, best way of learning something is trying to teach it :) It would, perhaps, be better if you were teaching to more than one person. But, in any case, that would also mean that you should be putting a lot of effort in understanding the stuff you're talking about (which is a good thing). I would start with getting some books myself and putting down some notes on how to bring thing together so that they pedagogically make sense. You can also skim through the course material of colleges to find out the usual order of topics. I would also recommend writing on the topic (start a private blog?) before teaching about them, since writing make you ask more questions about the subject matter.

I guess C# is fine to start with.

share|improve this answer

I am (mostly) a self taught programmer as well, and I would say that areas where I had the most success were ones where I had some practical problem at hand to solve. (Necessity is an exceptionally good motivator in learning a new skill.) So if I were trying to teach an individual to code, my first step would be trying to figure out why that person wants to code in the first place. Ask your student for use cases and determine what they want or need to do. (It is possible that our colleague has no actual need to learn how to code in order to accomplish their goals.) From there, deconstruct the problem and figure out what they need to know in order to do what they want to do. This will help you figure out language choice as well.

From there, I would try and get a sense of your student's academic background. Ask them about algebra. How much do they remember? Can they give you a definition of a variable in their own words? Can they explain the order of operations? Can they read greater than / less than expressions? Do they know what a function is? Ask them some questions about logic. Can they tell you the formal difference between AND and OR? Quiz them about negation.

Once you know the answers to these questions, you will have a much clearer idea of what your starting point is. From there, work on data types, control structures, and basic data structures (e.g. arrays). Once you get the basic grammar down, work on actual practical problem solving and designing algorithms in the chosen language.

share|improve this answer

Start with Javascript. It's as bad a language as all the others for learning programming (except logo for total beginners, or basic for beginners).

What's best is it's getting used by tutorial programmes for teaching beginners to programming. (I should learn better grammer to rewrite that sentence!)

Here's one that's getting some interest: learn to code in 2012.

Apparently the Khan academy is getting some learn-to-program stuff going with javascript too. They describe the reasons why.

I'm not convinced JS is the best thing to learn, but it gets you going, is easy to learn with interactive web editors that give instant results (important), is pretty ubiquitous everywhere from web apps to Metro apps, and you'll never be lacking job opportunities once you know it.

share|improve this answer

I wouldn't start with C#, Object Oriented is a bit complicated for start as it requires a certain frame of mind which isn't the easiest to grasp for a newbie.

To get the "feel" of programming, I would definitely go for something like C, which is a great language to learn the idea of problem solving through structured instructions, you could definitely benefit from watching an introductory to computer science class, and there is a great one:

MIT introductory class

share|improve this answer

An interesting take on programming challenges is Pex for Fun and it's in C#. As opposed to most which are "write a program that turns these inputs into these outputs" it has a hidden function which you have to work out writing a function, seeing which inputs gives a wrong result (and shows the expected result) and iterating on yours.

share|improve this answer

In my opinion I would start with the basics like you said (variables, classes, functions, loops, timers, etc). From there I would pick a language! Good Luck!

share|improve this answer

Start off with C,gcc and gedit combo

Start with the basics : arithmetic operations,loops,conditional statements,etc

Then play with pointers and arrays

Move on to IO,file IO

Now relatively advanced topics like functions,recursion

Finally, finish off with a simple project like a Brainf**k interpreter

share|improve this answer
It looks like OP only has experience with C#. This would require the teacher to go and learn C before teaching the student. A nice idea, but maybe not feasible in this situation. –  FrustratedWithFormsDesigner Mar 20 '12 at 18:25
@FrustratedWithFormsDesigner Should be relatively trivial to pickup this level of C for someone used to C# (atleast the opposite is true) –  Akash Mar 20 '12 at 18:29
@Akash Fair point! Can you recommend any good books/websites for somebody familiar with C# to learn C? –  JMK Mar 20 '12 at 18:31
@JMK You should be able to translate your knowledge with just a few online tutorials. C is pretty simple at the basic level. Otherwise, you can refer to the suggestions in programmers.stackexchange.com/questions/96504/… –  Akash Mar 20 '12 at 18:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.