The Zen Of C++

evilrixEngineering Manager
CERTIFIED EXPERT
An expert in cross-platform ANSI C/C++ development, specialising in meta-template programming and low latency scalable architecture design.
Published:
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) :)
1
6,554 Views
evilrixEngineering Manager
CERTIFIED EXPERT
An expert in cross-platform ANSI C/C++ development, specialising in meta-template programming and low latency scalable architecture design.

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.