Press "Enter" to skip to content

On Language Choice — Pick the One That's Easy to Use

First, this article is not a rebuttal of @Haoel's piece Are C++'s pitfalls really that many? I'm simply sharing a few of my own thoughts on language selection, from my own perspective.
The debate over C versus C++ has a long history. Ever since Linus attacked C++ as a horrible language, it has never really stopped. As for myself, my command of C++ is still far from sufficient, so I'm in no position to compare the two from a language-design standpoint (early on I did try to learn C++, and did use it, but later found that I could neither learn it well nor use it well, and gave up). So I try to avoid saying the wrong thing on this front.
Granted, C++ introduced a great many new things. As @Haoel's article points out, it was indeed designed to solve certain problems. But the real question is: do we need it?
In my view, a language — or a tool — is a tool. Its reason for existing is to let us use it to solve problems. From this angle, a language's greatest virtue ought to be that it is easy to pick up and can be mastered quickly, so that learners don't put the cart before the horse and burn enormous effort on mastering how to use the "tool" itself.
Of course, as the old saying goes, "A workman who wants to do good work must first sharpen his tools." Yet compared with C, C++ does not broaden the range of scenarios you can apply it to, does not improve performance, and does not raise development efficiency by much. Admittedly, from an OO standpoint it can shape the user's design thinking to some degree and improve code maintainability. But that isn't essential, because there are far too many successful, highly maintainable C projects already: Linux, Unix, Apache, PHP.......
I have some experience with language design. When we were designing and developing PHP, the thing we were most cautious about was adding new syntax. The process was almost severe: a new language feature usually spells incompatibility, more chances for misuse, and a higher learning cost. So instinctively we shied away from new syntax. This, too, is a pursuit of simplicity.
Compared with C, C++ offers more new syntax and more new language features — which means more time to learn and a larger learning cost. For an example, just look at how thick C++ Primer is. And reading that isn't enough either, because there are plenty of details you can still misuse, hence: "Effective C++", "More Effective C++", oh, and the STL, "Effective STL", and so on. Are you truly willing to spend such enormous effort just to learn one language?
If you feel that learning an arcane language feeds your own sense of intellectual superiority, then I have nothing more to say. But let me still offer a well-meaning reminder: even if you spend the better part of a year and finish all of it, you still won't be able to get anything done, because a language also has to be combined with practice. To actually use it in the real world, a great deal more knowledge is waiting for you: "Advanced Programming in the UNIX Environment", "Unix Network Programming" — and for Windows, there are even more books to read...
So, do you still feel you have all that time to learn everything? Suppose you insist you really do have the time — fine, then let me remind you again: much of what you learn is something you simply cannot understand at this stage. Because you haven't yet run into the experience of design patterns while actually solving problems, you can't make sense of those design patterns now, or of certain features that look useless. See how contradictory this is: learning an advanced language requires real project experience, while real project experience requires that you first learn a language...
From this angle, I think PHP is a lot like C. To learn PHP I bought exactly one book — and I didn't even finish it, because once I'd worked through a tutorial I found I already knew how to solve what I needed at the time... For me now, a single PHP manual is enough....
Someone will ask: if a language is this simple and this easy to learn, how do you grow afterwards?
Perhaps it's human nature to feel that mastering something complex makes you look impressive. But they forget — and this is the same point I made earlier — that a language is merely something you learn in order to solve your real problems, a tool for turning your ideas into reality. Your growth should be the growth of your experience in solving problems while using these tools, not the growth of your skill at wielding the language.
Imagine that, in order to master a language, you hole up for three years, grinding through every kind of book, and finally one day you emerge having completed your studies — only to discover, tragically, that the language is no longer in fashion... How would you feel then? (As I wrote this, the scene of Wang Chongyang coming out of seclusion in "The Eagle Shooting Heroes" popped into my head, heh.)
So, don't put the cart before the horse. Pick the one you'll actually use (learn one that's easy to learn), and start solving real problems as soon as you can!

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.