Sunday, February 14, 2010

Programming and Indian engineering colleges

This is about proragmming. (how I learnt it)
Long back when I started programming (that was in college) I couldn't understand what was its all about.
A sample example was to write a code for checking prime numbers. (from 1-100). I remember not to able to write code for it (it was in C and it was first time I was seeing the computer in my whole life). To add to my misery all my classmates (most of them) were able to write it and understand it.
I was very depressed.

I thought I can't do programming much. Hence I almost asked (didn't do it though) to change my engineering branch (I had taken information tech).

So I began avoiding programming. (There were hardly few programming subjects). I focussed on what I was good at, Mathematics (at least I though so). So I studied same topics from different books in mathematics. That made me good at mathematics. All my colleagues when focussed on learning latest languages (C++/JAVA/VB (yes VB?)) I didn't understood ABC of that. Though I studied computer science (Data structures + algorithm + os) but I couldn't program.
Now when I sit here today I thought it was a blessing in disguise. More mathematics means I could analayze program complexity (yes I solved Coremen Program complexity chapter) easily and till today after seeing any code I can understand this will have a performance bottleneck.
In those times,folks at my college used to study C by Yashwant Kanitker. I was never able to understand what problem you will solve by telling printf("%d,%d",++a,a++); output
(plus some placement papers were like that)

I never understood it. After coming to Bangalore I knew Kernighan & C is "the" book of C.
This had much clearer explanation of programming. I wrote hell number of code in office/home during my free time. Sometimes writing BST/queues. (In college I couldn't undestand what was malloc and what happens if I don't free it).
Then I studied C++ (Bruce Eckel). It should be read after learning C. It has very good explanation of basic C++.
After doing this I still can see there was a huge difference between Indian programmers and same persons working in US (western countries) after numerous interactions with them.
For example consider the following case how did you design state and corresponding handlers.
For initial months I though better write a blob of switches and each case will handle the event.
Now in some code I saw on net it used array of function pointers. I thought why the hell person will do like that. I discussed with some persons and they told me its design patterns and to master it you need to study design patterns book. I bought it immediately (GOF). Though I could correlate singleton/factory easily but I couldn't go beyond that.
I was horrified at my inability to understand GOF in depth. (further I can't understand widget till today)
I thought these are solutions to problem but who solved it in first place.
Design patterns are like dishes,you know them then you can be good cook sometimes but once every-one get used to those dishes then you will be just an ordinary cook.

Design patterns doesn't give you capability to write great code. It only gives you solution to some missing things (you can think of if they are missing)

Somethings was missing in my understanding. C/C++ can help me to write great code but to design somethings (imagine a movie director directing Avtaar-2 with an old camera) essential tools/concepts were missing.

I studied Modern C++ design. Its an amazing book. Straight away I can see the usefullness of the patterns there. But still how Modern C++ idea cropped in Alexander's head is a mystery.

Then a colleague mentioned about SICP. After completing about 2 chapters of SICP I think now I understand the code.
For example
1. The state/event handler mentioned above is nothing but a data directed programming.
2. Programming in terms of interfaces is clearly set about in second chapter3. Function object pattern is nothing but a higher order functions and why its useful.
This is used heavily inside STL.

I think Indian engineering colleges must relook at curriculum again. That is some reason I don't see any Indians (residing in India) didn't contribute anything to open souce etc.

SICP should be made compulsory across the collegess.

No comments:

Post a Comment