Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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 !

Modules are the capabilities of giving the software new functionality.

Components are elements

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.

component: black-box module.

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

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top