有人能解释一下软件设计和软件架构的区别吗?
更具体地说;如果你让别人给你展示“设计”——你希望他们展示什么?“建筑”也是如此。
我目前的理解是:
设计:系统特定模块/部分的UML图/流程图/简单线框(用于UI)
架构:组件图(显示系统的不同模块如何相互通信以及如何与其他系统通信),要使用什么语言,模式……?
如果我说错了,请指正。我提到了维基百科在http://en.wikipedia.org/wiki/Software_design和http://en.wikipedia.org/wiki/Software_architecture上有文章,但我不确定我是否理解正确。
用我自己的话来说,你是对的;
体系结构是将系统需求分配给系统元素。关于架构的四个陈述:
它可以引入非功能性需求,如语言或模式。
它定义了组件、接口、时序等之间的交互。
它不应该引入新的功能,
它将系统要执行的(设计的)功能分配给元素。
当对系统的复杂性进行细分时,体系结构是必不可少的工程步骤。
例如:想想你的房子,你的厨房不需要建筑师(只涉及一个元素),但整个建筑需要一些交互定义,比如门和屋顶。
设计是对功能(提议的)实现的一种信息表示。它旨在获得反馈,并与利益相关者进行讨论。这可能是一个很好的实践,但不是一个必要的工程步骤。
在厨房安装之前,最好能看到厨房的设计,但对于烹饪要求来说不是必需的:
如果我想一下,你可以这样说:
架构是为公众/工程师在更详细的抽象层次上设计的
设计是在一个不太详细的抽象层次上面向公众的
架构设计的基本原理来自于各种因素,其中最重要的是非功能性需求,比如可伸缩性,当然最重要的是经验。没有了理论基础,你就只剩下平淡的模式,或者怎么做。无论是在更高的层次上还是在类的层次上,它仍然是设计。
或者换句话说
架构是元设计,即设计设计。您有一些已知的模式适合某个解决方案空间,您会选择哪个,为什么?架构是当你回答“是哪个”和“为什么”时(“如何”已经在设计中给出了)。它当然不依赖于抽象级别,例如实现分布式会话不是一个类级别的任务,但是对于给定的体系结构有一些设计可供选择。
同样,体系结构也反映在类级设计中。在可伸缩的体系结构下,如果不考虑可伸缩性因素,类设计通常是不同的。为什么你必须有一个方法“BeginAsyncUpload”而不是“Upload”是一个架构决策。
有趣的是,当我们将注意力转移到更高层次的系统元素时,“哪个和为什么”问题变得更加重要,而“如何”变得不那么相关。从另一个方向来看,“如何”部分变得更加重要,这也是因为重复使用使得它变得很明显,例如,在抽象工厂和原型之间进行选择。
我认为当我们讨论设计与架构时,我们应该使用下面的规则来确定:如果您创建的软件图的元素可以一一映射到编程语言的语法结构,那么就是设计,如果不是架构。
So, for example, if you are seeing a class diagram or a sequence diagram, you are able to map a class and their relationships to an Object Oriented Programming language using the Class syntactical construction. This is clearly Design. In addition, this might bring to the table that this discussion has a relation with the programming language you will use to implement a software system. If you use Java, the previous example applies, as Java is an Object Oriented Programming Language. If you come up with a diagram that shows packages and its dependencies, that is Design too. You can map the element (a package in this case) to a Java syntactical construction.
Now, suppose your Java application is divided in modules, and each module is a set of packages (represented as a jar file deployment unit), and you are presented with a diagram containing modules and its dependencies, then, that is Architecture. There isn’t a way in Java (at least not until Java 7) to map a module (a set of packages) to a syntactical construction. You might also notice that this diagram represents a step higher in the level of abstraction of your software model. Any diagram above (coarse grained than) a package diagram, represents an Architectural view when developing in the Java programming language. On the other hand, if you are developing in Modula-2, then, a module diagram represents a Design.
(摘自http://www.copypasteisforword.com/notes/software-architecture-vs-software-design)
这个问题没有明确的答案,因为“软件架构”和“软件设计”有相当多的定义,而且都没有一个规范的定义。
一个很好的思考方法是Len Bass, Paul Clements和Rick Kazman的声明,“所有的架构都是设计,但并不是所有的设计都是架构”[软件架构实践]。我不确定我是否完全同意这一点(因为架构可以包括其他活动),但它抓住了架构是处理设计的关键子集的设计活动的本质。
我的稍微轻率的定义(在SEI定义页面上找到)是,它是一组决策,如果做出错误的决定,将导致项目被取消。
A useful attempt at separating architecture, design and implementation as concepts was done by Amnon Eden and Rick Kazman some years ago in a research paper entitled "Architecture, Design, Implementation" which can be found here: http://www.sei.cmu.edu/library/assets/ICSE03-1.pdf. Their language is quite abstract but simplistically they say that architecture is design that can be used in many contexts and is meant to be applied across the system, design is (err) design that can be used in many contexts but is applied in a specific part of the system, and implementation is design specific to a context and applied in that context.
So an architectural decision could be a decision to integrate the system via messaging rather than RPC (so it's a general principle that could be applied in many places and is intended to apply to the whole system), a design decision might be to use a master/slave thread structure in the input request handling module of the system (a general principle that could be used anywhere but in this case is just used in one module) and finally, an implementation decision might be to move responsibilities for security from the Request Router to the Request Handler in the Request Manager module (a decision relevant only to that context, used in that context).
我希望这能有所帮助!