Thursday, August 04, 2005

Vulgar Programming

Learning a new programming language is often easy. However, if it does not expand your horizons, it is probably not a very useful way to spend the time.

The term Vulgar Programming was suggested to me in a discussion with a friend of mine, Metadev. Metadev realized one day that most of our acquaintances, who had to program, knew only a small subset of the standard C library. Many of them were afraid (or simply didn't knew) advanced C++ ideas like templates and operator overloading. When needed, they implemented similar functionality in C or (when a GUI was needed) they used Java. Perl or Python were less used.

We browsed some code in the local repository and the statement seemed to be statistically true. The statement often seemed to be true for fellow students at our University.

Now this was for us a mystery. These people most certainly learned about the aforementioned stuff in the courses we had. What then was the problem?

The problem seems to be a lack in the homework system. A C programming class has 13 lessons distributed along a semester. Along these 13 lessons, various homeworks are given. Students do the homework but fail to understand the necessity of the theory behind each new idea explained. Those who do understand the ideas, do it because they program in their spare time.

Even when students do understand why something is good, without reinforcement, they often forget it.

In the discussion between me and Metadev, Metadev coined the term Vulgar Programming to the style of programming of those who used to reinvent the wheel a lot. I choose here to change the meaning a bit to make it positive. Vulgar programming is a method of programming of somebody who starts with very little formal instruction (unlike most university classes), but doubles it with a lot of research and hands-on experience. It is like going to China to learn to speak Chinese. It is the best method to do it.

While most will say that lack of interest is the main cause, I for one do believe that a new method of teaching programming is required. In this new method of teaching programming, only the bare essentials are taught formally at the beginning. This bare essential is about the same in each procedural language: data-types, decision and looping constructs, functions and classes. This should be almost skimmed over (and not really learned).

After this, a homework should be assigned (it could be done in teams, in my opinion). This homework should have the property that it is very laborious to solve with the aforementioned means, but very easy with a specific feature of the language (for example templates, or other ideas).

The students will have two choices ahead: to write it the hard way, or to document themselves about new language features that might help them. The latter of thinking yields in my opinion to better programmers overall.

It rarely helps having read the 900+ pages edition of "The C++ Programming Language" by Bjarne Stroustrup if you forgot a lot of it as soon as you finish the book. It is much more useful to extract information from it and make it yours forever.

1 Comments:

At 9:40 AM, Blogger Doru said...

Hmm... Very true.

I actually wanted to say that when people need GUI they tend to use Java, and when they could use operator overloading, they choose poor solutions in C.

Ex.: MyType add (Mytype* a, MyType* b);

(Other similar examples include using strcat when you could use String from STL and some other similar things.)

-----

BTW, I modified this blog to allow everyone to post. Sorry for making you sign up :D.

 

Post a Comment

<< Home