Search This Blog

Loading...

Wednesday, June 15, 2011

Need Help in Teaching Programming to First Year Students

This is not the usual blog article. I am not giving my opinions and ideas, nor I am forwarding others' ideas/opinions that I find interesting. I am seeking YOUR ideas and opinions.

So, here is the issue. I am the instructor for the first year programming course at IIT Kanpur in the coming semester. It is called, "Principles of Computing" and the focus is to learn how to use computation in problem solving. So algorithmic thinking is what we want to inculcate. Since some programming language has to be used as a vehicle for this purpose, the Institute has decided on "C" language. So, the language is not negotiable at this time, even though I know that there are strong views of people on this. Also, the labs are going to be Linux (some recent fedora distribution most probably, that too is not negotiable). The last time I taught this course was 16 years ago. "Pascal" was the language used at that time. And there were less than 200 students.

I want your ideas on improving learning in this course.

To begin with, a bit more detail about the course structure. We will have three one-hour lectures a week for about 525 students (roughly 60 percent of the students who take admission this year). There will be one one-hour tutorial in small groups of 35 students each. And there will be one 3-hour lab for all students. Every day, 3 sections will have lab, so about 105-110 students will have a lab every day. Besides the instructor, there is one tutor and two teaching assistants for each section of 35 students. Tutors take care of tutorials, while tutors and TAs jointly take care of the labs. Tutors are normally either faculty members or PhD students, while TAs are normally MTech students, though some tutors will also be MTech students.

Now the questions.

First, is there some diagnostic test or some other mechanism to figure out the background of each student. I am expecting that a quarter of the students would have never done any programming. The second group would be good at algorithmic thinking, but would have done programming in a language other than 'C'. The third group would have done programming in 'C' but still no algorithmic thinking. One wishes they hadn't learnt programming. And finally the group which does not need this course. It is easy to identify the first group - just ask - but how do you identify the other three groups so that there can be appropriate pedagogical interventions for each group.

Second, What are the good books as textbooks. I have gone through many 'C' books but not very happy with any of them. I am looking for something that focuses on "algorithmic thinking." It should develop the habit of making flow charts and writing pseudo code, before worrying about syntax of any computer language. If there is no 'C' book which has good enough focus on "algorithmic thinking" then I don't mind having two books.

Third, what interventions can be there for different groups - particularly the first group and the last group. Having additional labs/tutorials for the first group in the first couple of weeks - is this good enough, or should we plan to do this throughout the semester. Would you suggest some material which is specifically targeted at novice users. I am thinking of offering projects to the 4th group to keep them engaged. Can something else be done.

Fourth, I am looking for interesting videos of 5-10 minutes which explain some aspect of problem solving (algorithms), which I could use once in a while in the class just to give a different perspective, to make lectures more interesting, to ensure that students don't sleep in the class, etc. But they could also be linked from the course website (moodle) so that people can watch it on their own. Similarly any longer duration videos (but they will only be linked from course website, not played during the lecture). Any links would be deeply appreciated.

Fifth, I am planning to setup moodle, and use that as LMS for this course. How can I use blogging and wiki to improve learning. Is there a role that social networking can play in improving learning.

Sixth, how do I detect copying in the labs. Is there some software that can go through all the 110 odd submissions, and tell me whether the two programs are too close for comfort. Similarly, is there some software that can go through the program and comment on its quality - tell me if the student is using one letter variable names, or not writing any comments, etc.

Seventh, what is a good debugger environment for first time users. gdb is an overkill. Remember, we will use Linux environment. So the debugger has to run in Linux, and should be free.

Eighth, anything else that your experience can help me with.

If you feel more comfortable giving me advise on email, my address is: sanghi[AT]gmail.com

Thanks much in advance.

12 comments:

Nikhil said...

I was in category 3 long back when I did this course in IITK - I knew java (the language of choice then) but had no algorithmic thinking. I think it will help if you mention the categories to the students in the first class - explain then what programming is, what c is and what algorithmic thinking is as many would not know the difference. Caution them about the pitfalls of being in different categories and how can each category benefit from this course...

Prashb said...

1) C How to program : Deitel and Deitel is a good book. It also has interesting assignments ( reasonably big ones ) which can keep students engaged even if they know programming well.

2) MOSS to detect copying in the labs.

3) Videos ? Let me advertise something I am working on, if you don't mind :) I am working on an educational-visualizations website
www.thelearningpoint.net

The site is under construction, but I intend to have extensive "visual"ware for teaching CS available by July .
For example, you can see the intermediate steps for an array being sorted, a graph being traversed etc.

