March 13th, 2005, 02:11 PM
A Highly Opinionated Review of Programming Languages for the Novice
The question of 'which languages to start with' comes up frequently. Some while back I posted an extensive review of the most commonly recommended languages, and advice on which languages to choose. While I did not make any pretense towards objectivity, I did try to be even handed as possible when skewering different languages' foibles. I thought it might be useful to repost it for the newer readers.
HTML (HyperText Markup Language) : The page-layout language that 99% of the web is written in. It is not a programming language per se, but it has a structure that is quite similar to many programming languages.
Pro: It is ubiquitous, and knowing it will be a usefuly skill even if you never do any programming. Also, it is much simpler in most ways that a full programming language.
Con: Limited to page layout. Fairly verbose. Requires additional languages for stylesheets and scripting to be most effective.
XML (Extensible Markup Language): a meta-language for defining markup languages; the newer versions of HTML are defined in XML. Used for creating custom markup types.
Pro: Can be used to create application-specific document languages that are more useful for specific tasks than HTML.
Con: Can lead to confusion of meta-levels.
CSS (Cascading Style Sheets): A language for defining how to present the documents structured with markup languages such as HTML.
Pro: An important complement to HTML and similar markup languages; allows the separation of document presentation from document description.
Con: Is only useful in conjunction with a markup language.
Visual Basic: A language created by Microsoft, derived (at several removes) from the older GWBASIC. Support object-oriented programming, but has a peculiar object model that is at variance from those used in the rest of the programing world. Visual Basic.NET is a very different language from the earlier versions. Has a very powerful built-in graphical development tools suite.
Pro: Has excellent support, and used widely in Windows programming. Syntax is (or seems) relatively easy for a beginner to learn.
Con: Windows specific; only provided by Microsoft. The language itself is a moving target, as the developers alter it to suit their latest vision of what it should be. The 'simple' syntax and RAD tools hide an abyss of complexity that can make non-trivial tasks a nightmare (though VB.NET has fixed much of this). Use of the RAD tools tends to discourage careful design.
C: A popular systems language, and also widely used for applications programming.
Pro: Simple, flexible, and blazingly fast. Extremely concise syntax that is widely imitated in many other languages. Excellent for systems programming.
Con: Low level, with relatively weak abstraction. Somewhat cryptic syntax can be hard to grasp at first. Requires extremely careful attention to detail, especially regarding pointers and manual memory management. Cannot generally be used for web programming (except for creating Active X controls). Lends itself to very difficult-to-understand code.
C++: a derivative of C, it adds facilities for object-oriented programming and generics (templates), and expands the standard library considerably.
Pro: Largely (~95%) backward-compatible with C. Capable of powerful abstraction. Ubiquitous. Nearly as fast as straight C.
Con: Vastly more complex than C, and very hard to learn as a first language (though some would argue this is a good thing, as it would make other languages seem easier by comparison). Like C, cannot be used for general web scripting or applets. Even more likely to result in incomprehensible code than C.
Java: An object-oriented language related too, but not compatible with, C and C++. Considerably simpler (and arguably, more elegant) than C++, while providing a comparable level of abstraction. Usually compiled to an interpreted bytecode, though it can be compiled to native code reasonably efficiently. Is designed to work over networks transparently, and can be used to write web applets. It has additional safety checking, and uses garbage collection for memory management.
Pro: Fairly abstract, and reasonably easy to learn. More secure than C++. Avoids certain types of memory and pointer bugs. Excellent for web programming, if rather heavyweight.
Con: Slower than C or C++ even when compiled to native code. Cannot access memory directly via pointers. Language is still evolving at the whim of the Sun developers, making it something of a moving target.
C#: a C-like language developed by Microsoft as part of the .NET framework. It can be described as Java modified to use the Visual Basic.NET object model.
Pro: Very similar to Java.
Con: ... except when you expect it to be. Only supported by Microsoft.
Pro: Excellent for light web scripts, both client side and server side (in Active Server Pages). Supported by the majority of web browsers.
Con: Of limited use outside of web programming. Scales very poorly. Very slow.
PHP: A language designed specifically for server-side web programming. I must confess that I do not know enough about it to comment on it.
Perl: A powerful scripting tool combining many of the qualities of C, Lisp, and Awk. Has powerful text manipulation and regular expression tools. Supports OOP, with interesting but very peculiar object model.
Pro: Ubiquitous. Very well documented and supported. Extremely good for text manipulation. Has what is probably the largest online code repository of any programming language (CPAN), making it possible to do much development using existing libaries. In expert hands, can be incredibly concise and expressive.
Con: Slow. Extremely complex syntax with countless special cases. Code can become utterly incomprehensible schockingly fast, even compared to C++.
Python: A cleanly designed scripting language with support for OOP and functional programming. Uses indentation as part of the syntax.
Pro: Very easy to learn - can be learned in a day even by a novice. Encourages understandable code. Supports some sophisticated abstractions such as list comprehensions, Continuation Passing Style, and generators.
Con: Use of significant whitespace (indentation) is a source of serious problems, even with editor support. Very slow. Not as widely supported as Perl.
Ruby: A cleanly designed OOP scripting language, very similar in some ways to Python. Again, I don't really know enough to comment.
Scheme: A language in the Lisp family, with a radically different syntax from most other languages. Very simple and minimalist in structure. Has a very high level of abstraction, and supports constructs that are unheard of in most languages. Primarily designed for functional programming, but can support OOP with added libraries.
Pro: Extremely easy to learn - the basics can be grasped in less than a day. Has some excellent tutorial material. Extremely flexible and extensible. Excellent for exploratory programming and highly dynamic data structures. Is widely used for programing research. Has one of the most highly optimizing compilers ever designed (Stalin). Has several extensive libraries. Core language is very carefully specified. Gives some amazing insights into programming as a whole.
Con: Rarely used outside of academia. Radically different from most other languages, which can make it confusing. Tends to have very heavy memory requirements, and can be very slow without extensive optimization. Standard library is very small. Minimal core language has lead to incompatible extensions in the interpreters, compilers and libraries, fragmenting the user base.
Smalltalk: One of the parent languages of object oriented programing (though Simula and Actors were earlier). Very simple infix syntax. Very closely tied to it's language environment.
Pro: Extremely easy to learn - the basics can be grasped in less than a day. Has some excellent tutorial material. Extremely flexible and extensible. Excellent for exploratory programming and highly dynamic data structures. Is widely used for programing research. Has extensive built-in class libraries, and excellent class browsing and editing tools. Gives some amazing insights into OOP.
Con: Rarely used in general. Radically different from most other languages, which can make it confusing. Tends to have very heavy memory requirements, and can be very slow without extensive optimization. Tight coupling to the environment means it cannot be used for standalone programs.
Comments on this post
Last edited by Schol-R-LEA; March 13th, 2005 at 02:18 PM.
March 13th, 2005, 02:15 PM
Before you learn any programming at all, learn how to use the system you are on correctly, whether it is Windows, Unix/Linux, MacOS, or whatever. If you can't work in your user environment, you won't be able to do the basic tasks needed for programming. Also, hone your research skills, especially those involved in web searches and library crawling (yes, libraries are a good resource, especially university libraries). Get into the habit of lurking on message boards, reading the FAQs, and learn how to post on them without making a fool of yourself.
I would recommend reading How to Ask Questions the Smart Way before posting anything anywhere; in fact, you may want to read several of ESR's historical and cultural FAQs, though be aware that he is very biased towards Linux and open-source, and pretty heavy-handed in general. I would further recommend reading through the Jargon File repeatedly, until it starts to make sense. If this doesn't happen right away, don't worry; it will start to as you actually begin programming, or if it doesn't well, then you might want to try something else instead.
You should also learn how to use a version control program such as CVS. No matter what kind of programming you do, you'll probably need it, or something like it.
Which to learn:
I recommend starting with HTML. Even if you aren't intending to do web development, it is a useful thing to know, and is simpler than a full programming language to start off with.
The next place to go depends on your goals:
For general applications programming, I would recommend starting with either Python or Ruby, as they are both easy to learn, and are interpreted languages, which makes it easier to try out different things without writing a full program. If you want to learn Windows programming specifically, I would then go to Visual Basic, followed by C#. Otherwise, I would recommend C, then Perl, then either C++ or Java.
If you want to understand programming on a deep level, or intend to go into an academic career, I would start with Scheme, then learn Smalltalk, then an assembly language, then pick up as for applications programming.
For systems programming, follow the same approach as for applications programming, but drop Perl in favor of x86 assembly language.
For Unix or Linux system administration, learn Bourne-Again shell scripting, the Perl, then C.
For Windows system administration, learn Visual Basic for Scripting (not the same as VBScript) and DOS batch programming, then Visual Basic.
For database programming or administration, learn Oracle and PL/SQL, or SQL Server and Visual Basic. Don't worry about the other languages, you probably won't need them, though Java may be useful eventually.
For scientific programming, learn Python, then (for physics or inorganic chemistry) Fortran 90 or (for biology or organic chemistry) Perl, then C. You may eventually need to learn Common Lisp or Ada, but they aren't priorities.
Comments on this post
March 13th, 2005, 05:47 PM
On the whole a very concise and well thought out description of the various programming languages.
There are points that I would disagree with however, particularly regarding the relative speed of the languages. I would say that on the whole, Perl, Python and Java are of comparable speeds, but it does depend very much on what you are doing. For example, Perl is highly optimised for file I/O and regex, to the point that reading a file in Perl can be faster than the standard C library on some systems. A program to read a file, do some regex processing and write it out is likely to be significantly faster in Perl (and probably Python) than in Java.
Python also has a JIT compiler (Psyco) and a Python-to-C translator (Pyrex), both of which can make significant speed improvements. The fact that Python is widely used in scientific computing, including controlling large-scale physical simulations, and for the graphics rendering pipline for computer animated movies (at Industrial Light and Magic) would suggest that it is not 'very slow'. Also I have been programming in Python for many years and have never found the whitespace to be 'a source of serious problems'.
You also state that Scheme has one of the most highly optimised compilers ever designed, but then you go on to describe the language as 'very slow'.
It should also be noted that Java and C# have very large memory footprints compared with Perl, Python and Ruby.
For example, here are some benchmarks taken from The Great Computer Language Shootout. This particular benchmark is for a program to read a text file and write out the number of occurences of each word.
As you can see, in this particular case Java takes twice as many lines of code to create a program that is 3 times slower and uses 5 times as much memory as the equivalent Perl or Python program. Of course the results are going to vary depending on the programming task and the particular implementation of the language and operating system, but these results are not unusual.
run time mem Lines of Code
Java 3.20s 15 Mb 40
C# Mono 4.86s 10 Mb 52
Perl 1.03s 1.9 Mb 11
Python 1.39s 2.4 Mb 24
Python+Psyco 0.92s 3.2 Mb 25
Another interesting empirical language comparison is here.
The abstract says:
 I should add that the study was done in 1998 so all the languages have moved on since then, but I think the conclusions still stand - especially the last sentence.
