有人能解释一下软件设计和软件架构的区别吗?
更具体地说;如果你让别人给你展示“设计”——你希望他们展示什么?“建筑”也是如此。
我目前的理解是:
设计:系统特定模块/部分的UML图/流程图/简单线框(用于UI)
架构:组件图(显示系统的不同模块如何相互通信以及如何与其他系统通信),要使用什么语言,模式……?
如果我说错了,请指正。我提到了维基百科在http://en.wikipedia.org/wiki/Software_design和http://en.wikipedia.org/wiki/Software_architecture上有文章,但我不确定我是否理解正确。
建筑就是设计,但并非所有的设计都是建筑。因此,严格地说,尝试区分架构设计和非架构设计会更有意义。有什么区别呢?视情况而定!每个软件架构师可能有不同的答案(ymmv!)我们开发我们的启发式来提出一个答案,例如“类图是架构,序列图是设计”。有关更多信息,请参阅DSA书籍。
人们常说,架构比设计处于更高的抽象级别,或者架构是逻辑的,而设计是物理的。但这种观念虽然被普遍接受,但在实践中却毫无用处。在高抽象和低抽象之间,逻辑和物理之间,你的界线在哪里?视情况而定!
所以,我的建议是:
create a single design document.
name this design document the way you want or, better, the way the readers are more accustomed to. Examples: "Software Architecture", "Software Design Specification".
break this document into views and keep in mind you can create a view as a refinement of another view.
make the views in the document navigable by adding cross-references or hyperlinks
then you'll have higher level views showing broad but shallow overview of the design, and closer-to-implementation views showing narrow but deeper design details.
you may want to take a look at an example of multi-view architecture document (here).
说了这么多……我们需要问的一个更相关的问题是:多少设计才足够?也就是说,我什么时候应该停止描述设计(用图表或散文),而应该转向编码?
这个问题没有明确的答案,因为“软件架构”和“软件设计”有相当多的定义,而且都没有一个规范的定义。
一个很好的思考方法是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).
我希望这能有所帮助!