Probably before 1st July, I should have visualizations for : arrays,trees, graphs, recursive calls, dynamic programming etc.
I'll mail you and your class can check out stuff on the site. It also helps me get feedback from students and educationalists for my site.

BTW, we are working on pretty complex graphics and visualization algorithms but that stuff will be up later :)

As an example, check out this simple merge sort visualiztion :

Merge sort

There are flickering issues etc which will be fixed when the content is updated.

Khalil Sawant said...

My 2 paise :)

Book recommendation for Novice Users "Let Us C" by Y Kanitkar, I think it contains flow-charts.
"Programming in C - Schaum Series", for people who are already good at Algo-thinking (thru some other language), but need to learn C.

Also since this involves 500+ students, I presume this includes Mech/Civil people who need to know enough programming to solve their problems without becoming an expert. Would it be better to divide students along lines of their program(Mech/Civil).

Peace and Regards

Biswajit said...

The answer you seek depends strongly on the mix of students and on your own strengths. The standard CS approach of focusing only on search, sort, and data structures is often inappropriate for students in disciplines other than CS. Numerical methods are much more useful, especially for students with a strong maths/physics background.

A method I've found useful is to implement the algorithm first in a scripting language, e.g. Matlab/Octave or Python. Translation to C is straightforward (in principle) after the algorithm has been worked out.

Therefore,

1) Diagnostic test: A in-class quiz where a) they choose a definite integral and device an algorithm to calculate it, b) create a random number generating algorithm. That should tell you about their thinking process.
2) Textbooks: Numerical methods by Richard Hamming, Programming in C and numerical methods by Dixit. These are OK for a beginner.
3) Interventions: Projects are a good idea and possibly the optimal solution.
4) Videos: Don't know. Maybe create your own?
5) LMS: Wiki's are useful but a drain on time. Nothing that I've tried has worked well, it just takes too much time to set things up and motivate students to use these resources. Ask your TAs for possible solutions.
6) Copying: Don't know how well MOSS works.
7) I use ddd which is a front-end for gdb. Works quite well.

Ranjai Banerji said...

If you want people to know C properly, Kernighan & Ritchie would be an excellent textbook. Schaum's series, though popular, appears to lack depth. One could use Data Structures & Algorithms by Mark Allan Weiss - though it is a little biassed towards data structures.

Graham/Knuth/Patashnik's Concrete Mathematics could be an excellent accompaniment to promote algorithmic thinking.

There are some online programming sites where one can upload problems. They contain problems of varying difficulty -

http://uva.onlinejudge.org/
http://www.spoj.pl/
http://ace.delos.com/usacogate
http://projecteuler.net/ - The problems are more mathematical in nature.

Then there is topcoder - http://www.topcoder.com/tc, which conducts 90 minute long algorithmic programming contests once every 10 days or so. Unfortunately they accept solutions only in C++,Java,VB and C#, but if one doesn't get bamboozled by the presence of a class or two, a C programmer should be able to submit solutions.

The above sites could be used to supplement/complement lab work.

Prashb said...

@above,sorry to disagree :-)

Well, I am strongly against Yashwant Kanitkar. It is written like a typical Indian examination guide. Definitely good for preparing for examinations. That's about it.

K&R is good of course, but might scare some of those who are new to programming and C .

Sivaramakrishnan said...

Group 1 should be easy to identify by a show of hands on day 1. Group 4 will come out if you give students a chance to do a project instead of going through the classes, assignments and tests. If you could conduct a "diagnostic" test (kind of like a survey) on day 1, with simple questions about algorithmic thinking, you could differentiate between groups 2 & 3 and also possibly identify those students in group 1 who have a grasp of algorithms. Make it clear to the students and assure them that your aim is not to discriminate and grade them, but to help them gain maximum out of the course.

Secondly, for the bunch of students who have never used a computer before, it might take a few hours just to get acquainted with using a computer. Windows habituated users might have even more trouble to get used to a linux desktop. :-) It's important that students don't lag behind at the beginning because of these reasons, else they might not be able to catch up with the course.

If you can manage, it would be best if you could just get the students interested to sit in front of the comp and play around, irrespective of what stuff they program, I think the objectives of the course would be served. The best way for that would be to ensure that each student gets sufficient hours of computer access with the TA prodding them on just to make sure that they keep thinking and are continuously challenged.

nkr said...

Programming Challenges by Skiena is a good book.

http://www.amazon.com/Programming-Challenges-Steven-S-Skiena/dp/0387001638

The primary goal is to develop algorithmic thinking. The book is not about syntax of C at all, but it has code in C and lots of hard (and some medium hard) exercises from the programming contests. UVA online judge can be used to submit solutions to the problems and have them judged.

random said...

This is how introduction to computer science is taught at Harvard. The class size is coincidentally 500.

http://cs50.tv/2010/fall/

Ajit R. Jadhav said...

From your description and questions, I get a sense that, conceptually, the course could be too traditional, in the sense, there perhaps might be an overemphasis on algorithmics---whether beginning with flow-charts, pseudo-code, or otherwise.

The first diagrams to be drawn (or shown) in such a class should be IMO, *not* those for the logical structure of some example code, but for the organization of the computer as a machine. It should be done at a level more detailed than that cursory diagram showing mem + ALU. That diagram does not help at all (and already is general knowledge to most, anyway!)

The way typical programming courses progress, the student does not realize that the C code he is writing is being targeted at an abstract machine---he in fact cannot get the idea that there is some such a thing. There is no explicit idea of machine at all. Thereby result the typical student difficulties.

(I mention the difficulties in parentheses here): There is no sufficiently explicit notion, with detailed visualized diagrams, of: (i) variables as memory locations and execution of instruction such as assignment as updating or comparing the content at that location, (ii) the possibility of treating memory location addresses as variables, and the mechanics of memory layouts (arrays and pointers), (iii) code as data (stored instruction machine, function pointers), (iv) the main instruction stack (recursion, stack vs. heap memory allocation, calling sequence, execution sequence, in-time tree vs. in-spae tree, why the stack---why not tree/graph: efficiency gained but artificiality of grammar introduced), (v) the idea of machine states (variable values as controlling selection of execution paths i.e. instructions), etc.

The only way such difficulties can be straightened out is by directly giving some relevant ideas from a computer organization course---*right in the first programming course*. This can be done in an elementary manner, sure---but the point is, those architecture/orgn. ideas should be given. Believe me, a clear idea of how the computer operates is necessary more *while* learning C than *after* it!

Now, of course, a first course on C doesn't have to go to the depth of, say, Tannenbaum (Vrije)'s Organization book---which, perhaps, is the only book in which the idea that any language implies a target machine, is treated so explicitly and wonderfully. A first course on C won't go through all the details, sure. But, the more direct, vivid and detailed the idea of the underlying target machine, the easier it is for the student to understand and use the language supported by that machine.

To give a somewhat poor analogy: machine is language what physics is to mathematics. You can't measure or calculate something unless you know *what* it is. Similarly, you cannot expect to design a sequence of using a machine (that is what coding is) unless you know the nature of the machine. Since C is so close to the machine, you have to tell what that machine---and its parts, working in time, etc.---is like.

I think it can be done.

Another point. Robert Cruse et al.'s data structures book gives vivid visualizations for pointers and their links, data structures, program execution, etc. It also gives nice tips on writing good C code. (Separate versions exist for C and C++). I would recommend it as a supplemental reading. (I know of std. XI/XII kids who can "get" Kruse' book mostly on their own, too! So, it shouldn't be an issue for our Certified World Class Geniuses, should it? ;-) )

Just two cents.

Best,

--Ajit
[E&OE]

Dheeraj Sanghi said...

Thanks a lot to all the readers who gave suggestions as comments, or directly wrote to me. I bought about 10 books, and borrowed another 10 to go through from different perspectives. I think K&R is the best reference book. As a textbook, I recommend, "Programming in C" by Stephen G Kochan (3rd edition, Pearson). But I do not ask students to buy the book. I ask them to focus more on algorithms and flow chart, and there is really no good book which I could find which enhances algorithmic thinking. So I have to give them examples in the class of the problems and develop an algorithm myself in the class, or they do it as home work. For C programming assignments, I consider Schaum Series book also decent, but again, the focus is on programming language and not on algorithmic thinking.

I haven't found any useful videos for elementary lectures. There are some good videos which are about 1-hour long (like regular lectures in a course in MIT or Stanford sort of places) but I was looking for something which is 10 minutes, which I can show during the class.

I am also going to write my experience in a blog separately.

Rinka said...

Dhiraj,
I know it's a mite late and the inputs here have been very interesting. Here are a few thoughts (loosely based on my experience as a student).

Give them a week of practice - simple problems and then give a problem of medium difficulty to be done in 3-4d (say about 900-1K lines worth).

a. Then ask them to make a flow chart. b. Ask them to tune/comment the code so that someone else can understand it without any help. Have them do peer reviews.
c. have them come up with two different algorithm for the same problem and re-write code for one.
d. rewrite the code for performance, for minimized resource consumption...
e. Look at performance & resource differences for the versions written.
f. Look at how to package the code to make it reusable.

My thought is if you structure the thinking processes (including identifying mistakes) around the same problem, then they will start seeing the algorithm...

Hoping this helps...