最重要的结构化软件设计原则是什么?

发布于 2024-08-18 21:37:51 字数 1432 浏览 5 评论 0原文

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

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

发布评论

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

评论(3

少跟Wǒ拽 2024-08-25 21:37:51

结构化编程和结构化设计不一定是同一件事。一般来说,结构化设计将重点关注将事物分解为结构化元素。有很多方法在这里同样有效,但我想说它们中的大多数都专注于信息隐藏。

  • 面向对象设计显然将事物分解为对象,操作和数据在与层次结构相关的紧密绑定的类中结合在一起。
  • 抽象数据类型本质上是非 OO 等价物,其中数据和操作结合在一起,但并不以与层次结构完全相同的方式绑定。面向对象的设计。层次结构和继承在 ADT 中不起作用,至少在我所见过的 ADT 中不起作用。
  • 元编程侧重于构建泛型类型,然后针对特定数据类型适当地专门化它们。
  • 契约编程侧重于避免直接继承。通常,它通过多个类的组合将契约接口与实现结合起来。
  • 设计模式专注于几乎可以在任何上下文中实现的高级元设计(模式),尽管它们最常见于 OO 设计的讨论中。

知道如何在多种范式中构建程序始终是有价值的知识。知道如何谈论设计的结构更加挑剔,但最终更有价值。

Structured programming and structured design wouldn't necessarily be the same thing. Structured design in general is going to focus on breaking things down into structured elements. There are a bunch of approaches that are equally valid here, but I would say that most of them focus on information hiding.

  • Object Oriented Design obviously breaks things down into objects with operations and data held together in tightly bound classes related in hierarchies
  • Abstract Data Types are essentially non-OO equivalents where the data and operations are held together but are not bound in quite the same sense as in object oriented design. Hierarchy and inheritance don't play a role with ADTs, at least not in those that I've seen.
  • Metaprogramming focuses on building generic types and then specializing them appropriately for specific data types
  • Programming to a contract focuses on avoiding direct inheritance. Typically it combines Contract Interfaces with implementation by composition of multiple classes.
  • Design Patterns focus on high-level meta-designs (patterns) that can be implemented in almost any context, although they are most commonly seen in discussions of OO design.

Knowing how to structure programs in multiple paradigms is always going to be valuable knowledge. Knowing how to talk about the structure of a design is more finicky but ultimately even more valuable.

女中豪杰 2024-08-25 21:37:51

MyersYourdon 和 Constantine,两个最重要的原则是

  • 耦合(不同模块如何与一个模块相关)另一个)

  • 内聚(模块内部如何构造)

我同意 Mike Burton 的作者的观点广告可能缺乏线索,但是您可以很容易地温习“模块耦合”和“模块内聚”,如果您可以在图书馆找到它们,那么这些书就值得一读。我只能在 IBM 付费网站上找到原始论文

In the classic works on composite/structured design by Myers and by Yourdon and Constantine, the two most important principles are

  • Coupling (how different modules relate to one another)

  • Cohesion (how a module is structured internally)

I agree with Mike Burton that the author of the ad probably lacks a clue, but you can brush up on "module coupling" and "module cohesion" easily enough, and if you can get them at a library, the books are worth reading. I can find the original paper only at an IBM pay site.

不弃不离 2024-08-25 21:37:51

我总是引用贝尔电话实验室的 GD Bergland 于 1981 年 10 月发表在 IEEE Micro 杂志上的一篇古老文章 - 不管你信不信。它大约有十三页长,为您提供了您需要了解的大部分内容。问题是你可能找不到它——即使是在 IEEE & IEEE。即使您是会员。

您可以在亚马逊找到另一本非常好的(虽然很旧)书“软件设计技术教程”,作者是 Peter Freeman(编辑)。

http:// www.amazon.com/gp/offer-listing/0818605146/ref=dp_olp_0?ie=UTF8&redirect=true&condition=all

What I always refer to is a ancient article in IEEE Micro Magazine October 1981 by G. D. Bergland of Bell Telephone Laboritories - belive it or not. It's about thirteen pages long and gives you most everything you need to know. Trouble is you may not be able to find it - even at IEEE & even if your a member.

You can find another very good (though old) book "Tutorial on Software Design Techniques" by Peter Freeman (Editor) at Amazon.

http://www.amazon.com/gp/offer-listing/0818605146/ref=dp_olp_0?ie=UTF8&redirect=true&condition=all

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文