Take the 2-minute tour ×

I have been asked by many of my non-computer science friends to teach them how to program. I have agreed to hold a seminar for them that will last for approximately 1 to 2 hours.

My thoughts are to use Python as the language to teach them basic programming skills. I figured Python is relatively easier to learn from what I have researched. It is also a language I want to learn which will make holding this seminar all the more enjoyable.

The topics I plan to cover are as followed:

  1. Variables / Arrays
  2. Logic - If else statements, switch case, nested statements
  3. Loops - for, while, do-while and nested loops
  4. Functions - pass by value, pass by reference (is this the correct terms for Python? I am mostly a C/C++ person)
  5. Object Oriented Programming

Of course, I plan to have code examples for all topics and I will try to have each example flow into each other so that at the end of the seminar everyone will have a complete working program.

I suppose my question is, if you were given 1 to 2 hours to teach a group of college students how to program, what language would you choose and what topics would you cover?

Update: Thank you for the great feedback. I should have mentioned in my earlier post above that a majority of the students attending the seminar have some form of programming experience whether it was with Java or using Matlab. Most of these students are 3rd/4th year Engineering students who want to get a refresher on programming before they graduate.

share|improve this question
two hours for all those topics? you're highly optimistic. –  icelava Oct 25 '11 at 8:38
You need to determine the objective of teaching programming to non programmers carefully. I would use VBA with Excel (or similar) so that the learner get a practical value that care 'really' be used. –  Emmad Kareem Oct 25 '11 at 11:50
I once did exactly this with art students. You can't imagine how hard it is for most people to grasp the concept of variables or functions. It's actually really frustrating because you run out of examples and analogies pretty soon! –  UncleZeiv Oct 25 '11 at 12:26
What kind of students are they? Math and Engineering students will obviously be able to learn these topics alot faster than literature majors.. –  user606723 Oct 25 '11 at 14:31

11 Answers 11

I'm chiming in on BenR's answer... you need to serve it all as an appetizer. Because first of all:

The topics I plan to cover are as followed:

  • Variables / Arrays
  • Logic - If else statements, switch case, nested statements
  • Loops - for, while, do-while and nested loops
  • Object Oriented Programming

IN TWO HOURS? For non-computer science students?

You'd be happy they leave knowing what variables are. There might be one or two bright students that can take it all in, but most likely they will have lots of questions in their heads and they have no idea where to begin.

Instead ask what science the college students are studying and what kind of practical questions they have surrounding the science. That way you can make a compelling example for them to play around with. It's better to leave them with a simple example that they can run in their leisure and lead them to other material then. That way they know where to begin with all of this "new-fangled programming stuff".

share|improve this answer
+1 for the practical problem of their study and implement a simple solution using programming. They would easier see value (benefit) in this. –  Robert Koritnik Oct 25 '11 at 8:14
+1 for noting that two-hours is nothing for teaching the fundamentals of programming. –  BenR Oct 25 '11 at 8:35
You could probably do.. variables, if then, while loop, and pass by value functions in two hours. This will give them a taste of the basics. –  user606723 Oct 25 '11 at 14:27
@user606723: I think even teaching functions in two hours is overly-optimistic. When I was first learning about functions in middle school (before ever taking algebra), I had a lot of trouble. If they are comfortable with functions from algebra/precalc, they shouldn't have any problems, but many non-science students have never taken those classes (or never understood it when they did), so the ideas of "arguments" or "return-values" will be completely 100% foreign to them. –  BlueRaja - Danny Pflughoeft Oct 25 '11 at 17:40
Vars/Arrays, Logic, Loops, Functions, OOP - this all can be done with JavaScript, and its much more practical to non-cs people. As you can teach them how to little useful hacks to ease up their everyday internet experience ;) –  c69 Oct 25 '11 at 18:02

Think about the goal carefully. Are you going to end up with a room of programmers? after just 120 minutes? absolutely not.

However, as an idea, you can get accross the idea of programming. Here is an example:

Breaking up a common task, such as boiling an egg into a series of microscopic instructions. Introducing the concept of branching as a question. Is the water boiling? Yes -> start the egg timer, No -> wait 10 seconds. The concept of a loop, e.g. after the 20 seconds, Is the water boiling? etc..

Then you can play devils advocate with peoples instructions. Look at the logic. How can it be misunderstood? and then invite them to clarify their instructions. and you have just introduced them to debugging.

The summary of "If you give a human a task with 3 or 4 steps in it, the odds are they will do something simular to your instructions, but probably not EXACTLY what you asked. A computer will do exactly as you asked, but you have give instructions that reflect exactly what you want to happen, and HOW to do it."

