The Zen Of C++

Published on
11,114 Points
1 Endorsement
Last Modified:
An expert in cross-platform ANSI C/C++ development, specialising in meta-template programming and low latency scalable architecture design.
Inspired by The Zen of Python and with a wink and a smile, and tongue firmly in cheek, I hope this will bring a smile to you C++ programmers.

Are you a C++ programmer who works with Python programmers? Are you fed up with them banging on about their "Python Philosophy"? Do you feel like beating them over the head with your compiler every time they witter on about using 4 space intending? Does the fact they continuously try to convince you enforced white space syntax is a good thing just make you want to hurl chunks? If so, what you need is "The Zen Of C++"!

The Zen of C++:

Beauty is but skin deep.
Explicit is implicit.
Why be simple when we can use meta-templates?
Complex is better when more complicated.
Nested is fun but tail end recursion rocks.
C++ is better than Python.
Readability counts for nothing.
Special cases aren't special enough if they don't break the rules.
Forget practicality; you're an artist so let your creativity flow.
Errors can be ignored; that's what default exception handlers are for.
Supress all compiler warnings -- you know best!
In the face of ambiguity, resort to templates.
There should be one-- and preferably only one --obvious way to do it; but don't let that stop you inventing others.
Although that way may not be obvious, which clearly means a better way exists (probably using lots of templates).
Now is the best time to introduce unnecessary complex constructs otherwise you may never get around to it.
Never is often better than right now, unless it's that "one last 'quick' change that you know will not cause a defect.
If the implementation is hard to explain, good -- you'll have job security.
If the implementation is easy to explain start working on your CV.
Namespaces are one honking great idea -- it means we can now dump everything in the global one!

So there you have it... The Zen of C++ to be used liberally with a bit of joy and if said with a smile should not offend anyone (including Python programmers) :)

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Join & Write a Comment

The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month