Questions tagged [modules]

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

Filter by
Sorted by
Tagged with
161 votes
1 answer
110k views

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's user avatar
  • 6,303
93 votes
8 answers
167k views

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

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 ...
oHo's user avatar
  • 1,166
36 votes
1 answer
13k views

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 ...
DanielSank's user avatar
34 votes
3 answers
24k views

How to build completely modular web applications [closed]

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 ...
Ben's user avatar
  • 625
29 votes
2 answers
20k views

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 ...
user2418306's user avatar
28 votes
2 answers
71k views

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, ...
Pro Q's user avatar
  • 677
26 votes
4 answers
10k views

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

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 ...
Mahmoud Hossam's user avatar
26 votes
6 answers
873 views

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 ...
Roman Starkov's user avatar
24 votes
3 answers
8k views

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 ...
user6007354's user avatar
22 votes
3 answers
115k views

What actually is a module in software engineering? [closed]

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 ...
Hoan's user avatar
  • 345
14 votes
4 answers
4k views

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 ...
Michael's user avatar
  • 243
12 votes
1 answer
4k views

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() { ...
Henrique Barcelos's user avatar
11 votes
1 answer
13k views

Can one edit a built-in Python module?

I'm currently learning Python and I'm at the point in the book about using the Math library. I looked on the Python website and noticed the library was a bit scarce and am writing some more useful ...
qzxt's user avatar
  • 233
11 votes
2 answers
5k views

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 ...
xyzzyrz's user avatar
  • 211
11 votes
1 answer
3k views

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 ...
SonOfPirate's user avatar
  • 2,915
10 votes
3 answers
3k views

Why do .NET modules separate module file names from namespaces?

In implementations of the Scheme programming language (R6RS standard) I can import a module as follows: (import (abc def xyz)) The system will try to look for a file $DIR/abc/def/xyz.sls where $DIR ...
dharmatech's user avatar
10 votes
4 answers
3k views

Why are cyclic imports considered so evil?

Seriously, what's the big deal about having a few cycles in one's import graph? I see it as a lesser evil than having super fine grained imports that make keeping track of where to look for what code ...
dsimcha's user avatar
  • 17.2k
10 votes
2 answers
2k views

Module system for OOP language

I'm designing a simple OO programming language. It's statically typed, compiled, and executed by a VM - similar to Java. The difference is that I don't want to have such a strong emphasis on OOP. ...
Aber Kled's user avatar
  • 331
10 votes
2 answers
3k views

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 ...
alinaish's user avatar
  • 111
9 votes
1 answer
7k views

Node.js app private modules. Where to put them?

The situation would be: I develop 2 projects in my Node.js development environment, P1 and P2. P1 required the development of two simple modules, mod1 and mod2, which are stored in P1/lib. Each one ...
jaime's user avatar
  • 193
9 votes
1 answer
3k views

Good practices for packaging Python programs

I've been using Python for a while now, both in the context of personal and professional projects. One thing that occured to me recently is that I had never thought about a good way to deploy Python ...
Charles Menguy's user avatar
8 votes
1 answer
514 views

Refactoring a 1500 LOC method that only builds the graphical UI [closed]

I'm currently scratching my head over how to refactor a method that basically only builds the UI. The method is more than 1500 lines of code (LOC) long - and counting. It has grown, there was no plan ...
Kawu's user avatar
  • 207
8 votes
5 answers
2k views

Python: What is the point of using "import"?

I am not very clear on this aspect. Let's say you have a bunch of .py files that are their own separate modules. Why does each .py file need to import the others when they use that class? Or do they? ...
Kaitlyn Mcmordie's user avatar
8 votes
1 answer
11k views

How to Properly Make use of Codeigniter's HMVC

I have been having problems wrapping my brain around how to properly utilize the modular extension for Codeigniter. From what I understand, modules should be entirely independent of one another so I ...
Branden S. Smith's user avatar
7 votes
2 answers
4k views

Should unit test be in separated repository?

Should I put unit testing stuffs in a separate repository, not in the same repository as the programming library? So I reference the programming library as submodule. But most open source projects ...
linquize's user avatar
  • 1,160
7 votes
3 answers
1k views

Is the architecture of my project a common one? What's its name?

I am responsible for a software project for a few years now (a Java desktop application, which is mostly event-driven). I started it from scratch, and at the beginning of this project I made some ...
barjak's user avatar
  • 1,730
6 votes
2 answers
221 views

Why does CPython has both C and .python versions of modules?

The CPython implementation seems to have the same modules written both in C (e.g., datetime in .c) and also in .py for the same module (e.g., datetime in .py). My question is which version is used ...
multigoodverse's user avatar
6 votes
1 answer
201 views

Multi-platform Map Application

I'm working on a web project (PHP, jQuery) which currently using Google Maps powering up the map functionality of the application, however we need to make it multi-platform like you can go to the ...
Mahdi's user avatar
  • 1,993
6 votes
1 answer
2k views

How should I structure modules in an Angular.js application?

I am fairly new to Angular.js, and one that confuses me is how to best use modules in an application. It seems to me that modules can contain any of the other common constructs in AngularJS (...
GSto's user avatar
  • 8,531
6 votes
3 answers
316 views

How should modules access data outside their scope? [closed]

I run into this same problem quite often. First, I create a namespace and then add modules to this namespace. Then issue I always run into is how best to initialize the application? Naturally, each ...
Joe's user avatar
  • 79
5 votes
5 answers
2k views

How to think when grouping functionality into modules

What are some commonly used strategies when it comes to divide software into modules, other than there should not be any cyclic dependency between any modules? Some ways I think of Group everything ...
user877329's user avatar
5 votes
1 answer
2k views

Does a programming language with ML-style modules need packages?

This is a clarification of a closed question. I've limited the scope as requested. First, a few definitions, following e.g. A modular module system. Consider any programming language with a selected ...
Corbin's user avatar
  • 150
5 votes
1 answer
19k views

Where should I store the files for python modules I install?

If I download a module for Python (such as alglib) and installing is simply a matter of running python setup.py install Where should I be keeping the files I download, or the files that get created ...
Dan's user avatar
  • 153
5 votes
1 answer
236 views

How to introduce Google Analytics code in a modular way?

We are working on a very large codebase. It's basically a web-based operating system, with its own file system and applications. The system's UIs are generated dynamically with Javascript. We've ...
Stas Bichenko's user avatar
5 votes
2 answers
870 views

Javascript Architectural Model

Are there any obvious flaws to this OO architectural model which I intend to implement using javascript? It is similar to the MVP model but instead the role of the model is broken down into three ...
Joshua Bambrick's user avatar
4 votes
5 answers
2k views

Good Practices for development team in large projects

Since I started learning C a few years ago, I have never been a part of a team that worked on a project. I am very interested to know what are the best practices for writing large projects in C. One ...
Moshe Magnes's user avatar
  • 1,071
4 votes
1 answer
238 views

Redundant code ok? [closed]

Using C#/.Net, I have a page where the user can enter data and save these data by clicking a button. To save data, the user needs to enter a valid date, this means a date which has a certain format. ...
AGuyCalledGerald's user avatar
4 votes
4 answers
2k views

What is module in Software engineering context?

In Software engineering , I usually see that the word module when written it usually followed by a bracket (components, packages, classes … etc.) meaning that a module can be a class or a package or a ...
John adams's user avatar
4 votes
2 answers
2k views

How does java 9 manage module versions?

I was going through a fantastic talk by Alex and nearly all the things he spoke made sense to me except for the given thing. Link In a nutshell how does module manage versions. If I have a module v1 ...
log N's user avatar
  • 487
4 votes
2 answers
217 views

Does modular programming refer to modules or programs?

As far as I can tell, the main idea in modular programming is: program pieces that work well; complex behaviour results from piece_a and piece_b working together Though, I am not sure if it ...
user2738698's user avatar
4 votes
1 answer
128 views

Merging around 15 small Git repos of non-optional centralized web service components to a single large repo

In a centralized web service we break down the components into various small Git repos by software modules, e.g. authentication module, authorization module, data access module etc. (around 15 repos ...
user34401's user avatar
  • 751
4 votes
1 answer
637 views

Should I use a single platform for common services or modularize them?

I am designing a suite of web applications that have the same base functionality. That is, they all will know how to create and operate on widgets. The differences will be in their target audience and ...
Jeremy's user avatar
  • 4,791
4 votes
1 answer
3k views

Are there any alternatives to Hibernate Envers 3.6.2.Final?

I'm currently evaluating Hibernate Envers 3.6.2.Final; an auditing module part of Hibernate. As far as I am in my evaluation, I feel a little disappointed by Envers. I would expect much more from it ...
Stephan's user avatar
  • 145
4 votes
2 answers
3k views

PHP package management with/without Composer

I noticed that many (large) PHP applications use Composer for managing the dependencies. I'm currently trying to figure out if I should switch to Composer (at the moment I'm simply keeping my ...
Razvan's user avatar
  • 141
4 votes
1 answer
1k views

Java "module" size

Is it sensible to have micro-modules, say with only a very few (perhaps one) class in it? Or should I store things in bigger repositories? I am long-time Java developer with a software-engineering ...
David Kerr's user avatar
4 votes
0 answers
110 views

Is it possible to use PNaCl as a plugin framework?

I am looking to design an extremely modular game engine that allows for portable native plugins similar to the way PNaCl works with chrome. The biggest factors I need would be: cross platform, ...
Tyler Scott's user avatar
3 votes
5 answers
2k views

How to turn on/off code modules?

I am trying to run multiple sites using single code base and code base consist of the following module (i.e. classes) User module Q & A module Faq module and each class works on MVC pattern i....
Safran Ali's user avatar
3 votes
4 answers
238 views

Is a module allowed to make implicit assumptions?

I use .Net and C#. I have the following code in some module: DateTime validFrom = Convert.ToDateTime(validFromTxt.Text); This makes (in my opinion) the implicit assumptions that there is text in ...
AGuyCalledGerald's user avatar
3 votes
3 answers
2k views

Should I divide C++ program into multiple interacting applications?

We are discussing proposal to split a big C++ program into multiple separate executables that would communicated using shared memory. The shared data structures are large, so we do not want to use ...
h22's user avatar
  • 927
3 votes
1 answer
1k views

What is the difference between Applicative and Generative Modules, and Type Classes?

Reading the comments to this blog post made me realize I don't know much about some really interesting functional mechanisms between languages like Haskell, OCaml and Standard ML. I'd love a high-...
johnbakers's user avatar