Questions tagged [modules]

Modules are independent software components that result from the decomposition of a larger software into more manageable pieces.

Modules are independent software components that result from the decomposition of a larger software into more manageable pieces.

The prime purpose of modules is to provide a packaging of elements as well as encapsulation to hide the implementation details from the users of the module.

141 questions
159
votes
1 answer

Module vs. Package?

Whenever I do from 'x' import 'y' I was wondering which one is considered the 'module' and which is the 'package', and why it isn't the other way around?
Dark Templar
  • 6,223
  • 16
  • 46
  • 46
93
votes
8 answers

Using multiple Git repositories instead of a single one containing many apps from different teams?

I am migrating a 10-years-old big CVS repository to Git. It seemed obvious to split this multiple-projects repository into several Git ones. But the decision-makers are used to CVS, therefore their point of view is influenced by CVS philosophy. To…
oHo
  • 1,166
  • 1
  • 8
  • 9
35
votes
1 answer

Single python file distribution: module or package?

Suppose I have a useful python function or class (or whatever) called useful_thing which exists in a single file. There are essentialy two ways to organize the source tree. The first way uses a single module: - setup.py - README.rst - ...etc... -…
DanielSank
  • 461
  • 1
  • 4
  • 7
34
votes
3 answers

How to build completely modular web applications

In the coming months we're going to begin a project where we take a system we've built for a client (v1) and rebuild it from scratch. Our goal with v2 is to make it modular, so that this specific client will have their own set of modules they use,…
Ben
  • 625
  • 1
  • 5
  • 10
29
votes
2 answers

Why are packages and modules separate concepts in Java 9?

Java 9 will have modules in addition to packages. Usually languages have one or the other. And most programmers perceive two terms as synonyms. Modules are built on top of packages, treating them as primitives. Composite pattern suggests to treat…
user2418306
  • 578
  • 1
  • 5
  • 14
28
votes
2 answers

Classes vs. modules in Python

Python has many modules (such as re) that perform a specific set of actions. You can call the functions of this module and get results, and the module as a whole has an idea behind it (in this case, dealing with regular expressions). Classes seem to…
Pro Q
  • 667
  • 1
  • 7
  • 15
26
votes
6 answers

Separating a "wad of stuff" utility project into individual components with "optional" dependencies

Over the years of using C#/.NET for a bunch of in-house projects, we've had one library grow organically into one huge wad of stuff. It's called "Util", and I'm sure many of you have seen one of these beasts in your careers. Many parts of this…
Roman Starkov
  • 4,469
  • 3
  • 31
  • 38
25
votes
4 answers

Are there any negative side effects of splitting up large modules?

I was browsing a github project and found this module which has more than 10 thousand lines. Is it a common practice to have that much code in a single module? It seems to me that this should be split over multiple modules. Maybe one for each db…
Mahmoud Hossam
  • 3,817
  • 2
  • 29
  • 41
24
votes
3 answers

Why are module-specific prefixes widely used for function names in C modules?

In some C projects, function names start with a common prefix indicative of the module name, for example: mymodule_do_this_stuff(); mymodule_do_that_stuff(); Is there a justification for doing so when the linkage is internal, and there is no…
user6007354
  • 351
  • 2
  • 5
22
votes
3 answers

What actually is a module in software engineering?

According to Stephen Schach, “Classical and Object-Oriented Software Engineering”, chapter 6: a module consists a single block of code that can be invoked in the way that a procedure, function, or method is invoked This seems very vague and broad.…
Hoan
  • 345
  • 1
  • 2
  • 6
14
votes
4 answers

Is it good practice to keep the main function separate in its own file?

Is it good practice to have a main.c file that just has the main function in it and no other functions so that all other functions can be interfaced? If there is no definitive rule, when is it good to do so and not to do so?
Michael
  • 243
  • 2
  • 5
12
votes
1 answer

Convention to where to declare module.exports on Javascript files

Is there any convention to where we should declare the module.exports no Javascript/Node.js module files? Should it be in the beginning of the file like: module.exports = Foo; function Foo() { this.bar = 'bar'; } Foo.prototype.getBar =…
Henrique Barcelos
  • 909
  • 1
  • 10
  • 18
11
votes
1 answer

Architecting a modular service application

I'm looking at architecting a new solution that is very modular by nature and would like to create a structure that supports that design to allow for easy future expansion, clear separation of concerns, licensing by module, etc. Most of what I've…
SonOfPirate
  • 2,885
  • 4
  • 25
  • 28
11
votes
2 answers

How to modularize and package a client-side Javascript library today?

I've been catching up with the modern client-side JS ecosystem and reading up on CommonJS and AMD (incl. associated tools - browserify, requirejs, onejs, jam, dozens of others). If I'm writing a Javascript library, how do I modularize/package it…
Yang
  • 211
  • 2
  • 5
10
votes
2 answers

Is Module Pattern in JavaScript is useful only for singleton creation?

Some articles (JavaScript Module Pattern In Depth, Mastering The Module Pattern) describe defining modules in JavaScript like in the snippet below (from Addy Osmani's "Learning JavaScript Design Patterns"): var testModule = (function () { var…
alinaish
  • 111
  • 1
  • 6
1
2 3
9 10