share|improve this answer
A good 5 minute exercise I heard was to ask the students to write complete instructions on how to make a peanut butter sandwich. Put the jar, bread, plate and knife visibly before them, so they know the start condition. When they finish, pick a few answers and mechanically execute them. Chances are they'll have forgotten to take the lid of the jar, etc - sufficient hilarity to catch their attention for the remainder. The underlying message is also quite relevant: computers don't follow human assumptions, be explicit. –  MSalters Oct 25 '11 at 8:34
@MSalters: I think I know where you heard that from :) –  BlueRaja - Danny Pflughoeft Oct 25 '11 at 17:45
@MSalters - That is a great idea. A few of the students said they have small ideas they want to program but they don't know "how" to do it. I think by using the PB&J sandwich idea that will help them realize they need to break their problem down into clear steps. –  michaelcarrano Oct 25 '11 at 20:39

Be practical

I would recommend using Javascript instead because anybody can use it on any platform immediately and without installing any additional software. It's simple, it's available and allows for immediate results and satisfaction. Any platform also has some text editor like notepad that makes writing such programs even simpler.

I'd try to cover the old procedural programming to them, but since it's the web language some eventing and handling should be explained as well.

So this is what I would cover:

  • variables and types (including typeof)
  • operators
  • statements
  • functions
  • (maybe) event handling/event-driven programming

While teaching them event handling I'd introduce them to jQuery for the sake of simplicity. And don't forget to tell them there's even more to Javascript that just this what they've learned. Point them to valuable resources on the web, where they eager ones can learn even more about it.

What about program output

You can always use document.write and alert to output program results. But when it comes to event handling, you will have to introduce them to HTML. Depending on their interest I'd teach them some basic HTML along with event handling. Otherwise keep event handling out of your session.


Write first lines of code in Notepad. Then show them the same code in Notepad++ so they will see why tools can be valuable when it comes to development. While transitioning to Notepad++ also mention there are even better (richer) tools, that can be used, but for the purpose of this session NPP will suffice.

Python note: regarding your idea of learning Python along with it, you can always do that in your spare time. If you like the language you'll learn it in no time. :)

share|improve this answer
JavaScript requires at least some HTML + DOM knowledge. He would probably end up explaining more about HTML and CSS than actual programming. –  BenR Oct 25 '11 at 5:44
Not until they come to eventing. Otherwise they can easily output results using document.write(). Thanks for the observation. I also edited my answer to include this information. –  Robert Koritnik Oct 25 '11 at 5:47
Still requires HTML knowledge to write new elements to the body. Also, they would need to know how to construct these elements or read values. His friends also probably end up asking more advanced HTML and CSS stuff out of curiosity (which may not be a bad thing but the seminar would miss its point). –  BenR Oct 25 '11 at 5:52
Why? document.write can easily just output text. They don't need to take any inputs. They can do all that in code directly. This is a crash course for total beginners. Since they'd most likely do something like add(x, y) and then fibonacci() or similar. Output a number and a comma would suffice for simple results. OP can always tell them to answer those questions at the end. Not everybody will be that interested or knowing those things by some degree. I suppose some will be total beginners not knowing anything about it. Answering those HTML+CSS questions would confuse them big time. –  Robert Koritnik Oct 25 '11 at 5:57
+1 agree with @RobertKoritnik. It's more practical for non computer science people to create web apps(with javascript) than creating desktop apps. –  Rudy Oct 25 '11 at 6:59

Non-computing students will get bored if they don't see any practical use of these two hours.

The most probable way for them to be confronted with programming in real life is with Excel.

Without considering macros, all spreadsheet applications are a great dataflow programming language.

With macros, you can also introduce basic procedural programming structures.

share|improve this answer

Hmm, with only one to two hours, don't try and actually teach them. Give them an overview of the topics you listed, and point them at detailed resources. Those who want to learn can go out and read on their own time. This will give them a far more in depth explanation of these topics, and the next time you meet, you can answer questions, instead of trying to spoonfeed them programming.

I suggest A Byte of Python by Swaroop C H as a good learning python resource. That, along with Think like a computer scientist are free, online books perfect for getting started. We haven't even touched more involved topics like data structures or algorithms. If they actually want to learn, they will need to work at it.

See Why everyone should learn to program for those students who are wondering what the benefits are for non Comp Sci people. Ultimately though, they will have to go out and learn themselves. You can't pour CS knowledge into their head.

share|improve this answer
Thank you for those links. –  michaelcarrano Oct 25 '11 at 20:42

