简洁界面设计指南
当我阅读有关软件开发的文章时,我经常听到“干净的界面”这个词。人们谈论 API 和类的干净接口。
你如何定义“干净的界面”?是否有任何设计具有干净界面的系统的指南?
When I read articles on software development, I often heard of the phrase "clean interface". People talked about clean interface for APIs, and classes.
How do you define "clean interface"? Is there any guideline for designing a system with clean interface?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
关于这一点已经写了整本书,并且框架设计指南 (.NET-中心)是我的最爱之一。有很多内容,没有简单的答案,但如果我迫切需要一个简单的答案,我会说设计一个 API,这样简单的事情就可以完成,而开发人员无需阅读任何内容扩展文档。这意味着一个简单、一致的界面和合理的、描述性的名称。不要让基本的事情变得困难。
Whole books have been written on this, and Framework Design Guidelines (.NET-centric) is one of my favorites. There's a lot to it, and no simple answer, but if I were pressed for a simple answer, I'd say design an API so that the simple stuff can be done without the dev having to read any extended documentation. That implies a straightforward, consistent interface with sensible, descriptive names. Don't make it hard to do the basic stuff.
“干净的接口”是指不会泄漏实现细节的接口。它很容易理解,不会暴露其私有部分,也不会导致您和您所交互的代码之间的过度耦合。它更像是一种代码味道而不是严格的定义......
A "clean interface" is one that doesn't leak implementation details. It's easy to understand, doesn't expose its private parts, and doesn't result in excessive coupling between you and the code you're interfacing with. It's more of a code smell than a strict definition...
保持简单并编写精益、快速、不言自明的代码。一种易于阅读和维护的。
Keep it simple and write lean and swift, self-explanatory code. One that is easy to read and to maintain.