Tuesday, December 14, 2010

Why Computer Science should not be taught with Python!

Every Computer Science student begins his academic travel with the first stop being C. It is really a good language to begin with and it helps the student to grasp the fundamentals of how a computer program works. And (atleast in India) most of the Computer Science courses just revolve around C/C++ almost the entire of the curriculum. All the laboratory classes usually mandates the student to develop programs in C/C++ or Java in some cases.

Any student who has worked for a reasonable amount of time with a language like Python or Ruby will be against this system. He will be frustrated in writing tens of lines of C code when the same can be accomplished in very few lines in Python. I have a strong opinion that this should not be the case and undergraduate courses should insist on students using C/C++ as their primary language on the academic curriculum side.

C is a programming language that requires very verbose form of writing programs which will be highly helpful in learning and understanding the underlying concept thoroughly. Consider an example of quick sort. It is a single line of code in Python. But what does the student really understand out of that single line? Whereas when you write the same thing in C, it really forces you to understand the algorithm line-by-line, thereby making the student more knowledgeable about the actual working of the algorithm rather than just getting the thing done. Getting things done is top priority in an industry. But when it comes to academia, learning the underlying working is more important than getting things done.

Another good example would be writing a simple socket program. In python its a maximum of ten lines. Whereas in C you work very closely (almost with actual system calls) and hence you thoroughly understand the whole process of how a socket connection works.

More the abstraction, better the survival. This definitely holds good, but not when you are undertaking a course to become a computer engineer. Abstraction is good once you have completed the learning process. But when you are in the learning process, less abstraction is more helpful in making a student better.



  1. Agreed.

    Even more idiotic is when we had Data Structures in college, instead of evaluating students based on the performance of the data-structures, our staff evaluated them based on how beautiful the tree is printed. It was non-sense.

    It is a sad fact that most of the young lecturers (in 30s etc.) in Indian colleges are left-overs from I.T. Industry. They didn't choose academia because they wanted to pursue research, but because they couldn't get a job in the companies.

  2. There was this one prahaspathy who evaluated sorting algorithms by giving invalid inputs (like entering abc when the program asks for a number input), instead of verifying if the student has implemented the sorting correctly. One student who knew only selection sort and not quick sort, just used the name "quicksort" and wrote selection sort code inside, but got good marks. And I am talking this happening in a premier college ;-) Our education system is _that_ pathetic.

  3. All these idiosyncratic (world stolen from bbt :P) things are still happening. Binary tree code is still being evaluated based on the number of colors you spit out in the screen. Even we did things like calling C's inbuilt qsort function at the end of our sorting function, while our sorting function did nothing. Still being in college i don't wanna get into controversies by explicitly utter the word 'pathetic' ;-)

  4. I have more such stories. @psankar I know that prahaspathy. He does have some similarity with you ;)

    Instead of mid 30 college lectures, we can run MIT lectures in projectors.

    Also each sem is for 5 month duration and all of them can only cover the fundamentals of it. It should be left to the student to choose which he likes coding. C/Java/Python.

  5. Yes Vignesh. As like you said, in many college students learning C and C++ only. But Many of them omitted pointers in C and templates in C++. Then what is the use of learning these two language?. And many colleges forced the students to work with Turbo C compiler only. Its almost 20+ year old. And for java, they don't allow them to use any IDE. For beginner stage its ok, but I don't think so through out the semester learning java in notepad is good. What is my point here is, during the college period we are learning C, C++ & Java. But that also not complete learning. After joining to the company once again they started to learn those 3 languages again, then what is the use of what we learned in college? there is a big gape b/w what we learned in college and what we are working in company.
    Staff's point of view, the only see how the interface look like, and does the output correct? that's it. They are not ready to evaluate the efficiency of the code and the coding design. I saw many people, they wrote their full coding inside main function (no classes and no methods). Then how does it improve their talent?.

  6. That is exactly my point too. As @psankar mentioned earlier, that is the pathetic situation of our education system. Nothing much can be done about it unless students are given more control over the curriculum (which is often mentioned as "choice based curriculum").

  7. People in college write code inside main() alone, because they are never thought on how to write good code. There is no subject in curriculum that guides them on how to design interfaces, write classes, program in a standard way that others can read and maintain!
    In lab, getting output matters and not the way how they got. Within the limited 3 hour time, students never get a chance to think of writing routines other than main(). I even remember some lucky guys using printfs to get the desired output and clearing their labs
    All these aspects create a gap between what college teach and what industry expects

  8. Python is all junk food bro,stick to C,stay healthy,moms preparation!!!