The school fall semester starts soon, and so, for many students, it’s time to think about programming languages they might want to learn. But which?
One preconception students have is that they should only ever have to learn one computer language in their life. To address this myth, it’s useful, with a light-hearted approach here, to look at an analogy. Namely, why do car makers make lots of different kinds of cars?
It’s because there are many different kinds of tasks to perform, and no one vehicle type can’t do them all. And so, this begs the question: if programming languages were cars, what would they be?
Remembering our light-hearted approach, let’s start with the heavy duty vehicles.
C++ would be heavy duty pickup truck. It can tow a horse trailer. A yacht. It can go off road. It can go through heavy snow. But, it gets less than stellar gas mileage, it’s not a touring vehicle, and you probably don’t want to drive it a long distance to work every day. But people who own them love them.
Similarly, C++ is fully object-oriented. You can tackle any programming project with C++. But it can be very time consuming to get started. If you want to get a simple job done, like pulling data out of text files with regular expressions, pick a different language. But need to write two million lines of code in a large team? You’re good (with, of course, an RCS).
What about plain C?
C is even more basic; it’s your farm tractor. It can clear fields. It can pull things that even that pickup truck cannot. But you really don’t want to take it out on the highway.
Similarly, C is a very low-level language, can be hard to master, has a steep learning curve. It takes a lot of code to get anything done. It’s hard to reuse code because it’s so low level and is generally specific to a task or even the hardware.
Java (and C#) is the Sports Utility Vehicle (SUV). Not a car. Not a truck. It can carry some bulky things around. Some can carry lots of people. It’s a multi-purpose vehicle. But it’s not strictly an off-road vehicle and can’t do heavy towing.
Similarly, Java (and C#) is multi-purpose language, but you don’t have complete control thanks to unpredictable garbage collection. So it’s not suitable for real-time applications, such as air traffic control, real-time simulations, and games. However, it’s excellent object-oriented facilities are perfect for the enterprise.
Python is like an economy sedan. Easy, fun to drive, Get’s great gas mileage. Great for driving to work. Inexpensive. Low maintenance. But not suitable for off-road or towing. Or transporting a king bed. It is, however, like the car you learned to drive in.
Similarly, Python is a general purpose language. You can work with databases. You can do scripting. You can do data analysis. It’s objected-oriented capability is good. But Python is an interpreted language, and it uses garbage collection. You never know when that might kick in — unless timing is everything and you’re a pro, fighting for milliseconds. Python has mostly replaced Fortran as the scientist’s math and data processing language of choice for new projects.
Perl is like a vintage muscle car. Users adore it, even without headrests and air bags. Want to fiddle with a carburetor? You’re in heaven.
Similarly, Perl was written by a passionate linguist and is easy to learn. But its code can be dense and cryptic. Like Python, it’s interpreted, forgiving, and can do things in many different ways. But its object oriented capability is crude and tacked on. Perl has, perhaps, seen its day, just like muscle cars.
Finally, Objective-C/Swift is like a supercar, a specialty vehicle, driven with pride. Showy, fast, dedicated to specific purposes. When used on the types of roads where it can stand out, it’s spectacular, but it can be used on the street as well.
Similarly, Objective-C/Swift is familiar, derived from C, easy to learn, and has a clean syntax. But it’s generally only used with Apple OSes where it shines. One wouldn’t write a fortune 100 corporate payroll, staffing or invoicing system with it. Or an anti-ballistic missile defense system. But get to the bare “metal,” and it can do amazing things.
And now, what about your favorite language not on this list? With the above in mind, what type car would you compare it to?