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.