If you have been asked to teach them what programming is then concentrate on concepts, not details - Think language agnostic, with an emphasis on algorithms. You do not have enough time to explore syntax and data structure and oop and all the additional stuff.

share|improve this answer

Teach processing.

Nice, easy to use, and there are some good, easy to follow text books available. (LearningProcessing).

This is a visual language, built as an abstraction layer on top of Java. There are wrappers (and even fully native implementations) in other languages, such as Python and JavaScript.

Take a look :]

share|improve this answer

Since you only have one to two hours you should not talk about object orientation and probably neither about parameter passing behavior (by value / reference). Both topics require a certain way of thinking which takes far more time to learn.

To give you an idea about the length of your seminar and what can be covered in such a time frame, you may watch some online lecture, e.g. Stanford's Programming Methodology. Please note though that these students are studying computer science or related fields (or are just interested).

Regarding the language, choose something that yields quick and visible results. While Python may be a good language for this, I feel that you should go for a GUI application (which I think is more complicated in Python - correct me if I'm wrong). It would probably be easy to set-up a Java environment with Netbeans (or some other simple tool/IDE with a GUI-builder). Show them how to arrange input fields and how to react on button clicks. The latter shows interactivity which is pretty simple to realize (double click on button in the GUI-builder).

Keep in mind that you are basically giving them an appetizer.

share|improve this answer
-1 for Java / NetBeans. Throwing together a GUI with a forms designer is a wonderful tool, but it's not what programming is about at its core. –  tdammers Oct 25 '11 at 6:33
You can't expect newcomers to understand what programming is about in two hours. Instead you should use the available time to show them some quick results. Think of a programming book - in the beginning you will see a Hello World example with possibly many unknown constructs. Even though you don't understand all concepts, you feel productive and hopefully motivated to read / investigate further. –  BenR Oct 25 '11 at 8:39

Your teaching approach depends much on goals you're trying to achieve. First you need to be clear with yourself if this seminar is an one time seminar that will explain the basics of programming in general or is it just an introduction to a series of other seminars about programming.

You need to be clear that you can't teach someone how to program in just two hours no matter how good teacher you are. Your "students" must also be aware of that fact.

After you decide what strategy you will take you can prepare for the seminar accordingly.

@Robert suggested you to use JavaScript because it requires almost no effort to run (e.g. you can run JS code in Firebug console). I will add also to choose language in which you are most comfortable explaining the topic. Don't use some fancy IDE, because it will only distract you from explaining the important stuff.

You said that these are your friends so don't make the seminar to formal. Make the seminar interesting and fun so that they be interested to learn.

share|improve this answer

It really depends on why they want to learn & what they would want to use it for.

I taught a one semester class for 1st year Biochemistry undergraduates for a couple of years when I was a postgrad. These days I'd focus that class on RegExp because they'd be trying to find DNA matches in huge databases of DNA fragments. That's not what I'd suggest you teach a general group of "interested" college kids.

If you're teaching programming fundamentals you want something simple yet well structured - you don't want to teach a language that gives a "meaningful" result to if ("fred">1) then...

share|improve this answer

The answer depends on your goal. If your goal is to merely lecture to them for two hours, then your outline might be o.k. If instead your goal is to train them to program, then you are very ambitious.

Training, to be clear, is a closed-loop process in which learners learn a new skill and actually apply it. The basic loop is preparation-presentation-practice-performance-(back to preparation). In each phase, the focus is on the learner; not the trainer.

In the preparation phase, the learner is being prepared to learn (i.e. you must arouse their interest). The trick here is to get them engaged. If they come in fully engaged, because they really want to be there, then you're lucky.

In the presentation phase, you present them with new information (this might look like a lecture, or it might be a worked example with discussion, or it might be something else). Here, you tell them what they need to know in order to get on with the next phase.

In the practice phase, the learner integrates the new knowledge by actually using it in practice activities. This might be where you get the learners to write a "hello, world!" program. For programming, I think that trial-and-error, with quick feedback from you, would be a good approach.

In the performance phase, the learners apply the new knowledge to a real problem. This is probably the hardest part for you, the instructor, but also the most valuable for the students. Without this phase, they will eventually forget everything you tried to teach them. The phase itself is broken up into two parts: what they do in the session with you and what they do afterwards. For programming, you might have them come to class with a real problem in mind, then spend some time getting them to help each other come up with plans and basic code to implement after the class, with you providing some feedback (as in the practice phase).

Altogether, maybe a third of your time should be spent in the first two phases, and the other two-thirds in the last two phases.

Clearly, you will need a simple programming environment, and whether that is Python or Excel or Processing depends on your audience.

Best of luck.

share|improve this answer

Your Answer


