The cycle of programming languages
The following cycle never ceases to amaze me:
- People learning programming find "real" languages such as C++ or Java filled with too many "complex" constructs.
- They find or invent languages such as Javascript or PHP or BASIC and think they can get the job done without "unnecessary complexity"
- As these programmers develop, they develop increasing complex programs, and find that constructs such as classes, inheritance, exceptions, generics/templates, errors upon encountering undefined variables, and static typing help them debug their code and write better code quicker.
- They then add these features to their programming languages and everyone rejoices believing they've done something new and great.
- Other programmers – just starting out – find the current set of languages to be too complex as they contain features they don't understand they need, such as classes, inheritance, exceptions, etc.: go to step 1.
I mean PHP5 includes features such as classes, exceptions, and "phpdoc", similar to Java. When displaying an uncaught exception, the $ex->__toString() method even returns a stack backtrace just like Java. (But global errors – which different to exceptions, as they were invented before PHP5 – do not).
And now Axel has blogged enthusiastically about the improvements to Javscript in the next version. I agree that these are great improvements, but believe it is incorrect to applaud Javascript for these improvements. These are simply useful features which exist in other languages; one can applaud Javascript for realizing they are useful, however at the same time one must observe that they did not realize they were useful when designing previous versions.
I also started programming using BASIC. It did not have advanced constructs such as abstract classes and exception handling. I did not know I needed them when I started programming. So I can certainly sympathize with people at step #1 above.
But it is incorrect to treat languages such as (the original versions of) Javascript or PHP or BASIC as anything other than beginners languages, useful as a stepping stone in the process of learning to program. If you want a programming language for writing expressive and maintainable software, it would seem less effort to just to use existing languages which already have the necessary constructs for doing so, rather than extending beginners languages with constructs identical to these existing languages.