Don't teach them calculus before they can add !!
Lately, there has been quite a discussion online about changing ways to teach computer programming. Programming is being realized as a very useful tool for practitioners in almost every domain. Yet, the way it is being taught continues become more and more convoluted. As a result, more and more students are frightened of the word “ programming”. We have finally managed to make a beast out of something that is amazingly simple in reality. We have also managed to kill the fun and joy that programming has to offer.
Most programming courses seem to abandon the fundamentals of programming before they try to teach students about object-oriented design, optimization and computer-generated graphics. In most cases, students are taught object-oriented design from the first or the second week of their first programming class. It is as if we are in a hurry to teach them calculus even before they can add two numbers.
I am not the first one to write about the sorry state that we have created for programming. Many have written about it before and came up with solutions and recommendations. While I agree with most of their analysis about the current state of programming, I do not entirely agree with their recommendations. The most common recommendation that I have come across is to teach programming in an environment where students can see the environment change as they code (something like LOGO). While this recommendation might be good for someone trying make sense of a nightmarish library, my personal experience tells me that such an environment will be no better. An instructor who does not have patience with his students will still use the environment to teach them about the wonderful principles of object-oriented design just after the students print “Hello World”. Another recommendation that I have come across is to teach students to read code before asking them to write code. While reading others’ code might be a good exercise, it does make programming any easier. Yet another recommendation that somewhat overlaps with the previous recommendation is to train students in reading and writing documentation, reading code and all the other daily chores of a professional programmer. Again, it overlooks the fundamental need of making programming fun, easy and accessible.
When I look back to the days when I was a beginner, I find myself to be one of the few fortunate ones who were not shoved programming down their throat. Rather, I was taught to program in a way that made it a fun activity. My first encounter with programming was in 7th and 8th grade (as far as I remember) when I was introduced to LOGO and Microsoft BASIC not Visual BASIC respectively. In fact, the version that I was taught BASIC with was the one in which the programmer was required to write the line number before they write an instruction (sorry I could not find a link for that).
Both the environments provided console-based writing of programs, making it painful and near impossible to edit a program with ease that shiny editors and IDEs provide today. I was not taught with any special interface or environment. Yet, those initial programming years were fun and taught me a lot about programming fundamentals. I am certainly not claiming that a good environment does not make a difference. A good environment can definitely facilitate better understanding of fundamentals. But, that is only possible when the instructor does not go astray from the fundamentals to things like OOP, optimization and graphics. In my opinion, the first programming course should be about showing the potential of programming in harnessing the power of machinery and showing how the purpose of a programming language is not that different from natural language. Explicitly demonstrating the communication aspect of programming in general without getting lost in the jungle of syntax nightmare of a programming is very important. As far as programming languages are concerned, I am not a fan of teaching a language that is industry-standard. That being said, I also do not promote using LOGO to teach programming to university students. We need to find something in between LOGO and the modern languages like C# and Java that come with the bloat of object-oriented programming.
Fortunately, there are lot of options available for first languages. For beginning course, I recommend languages that allow communication with the machine with as little bloat as possible and with maximum ease to move from simple script-like code to object-oriented design in the same language or some another close relative. Two languages that come to mind are Python and Groovy. I personally prefer Groovy because of my preference of braces over indentation. Both these languages allow you to write script-like code without any bloat and at the same time allow the student to move on to complex code, once he/she is familiar with the fundamentals.
Again, an impatient instructor can mess up the learning experience even with such flexible languages. Hence, what we should be careful of when introducing programming to a newbie is to make sure that he/she understands why programming is useful, what programming allows them to do which would otherwise be very difficult or impossible and show them that programming is not about writing code. Programming is about interacting with a machine to achieve things that they could not do by other means.