In a software project, how would you differentiate a Component from a Module? [closed]

六月ゝ 毕业季﹏ 提交于 2019-12-03 10:03:12

问题


In a software, how would you differentiate a Component from a Module?


回答1:


I would say that the answer depends on who you ask.

I think of the difference as being one of granularity and role. A software component to my understanding is a self-contained entity with a well-defined (and preferrably stable) interface that interacts with the remaining parts of a system, and which has significant meaning from a system architecture point of view. An example would be a data access abstraction layer.

A module to me would rather be a deployable source code bundle containing code which shares a common purpose, but doesn't perform any significant role in the system (which means replacing it would not require changes to the system's overall architecture). An example would be a JSON serializer in a web service.




回答2:


Generally speaking,

  • a component is a relatively finely grained grouping of elements that serve a particular service in the solution.
  • a module is courser grained and acts as a grouping of one or more related services provided by the software.

A module will tend to make use of many componenents to provide its services whereas a component will likely to be constructed from a handful of classes and other components.

In any case its subjective and depends on the scale of the application. For a small application there is likely to be a single program (a module) and a number of components. In medium sized application there could be several modules and many components. In a large application you might want to introduce the term sub-system which is even more courser grained than a module !




回答3:


Modules are the capabilities of giving the software new functionality.

Components are elements




回答4:


Components are generally regarded as self-contained, pluggable items that follow some sort of software interface specification. A good example is GUI items such as enhanced textboxes and dropdowns. Basically anything that is not a complete program, but which can be plugged into another program to enhance its functionality.

The word Module has fallen out of favor in the past few years. Module is a more generic term, but some languages have it as a keyword, i.e. Modula 2. VB.NET has a Module keyword, but that is just an ordinary class with static members, and my understanding is that most VB programmers prefer to use the Class keyword.




回答5:


component: black-box module.

But there isn't any significant difference, really. Don't try to look for deep meaning here.




回答6:


Components are defined at software system level (as seen/thought at runtime). They are the elements of a executing system and together compose a larger system. These components/elements interact among themselves using connectors(interfaces). Imagine black boxes communicating among themselves, no care is given to their implementation/source code.

Module is defined at the programming language level (say, set of 5 classes comprise a module providing some functionality). They are defined at source code level as per the functionality provided by that collection of code. (example: persistence classes in your application responsible for interacting with the database).

Note that, module is also a type of component (going by categorisation and shares a "is-a" association with component).

Reference: Len Bass, Software arch. in practice and Dr. Timothy Lethbridge lecture




回答7:


A component is a just another name for module, they are the same thing. Usually component is the term that you can find in a software engineering book whereas module has a more widespread usage.



来源:https://stackoverflow.com/questions/1027875/in-a-software-project-how-would-you-differentiate-a-component-from-a-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!