C++编程之禅

原文:http://www.experts-exchange.com/Programming/Languages/CPP/A_10157-The-Zen-Of-C.html


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.

观《Python之禅》忍俊不禁,升华至禅,灵机一闪,我希望也能给C++程序员带来开怀大笑。

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++"!

假如君乃共事与Python程序员的C++程序员:是否难堪他们Python哲学的脱口而出,是否难抑当头棒喝他们空格缩进好处的喋喋不休,是否难止作呕他们不厌其烦的灌输空格是个好东西。那“C++之禅”正适合你!

The Zen of C++:

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.
  • 就是比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) :)

你领悟了它:“C++之禅”,它立足戏谑,无意冒犯他人(包括Python程序员)。无它,只为博君一笑!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值