Tuesday, December 9, 2008

Rambling on Multi-Lingual Programming

Having been in the software development business for nearly 30 years I have been exposed to many different languages. I will attempt enumerate them here but I am sure I will leave out a few.

(1) Assembly Language
(2) C
(3) Fortran
(4) Pascal
(5) COBOL
(6) EDL
(7) C++
(8) Java
(9) Perl
(10) Python
(11) Lisp
(12) Javascript
(13) Ruby

Over the past 5-10 years, however, I have only worked with C, C++, Java, Perl, Python and Javascript (I have played with Ruby). What amazes me is how I continually learn new things which are not necessarily new, just new to me. I am sure if I paid more attention in my various college classes I would not be surprised so frequently, but it is hard to learn something if you are only given a few weeks or months to learn. It is also the case that real projects tend to increase comprehension more than educational exercises.

Today I discovered the concept of a coroutine. It is not so surprising to me that I did not know about this as much as that I discovered the original work done on this concept came out in 1963. The same may be said of closures which are still a relatively new concept to me though it should not be as I have programmed in Lisp before and was well aware of work done by Alonzo Church back in the 1930s.

Peterson's algorithm (which many software based mutex implementations are based on) is also a relatively new concept as I first heard of it in 1999 (remember I have been writing code since 1979) but really had no use for it until multi-processor machines became more accessible. In the old days a simple 'test and set' operation would suffice.

What concerns me most though is the fact that if a programmer is versed in a variety of languages it becomes difficult to often remember the exact syntax of a specific language which is why when I interview a candidate for a job I tend to focus more on the problem solving skills and general knowledge rather than the language specifics. I hate interviews where they ask odd questions like how many bytes does an empty C++ class occupy or what will x+++++++++; evaluate to (my answer is it evaluates to the guy who wrote it getting fired).

Isn't it more important an individual knows what a mutex is and what it might be used for rather than what **x++++++; might evaluate to? Isn't it more important an individual knows what the concept of an associative array is rather than the specific syntax like %$x? To me, a coder who knows its a hash in Perl, a dictionary in python, a map in Java gets it regardless of language.

In the end most languages support most concepts, some better than others. I think if a coder knows (or claims to know) about 3-4 different languages it is more productive to ask about the relative strengths and weaknesses of each rather than syntactically oriented questions. I also love trick questions. One of my favorites is to ask a Java coder how Java supports closures, and more recently to ask a C coder how C supports coroutines.

No comments: