Module (programming): Difference between revisions

Content deleted Content added
recat
rearrange; mention modularity; section
Line 1:
{{unreferenced}}
In [[computer science]], a '''module''' is a software entity that groups a set of (typically [[Cohesion|cohesive]]) [[subprogram]]s and [[data structure]]s. Modules are units that can be [[compiler|compiled]] separately, which makes them reusable and allows multiple programmers to work on different modules simultaneously. Modules also promote [[modularity (programming)|modularity]] and encapsulation (i.e. [[information hiding]]), throughboth aof separationwhich betweencan themake [[interface]]complex andprograms theeasier [[implementation]]to understand.
 
TheModules provide a separation between [[interface]] and [[implementation]]. A module interface expresses the elements that are provided and required by the module. The elements defined in the interface are visible to other modules. The implementation contains the working code that corresponds to the elements declared in the interface. Languages that explicitly support the module concept include [[Ada programming language|Ada]], [[D programming language|D]], [[F programming language|F]], [[Fortran|Fortran]], [[Haskell programming language|Haskell]], [[ML programming language|ML]], [[Modula-2]], [[Python programming language|Python]] and [[Ruby programming language|Ruby]].
 
== Modules and classes ==
Modules are units that can be compiled separately. This makes them reusable and allows multiple actors to work on different modules simultaneously.
DifferencesThe differences between [[Class (computer science)|classes]] and modules are the following:
 
Differences between [[Class (computer science)|classes]] and modules are the following:
 
*Classes can be instantiated to create [[Object (computer science)|objects]],
Line 11:
*[[Polymorphism (computer science)|Polymorphism]] allows relationships between class instances to change at run-time, while relations between modules are static.
 
SimilaritiesThe similarities between [[Class (computer science)|classes]] and modules are the following:
 
*Both can be used to hide abstraction from public view.
*Both can form a hierarchy of modules/classes.
 
Languages that explicitly support the module concept include [[Ada programming language|Ada]], [[D programming language|D]], [[F programming language|F]], [[Fortran|Fortran]], [[Haskell programming language|Haskell]], [[ML programming language|ML]], [[Modula-2]], [[Python programming language|Python]] and [[Ruby programming language|Ruby]].
 
==Module Interconnection Languages (MILs)==