<

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

The Zen Of C++

Published on
11,259 Points
5,159 Views
1 Endorsement
Last Modified:
Approved
evilrix
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) :)
1
Author:evilrix
0 Comments

Featured Post

JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month