在概要設(shè)計(jì)時(shí),發(fā)現(xiàn)參與討論的人對(duì)什么是模塊,模塊的劃分根據(jù)是什么的認(rèn)識(shí)有很大的差異。
我也不敢亂下定論,還是看看書(shū)本是怎么說(shuō)的:
---------------------------------------------------
1 .參考一下《軟件架構(gòu)藝術(shù)》一書(shū),
Stephen T. Albin 在里面描述:
Modules are discrete units of software (binary and source).
Binary modules are instantiated at run time and these instantiations are
commonly called components and connectors. A given module may contain the specifications for
several component types and connector types. The component (instances) may be of
a fixed number in some situations. For example, a Web server executable, when
launched, results in a single Web server component instance. The Web server module is the binary code that exists as a set of
program files. The Web server component is a running
instance of the Web server.
I have seen some confusion over the use of the terms module, component, and connector. A module is a discrete unit
of design that is composed of a hidden set of elements and a set of shared
elements. Modules have high internal cohesion and low external coupling. Modules
may represent the physical packaging of the application's binary code, which can
be described further by component types and connector types. Components and
connectors describe the physical instantiation of a system. The term component is often used to mean a component type or module. A
module refers to a unit of software that can be designed,
implemented, and compiled into a deliverable executable system or subsystem; it
is a unit of execution. A component is a runtime entity,
the definition of which exists in a module. A classic modular architecture is a
client-server system. The client and the server are two modules. The server
exports some elements such as a set of publicly visible relational database
tables and views. The client knows about this publicly visible schema. The
client and server are unaware of the internal composition of the other.
那么按紅色部分來(lái)說(shuō),如果說(shuō)一個(gè)dll或一個(gè)Exe里由多少個(gè)模塊組成這將是的笑話了。
2 .參考Mary shaw的《軟件體系結(jié)》:
模塊式軟件被劃分成獨(dú)立命名的,并可被獨(dú)立訪問(wèn)的成分。模塊劃分,粒度可大可小。劃分依據(jù)是對(duì)應(yīng)用邏輯結(jié)構(gòu)的理解。這個(gè)定義,似乎有沒(méi)有《軟件架構(gòu)藝術(shù)》那么嚴(yán)格。沒(méi)有定義具體什么為“被獨(dú)立訪問(wèn)”的成分。
3. 《Documenting_Software_Architectures》
A module tends to refer first and foremost to a
design-time entity. Parnas's foundational work in module design (1972) used
information hiding as the criterion for allocating responsibility to a module.
Information that was likely to change over the lifetime of a system, such as the
choice of data structures or algorithms, was assigned to a module, which had an
interface through which its facilities were accessed.
其說(shuō),模塊是設(shè)計(jì)時(shí)的實(shí)體,特點(diǎn)是信息隱藏和能通過(guò)模塊的接口訪問(wèn)。在介紹模塊視圖時(shí)他說(shuō):
A module is a code unit that implements a set of responsibilities.
A module can
be a class, a collection of classes, a layer, or any decomposition of the code
unit. Every module has a collection of properties assigned to it. These
properties are intended to express the important information associated with the
module, as well as constraints on the module. Sample properties are
responsibilities, visibility information, and author. Modules have relations to
one another. Example relations are
is part of or
inherits from.
---------------------------------------------------
不同的作者有不同的看法,但綜合一下,我認(rèn)為模塊因該是一個(gè)獨(dú)立設(shè)計(jì)的單元,并為其他模塊提供訪問(wèn)接口。也就是說(shuō),他是一個(gè)架構(gòu)中的設(shè)計(jì)元素,但不限制他的存在模式,也就是他是提供了可訪問(wèn)接口而且實(shí)現(xiàn)某一功能的一個(gè)實(shí)體,可以是一個(gè)類或一組類或可執(zhí)行程序等。
posted on 2008-12-02 11:21
名羽 閱讀(340)
評(píng)論(0) 編輯 收藏 引用 所屬分類:
project sum up