关于“简单设计”的引文的阐述

发布于 2024-09-02 17:03:57 字数 523 浏览 11 评论 0原文

摘自Programming Perls

A Simple Design : Antonie de Saint-Exupery, 
the Fresh writer and aircraft designer, said that,
*"A designer knows he has arrived at perfection 
not when there is no longer anything to add,
but when there is no longer anything to take away."* 
More programmers should judge their work by this criteria.

请问有人可以详细说明一下吗?

当作者说“...带走”时,他的意思是什么?

An excerpt from Programming Perls:

A Simple Design : Antonie de Saint-Exupery, 
the Fresh writer and aircraft designer, said that,
*"A designer knows he has arrived at perfection 
not when there is no longer anything to add,
but when there is no longer anything to take away."* 
More programmers should judge their work by this criteria.

Can any one elaborate this, please?

What does the author mean when he say "...TAKE AWAY"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

飘过的浮云 2024-09-09 17:03:57

带走部分意味着如果剩下的都是必要的组件,那么设计可以被认为是简单的,如果你拿走任何东西,它就不起作用。

the Take Away part means that the design can be considered simple if all that remains are essential components, if you take away anything, it won't work.

横笛休吹塞上声 2024-09-09 17:03:57

基本上,这意味着当您无法进一步简化它时,您就完成了。

Basically it means when you can't simplify it any further, you are done.

网白 2024-09-09 17:03:57

作者的意思是简约中蕴藏着优雅。

早在计算机出现之前,安东尼·德·圣埃克苏佩里就不是一名程序员,而是一名作家和工程师(他写了《小王子》)。

The author means there is elegance in simplicity.

Antoine de Saint-Exupery was not a programmer, but a writer and engineer, long before computers were around (he wrote "The little prince").

往日 2024-09-09 17:03:57

就编程而言,这意味着删除代码行。原则是你应该努力寻求当然正确的解决方案,但也要优雅、简单等。

这样做有很多好处,但对于初学者来说,更少的代码使你的程序更容易维护,因为它们对于任何阅读它们的人来说都更容易理解。它还可以提供更大的灵活性,因为在修改更简单的解决方案时,您需要更改的代码更少,并且可以更加确信您的更改没有破坏应用程序的其他部分。

In terms of programming, it would mean deleting lines of code. The principle being that you should strive for solutions that are of course correct, but also elegant, simple, etc.

There are many benefits of this, but for starters having less code makes your programs easier to maintain, since they are easier for anyone reading them to understand. It can also allow for more flexibility, since when modifying a simpler solution you have less code to change, and can be more confident that your changes have not broken other parts of the application.

画尸师 2024-09-09 17:03:57

这是一个很好的原则的优雅表达方式——“让你的代码尽可能简单”。

但请注意不要误解这一点 - 重点是消除设计复杂性,而不是减少打字。需要去掉的好东西的示例有:

  • 重复代码(DRY 原则)
  • 不必要的功能参数
  • 不必要的集成层或样板代码
  • 客户不需要或不重视的功能

需要去掉的坏东西:

  • 注释
  • 长度合适,具有描述性
    变量和函数名
  • 显式用于的额外代码
    将代码库分成
    清晰定义的模块(如果您愿意,可以将其视为未来可维护性的“基本功能”)

It's an elegant way of expressing what is a very good principle - "make your code as simple as possible".

Be careful not to misinterpret this however - the point is to take away design complexity, not do less typing. Example of good things to take away are:

  • Repetitive code (DRY principle)
  • Unnecessary function parameters
  • Unnecessary integration layers or boilerplate code
  • Features that the customer doesn't need or value

Bad things to take away:

  • Comments
  • Decent length, descriptive
    variable and function names
  • Extra code explicitly used to
    separate the code base into
    cleanly defined modules (if you like you can consider this an "essential feature" for future maintainability)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文