Dave - The Developers' Coach
Comments on this post
Last edited by DevCoach; March 13th, 2005 at 05:57 PM.
March 13th, 2005, 05:56 PM
mods: good choice for a forum sticky?
March 13th, 2005, 06:01 PM
Ya sticky this... Good job guys!
AMD XP Barton 2800+ @ Stock speed... (going up again soon in winter!!!)
2 x 512MB Kingston RAM for 1GB dual channel
1 x 120GB HDD (soon another
) ( <-- God I've been saying this for like a year
SoundBlaster Audigy 2 ZS (0wN5!!!)
Logitech Z-5300 speakers (0wN5!!!)
ATI All-In-Wonder 9800 Pro (0wN5!!!)
Black ViewSonic A91f+@1280x1024@75Hz (0wN5!!!) (Well, too bad I can't go 1600x1200 above 60Hz
If I helped you out please consider helping a poor college student get a free iPod for his long commute by signing up here with my referal link:
(I will pay you $10-$20 if you want to cover the cost of the offer for you. ***This ISNT a scam. I personally know a girl who recieved one a few months ago!***)
March 14th, 2005, 05:13 AM
It all depends on what you (as programmer) want.
If it's speed you want then choose for a native language like pascal (Delphi), Ada, C, C++ or FORTRAN.
If you focus on GUI programming then choose Java or VB(.NET) or C#/Mono.
And if you want fast programming then Python, ruby or the like.
Of course this is just my opinion.
You could see this as the following:
Originally Posted by grumpy
Comments on this post
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
March 16th, 2005, 04:30 AM
This is good. Topic stickied.
March 16th, 2005, 07:14 PM
Note that the Devshed crew managed to cut down the perl implementation of this code down to 1 line .
Originally Posted by DevCoach
Matter of fact, it was Devcoach that suggested that challenge in the first place .
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
March 17th, 2005, 04:07 AM
You are quite right in pointing these things out, Dev Coach; indeed, after the dressing down you gave me the first time I posted this, I had meant to remove the speed related references, but I never got around to it and when I reposted this I had forgotten about it.
As for Scheme, the STALIN compiler is something of an exceptional case; it is an ongoing research project meant to push the state of the art in optimizing compilers, and specifically in global-level optimization. Scheme was selected because, while it does quite poorly with a naive compilation, its very high level of abstraction lends it to sophisticated optimizations such as lambda lifting which would be nearly impossible in most languages.
Production Scheme and Lisp compilers vary greatly in their degree of optimization; while many otherwise admirable products such as PLT Scheme can often be quite slow, an optimizing compiler such as Bigloo Scheme or Allegro Common Lisp can produce code that is on average competitive with C code. The price for this is in price and complexity of the compiler itself. STALIN, being the extreme case, can be two or even three orders of magnitude slower than a non-optimizing equivalent. Needless to say, one would only use it for the release version of a program; the actual development would use a more conventional interpreter/compiler set.
Last edited by Schol-R-LEA; March 17th, 2005 at 04:13 AM.
March 17th, 2005, 02:40 PM
It was indeed. I did manage to get the python version down to 4 lines, but my favourite solution is still the one line shell script.
Originally Posted by Scorpions4ever
I note that according to the benchmarks that infamous41md posted in that thread that both the perl and python versions were faster than the C++ version. I am sure that a faster C++ version could be written, but it emphasises the point that the speed of the language counts for surprisingly little - the skill of the programmer and the quality of the algorithms used are far more significant.
Dave - the Developers' Coach
March 26th, 2005, 03:17 PM
Ok, So which of all these languages do you suggest as the most prominate used today online?
April 12th, 2005, 02:54 AM
An HTML version of this message, slightly edited and rearranged and with some additional framing material, can be viewed here. Any comments and constructive criticism would be welcome.
April 12th, 2005, 05:02 AM
Some of you may have already read this. I started out with C++ and it was quite easy. Something wrong with what I might have done? (but then I already did HTML (not even programming?) and lotsa lotsa TI-83 programming)
I thought C++ was easy to understand (unless it's one of the obfucated code entries... 12 days of Christmas...)
April 12th, 2005, 10:37 AM
I wouldn't say anything wrong... if anything, you did better than many do, which is a Good Thing. It's simply that, IME, most people will pick up Python or Scheme (or, from what I understand of it, Ruby) faster than C or C++, and that the structure of most algorithms are clearer in those languages. There's no reason to think that this will be the case for everyone, however.
Originally Posted by pmam21
I do think that all programmers should learn at least three different languages and at least two different programming models; if nothing else, it helps clarify which parts of programming are part of a given language, and which are aspects of programming in general. I also feel that all programmers would do better if they had some understanding of both the abstract aspects of programming (algorithmics, computability, relational calculus, etc.) and of the low-level details of at least one computer system (basic hardware, assembly language, systems programming). A broader perspective can improve one's programming, even in languages they are already familiar with.
Last edited by Schol-R-LEA; April 12th, 2005 at 10:45 AM.
April 12th, 2005, 06:29 PM
I am currently learning Java (some C++ still) and I'll probably start PHP or one of those widely web used server-sides...
Originally Posted by Schol-R-LEA