写点什么

掉入成功的深渊

作者:Shinta
  • 2022 年 2 月 25 日
  • 本文字数:2543 字

    阅读完需:约 8 分钟

Falling Into The Pit of Success

掉入成功的深渊

29 Aug 2007


我经常认为 C++ 是我陷入绝望的编程语言。没有管理 C++非常容易跌入陷阱,想想缓冲区溢出,内存泄漏,Double frees(不知道怎么翻译,就是把一个指针释放了两次),内存分配器和释放器的不匹配,使用释放的内存,无数种方法来破坏堆栈或堆 --- 而且这只是内存问题中的一小部分。C++中还有更多的陷阱。C++经常把你扔到绝望的深渊中,你不得不爬上名为质量的山顶。(不要和攀登疯狂的悬崖混淆,这是不一样的。)

I often think of C++ as my own personal Pit of Despair Programming Language. Unmanaged C++ makes it so easy to fall into traps. Think buffer overruns, memory leaks, double frees, mismatch between allocator and deallocator, using freed memory, umpteen dozen ways to trash the stack or heap – and those are just some of the memory issues. There are lots more "gotchas" in C++. C++ often throws you into the Pit of Despair and you have to climb your way up the Hill of Quality. (Not to be confused with scaling the Cliffs of Insanity. That's different.)


这就是 C++的问题,它在保护你不受到自己的伤害这个方面做的很糟糕。当年用 C++编程的时候,你总是在绝望中徘徊,你和你的深渊只有一步之遥。

That's the problem with C++. It does a terrible job of protecting you from your own worst enemy – yourself. When you write code in C++, you're always circling the pit of despair, just one misstep away from plunging to your doom.


选一种不会让你陷入绝望的语言不会更好吗?但是这种避免事故模式并不是一个值得称赞的模式,那为什么不直接选一种编程语言能让你毫不费力的陷入“成功的深渊”呢?

Wouldn't it be nice to use a language designed to keep you from falling into the pit of despair? But avoiding horrific, trainwreck failure modes isn't a particularly laudable goal. Wouldn't it be even better if you used a language that let you effortlessly fall into The Pit of Success?


成功的深渊 : 相较于登顶或穿越沙漠等需要通过很多的考验才可以获得成功,我们希望我们的客户通过我们的平台和框架可以简单的获得成功。如果我们很容易就陷入了麻烦,那我们就是失败。

The Pit of Success: in stark contrast to a summit, a peak, or a journey across a desert to find victory through many trials and surprises, we want our customers to simply fall into winning practices by using our platform and frameworks. To the extent that we make it easy to get into trouble we fail.


Rico Mariani 在讨论编程语言设计的时候指出了这个概念。当你选择了 C#、Python 或 Ruby 而不是 C++进行编程的时候,你就会放弃一些性能上的优势。但你得到的减少是避免坠入深渊的可能性,而且更有机会进入成功的深渊。

Rico Mariani coined this term when talking about language design. You may give up some performance when you choose to code in C#, Python, or Ruby instead of C++. But what you get in return is a much higher likelihood of avoiding the miserable Pit of Despair – and the opportunity to fall into the far more desirable Pit of Success instead.


正如 Brad Abrams 指出的,这个概念超越了语言,一个设计良好的 API 应该让开发者坠入成功。

As Brad Abrams points out, this concept extends beyond language. A well designed API should also allow developers to fall into the pit of success.


[Rico]曾告诫我们要思考如何构建平台,引导开发者写出优秀的,高性能的代码,这样开发者们就可以去做“正确的事情”。这个概念真的引起了我强烈的共鸣。这也是好的 API 设计的关键。我们应该去构建 API 去引导开发者朝着正确的方向发展。

[Rico] admonished us to think about how we can build platforms that lead developers to write great, high performance code such that developers just fall into doing the "right thing". That concept really resonated with me. It is the key point of good API design. We should build APIs that steer and point developers in the right direction.


我认为这个概念应该更进一步,扩展到各种应用程序像是:大型的,小型的,网页的,界面程序的和命令行应用程序等等。我经常说一个设计良好的系统让做正确的事情变得容易,而做错误的事情变得困难(但不是不可能)。如果我们正确的设计我们的应用程序,我们的用户讲不可避免的进入成功的深渊。有的人困难比其他人花费更长时间,但他们最终都可以抵达到哪里。

I think this concept extends even farther, to applications of all kinds: big, small, web, GUIs, console applications, you name it. I've often said that a well-designed system makes it easy to do the right things and annoying (but not impossible) to do the wrong things. If we design our applications properly, our users should be inexorably drawn into the pit of success. Some may take longer than others, but they should all get there eventually.


如果用户不是靠着自己找到成功---又或者是他们在合理的时间内无法找到成功---这不是他们的错。这是我们的故障。我们没有让他们能轻松的进入成功。考虑一下你的项目:你的工作是不断的重新构建你的语言、API 或者应用程序,使得成功的深渊越来越深、越广。

If users aren't finding success on their own – or if they're not finding it within a reasonable amount of time – it's not their fault. It's our fault. We didn't make it easy enough for them to fall into the pit of success. Consider your project a Big Dig: your job is to constantly rearchitect your language, your API, or your application to make that pit of success ever deeper and wider.


https://blog.codinghorror.com/falling-into-the-pit-of-success/

自己翻译着玩的,有什么不对欢迎指出。

用户头像

Shinta

关注

还未添加个人签名 2018.11.08 加入

还未添加个人简介

评论

发布
暂无评论
掉入成功的深渊