Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

As the definition "a module consists a single block of code that can be invoked in the way that a procedure, function, or method is invoked", the definition seems very vague and broad. So could anyone explain it in other clear words and show some actual example how to break a requirement into module. Thanks

share|improve this question
1  
Where did you get that definition from? –  Roc Martí Oct 7 '12 at 9:22
1  
Stephen Schach, “Classical and Object Oriented Software Engineering”, chapter 6 –  Hoan Oct 7 '12 at 9:24
add comment

closed as too broad by gnat, MichaelT, Dynamic, World Engineer Apr 8 at 0:16

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

4 Answers

Module might be an overloaded term, so much that Wikipedia describes it under the term Modular Programming when discussing its use relative to software. They discuss it in terms of structured programming which was based on a top-down design approach. Key characteristics of modularity related to the use of low coupling and high cohesion.

My usage has been that in a language like C or even C++, a module is related to defining a separately compiled unit from a source file (.c or .cpp) and typically one associated header file (.h). Other languages use module as a description, and the language Modula-2 put structuring around modules front and center in its name and its approach.

Historically, module has some other implications as were described in the D.L. Parnas paper "On the Criteria to be Used in Decomposing Software into Modules". He is primarily concerned with discussing benefits of replacing functional decomposition with data oriented decomposition which was a big step toward our present state of the art which is object oriented decomposition.

Object oriented languages are organized around classes, so maybe the term module is less important and less precise in that context.

share|improve this answer
    
Thanks, he is a big hero of mine and I have referenced him about eight times since I started on Stack Exchange. His work bridges structured and object oriented and is a good way to understand why we needed object oriented. –  DeveloperDon Oct 7 '12 at 16:13
add comment

A module,

  • encapsulates code and data to implement a particular functionality.
  • has an interface that lets clients to access its functionality in an uniform manner.
  • is easily pluggable with another module that expects its interface.
  • is usually packaged in a single unit so that it can be easily deployed.

For example, dapper.net encapsulates database access. It has an API to access its functionality. It is a single file that can plugged in a source tree to be built.

The concept of module comes from modular programming paradigm which advocates that software should be composed of separate, interchangeable components called modules by breaking down program functions into modules, each of which accomplishes one function and contains everything necessary to accomplish this.

share|improve this answer
    
if we have a bunch of requirements so each requirement can be considered as a module ? Eg: the requirement "Adding employee" can be a module ? –  Hoan Oct 7 '12 at 9:30
    
No or it depends. Program functions should be broken down into cohesive units. If the requirements can be broken down in such way, may be yes. But I haven't seen anything like this yet. Also, "Adding Employee" should not be a candidate for module. Usually modules are higher level structures which decompose programs into logically coherent units. –  Shuvo Oct 7 '12 at 9:46
add comment

There isn't a formal definition of a module, and what a module is (or isn't) in the context of your project largely depends on the nature and design of the project.

Generally speaking a module is a standalone piece of code that provides specific and tightly coupled functionality, modules define and enforce logical boundaries in your code.

share|improve this answer
add comment

Module is nothing but the flow of project, you have divide your project depends on subset, for example if I am creating a Facebook app the modules will be

1 Signin module
2 Signup module
3 Posting module
4 Sharing module
.
.
.
x Logout module

share|improve this answer
2  
is this only your opinion or you can back it up somehow? –  gnat Apr 3 at 10:35
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.