Power and Control

This video is a perfect representation of the Pirelli's slogan "power is nothing without control". You can have the fastest car in the world but if you are not able to manage it, you'll crash.

With the development languages it's the same. Some languages are (sensed to be) more powerful than others: some say that C++ is more powerful than C.

Please stop laughing and keep reading.

Small Digression on the Most Powerful Language

What is the meaning of "powerful" related to a programming language? Try to ask Google. Excluding Richard Stallman (that seems to love LISP), the majority of the results will say: "Every Turing-complete language is at the same level of the others."

Someone else points out that a language that needs less code to do the same thing is more powerful and probably I could agree, but... would you say that Assembly is less powerful than Pascal?

The answer that I like much is the following (from here):

C is powerful, because it is low level and gives you access to hardware. Python is powerful because you can prototype quickly. Lisp is powerful because its REPL gives you fantastic debugging opportunities. SQL is powerful because you say what you want and the DMBS will figure out the best way to do it for you. Haskell is powerful because each function can be tested in isolation. C++ is powerful because it has ten times the number of syntactic constructs that any one person ever needs or uses. APL is powerful since it can squeeze a ten-screen program into ten characters. Hell, COBOL is powerful because... why else would all the banks be using it? :)

Power and Control in C++

That having been said, we can go back to the control part. No matter the language you are using, you have to use it well. Are you still determined to use C++ because you think it's more powerful? Please go on. I'm not interested in a religion war. I love C++ too. But I know that mastering it is way more difficult than C.

And no, "mastering C++" doesn't mean using the iterators to scan a std::vector containing your fancy objects. Mastering C++ means understand OOP and understand template meta-programming.

Now you are able to start to design your class hierarchy. Design. Not code. The design part is the most important in a C++ project. If you fail it, your software will be a total failure. And when you have finished your design, take some time to simplify it.

The risk with C++ is to fall in love with your architecture and forget that the main purpose of every program is to run in a decent time without saturate the hardware resources.

Good Old Dirty C

So now you think that C is easier, right? Wrong! Probably the design part is faster and shorter but the risk to create something that is buggy, leaking memory and unmaintainable is just around the corner.

With C you can let all your perverse ideas to run free: cast madness, mixed usage of integers and pointers, long jumps like there is no tomorrow, etc.

The fact that you can do almost everything in C doesn't mean that you should. And remember, you don't have to demonstrate that you are a good programmer. Other developers don't care about you and your fancy hack; if it takes more than one minute to be understood, it's surely wrong.

Conclusions

You should have understood that the programmer is much more important than the used language. Poor developers will only write bad software. And programmers that don't think about the design before starting to code are doomed to write and rewrite and rewrite again.


Cover image taken from Wikimedia Commons (public domain).