In a software, how would you differentiate a Component from a Module?
views:
173answers:
6Modules are the capabilities of giving the software new functionality.
Components are elements
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.
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.
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.
component: black-box module.
But there isn't any significant difference, really. Don't try to look for deep meaning here.
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 !