c#设计之禅_C ++之禅

c#设计之禅

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的Zen带着眨眨眼的微笑和坚定不移的舌头,我希望这会为您的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哲学”的争论? 您是否想每次编译器耗费约4个空间时就用编译器击败它们? 他们不断尝试说服您强制使用空白语法的事实是否只是使您想抛出块而好事? 如果是这样,您需要的是“ The Zen Of 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.

C ++比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 ++的Zen可以轻松地自由使用,并且如果笑着说不应该冒犯任何人(包括Python程序员):)

翻译自: https://www.experts-exchange.com/articles/10157/The-Zen-Of-C.html

c#设计之禅

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值