124 votes

Why prefer a package manager over a library folder?

An important point missing from the other answers: Using a package manager means having a configuration that indicates which library versions you are using and makes sure that config information is ...
sleske's user avatar
  • 10.2k
108 votes
Accepted

Folder-by-type or Folder-by-feature

Folder-by-type only works on small-scale projects. Folder-by-feature is superior in the majority of cases. Folder-by-type is ok when you only have a small number of files (under 10 per type, let's say)...
David says Reinstate Monica's user avatar
40 votes

Why prefer a package manager over a library folder?

Pros of lib folder disappear quickly after you move from small scale development to bigger work. For example the "benefit" of not requiring an external tool is trumped by the work required ...
Kayaman's user avatar
  • 1,950
36 votes

Why prefer a package manager over a library folder?

You're missing many of the advantages of package managers. Package managers allow you to avoid checking large (several megabyte or larger) binaries into source control. Doing so is anathema to many ...
jpmc26's user avatar
  • 5,409
34 votes

Folder-by-type or Folder-by-feature

This really has nothing to do with the technology in question, unless you use a framework that forces folder-by-type on you as part of a convention-over-configuration approach. Personally, I am ...
Michael Borgwardt's user avatar
33 votes

Why are packages and modules separate concepts in Java 9?

The concept of a module is different from the instantiation of that concept. Java has always had modules. A method is a module, so is a class and so is a package. A module is a unit of organisation ...
Neil Bartlett's user avatar
29 votes

Folder-by-type or Folder-by-feature

Working with packages-by-feature stands out in high modularity and cohesion. It allows us to play with the components' scope. For example, we can use the access modifiers to enforce LoD and the ...
Laiv's user avatar
  • 14.6k
19 votes
Accepted

Naming convention for test packages

That is a good convention. Sometimes you want to write unit tests for package-private classes and methods also. You won't be able to call them from a unit test class placed in another package. There ...
COME FROM's user avatar
  • 2,696
16 votes

Why prefer a package manager over a library folder?

Having recently converted our product from using manually downloaded libraries to automatic package management with Nuget, I can say that using a package manager has massive benefits. Our product is ...
17 of 26's user avatar
  • 4,828
14 votes

Why prefer a package manager over a library folder?

No need of external tool to manage packages That's kind of a non-point is it? If I use a package manager, I don't need to have a lib folder. I also don't have to manage the packages myself. No ...
Athos vk's user avatar
  • 430
12 votes
Accepted

Same class and namespace name

You're right that you shouldn't name the namespace the same as a type it contains. I think there are several approaches you can use: Pluralize: Model.DataSources.DataSource This works especially well ...
svick's user avatar
  • 10k
11 votes
Accepted

How should one manage constants across multiple languages?

Although I think your current approach is probably the simplest and most straightforward, here are a couple alternative ideas: Extract your constants (and perhaps models) to a different package that ...
Samuel's user avatar
  • 9,187
10 votes

Why are packages and modules separate concepts in Java 9?

Let me hazard at an answer, though much of it may be assumptions/splitting hairs/ranting, etc. Are they the same thing? Well, yes and no From this JavaWorld article about "Modularity in Java 9&...
Tersosauros's user avatar
10 votes

Get license information for all used NuGet packages

Based on multiple sources, I've made a PowerShell script that reads all NuGet packages and fetches the license files and put that in a folder called "licenses". The script should be run on ...
jerone's user avatar
  • 211
10 votes
Accepted

Best ways to deal with unexpected bugs in already published npm packages

v0.1.0 being useless is far better than v0.1.0 working for some people and not for others depending on when they downloaded it. The whole point of versioning is avoid that confusion. Once it's ...
candied_orange's user avatar
9 votes

Difference between package and component?

Some years ago, I was participating at a workshop where the tutor asked us to list the terms for software "modules", "components", "libraries", "packages" and so on. The attendants came up with a list ...
Doc Brown's user avatar
  • 206k
8 votes

Java-style package naming and second-level country domains

Java tutorials make it pretty clear that you should use the inverse of your domain name, e.g. uk.co.domainname. If you mix it up and go with co.uk.domainname then you run the risk of someone with the ...
Clarkey's user avatar
  • 181
8 votes
Accepted

Releasing a project for multiple languages and package managers

It doesn't really matter which approach you choose. Both using a monorepo and separate repos are reasonably common approaches. Keeping all variants in a single repository is definitely simpler to ...
amon's user avatar
  • 134k
8 votes
Accepted

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

Modules and packages solve different problems, though they certainly overlap, and can be made nearly synonymous. Packages provide a critical source of namespacing. Modules aren't guaranteed unique ...
Kenogu Labz's user avatar
7 votes

Writing R packages to replace .R scripts?

The introduction to the R Packages book explains the benefits pretty well: In R, the fundamental unit of shareable code is the package. A package bundles together code, data, documentation, and tests,...
Robert Harvey's user avatar
7 votes

Should I include scripts inside a Python package?

Yes, this is possible and quite common for packages that serve as both command-line tools and imported libraries. In setup.py, add a module's function as an entry point: setuptools.setup( ... ...
Jace Browning's user avatar
6 votes
Accepted

Should I include scripts inside a Python package?

Two years later, I feel that I can answer my own question. It is preferable to use the Setuptools entry_points method. This is described well in the Click documentation, and the main points are: ...
wrgrs's user avatar
  • 344
6 votes
Accepted

How to deal with constants that are shared between multiple packages?

Putting all constants into one package is a strategy which mostly works for smaller projects, and may be completely sufficient for your case. However, that approach does not scale well when a project ...
Doc Brown's user avatar
  • 206k
5 votes
Accepted

Where do you put the "main function" of a Python app?

If the whole application fits into a single file, that is the most simple solution. Otherwise, it is best to create a complete package. When you create a setuptools-based setup.py file, you can ...
amon's user avatar
  • 134k
5 votes
Accepted

Breaking a Large Python Project into Multiple Packages

Multiple top-level packages are in principle OK, but I think they are rarely an appropriate solution. By itself, a directory structure does not say anything about coupling or complexity. The ...
amon's user avatar
  • 134k
5 votes

If I package by feature, but have many homogeneous classes, what is preferable?

As someone who has suffered under a package by layer system for years I appreciate what you're trying to do. However, you are trying to faithfully stick to your organizing principle even if it forces ...
candied_orange's user avatar
5 votes

Why prefer a package manager over a library folder?

It is the difference between just using libraries (lib directory), and using them, maintaining meta-information (package manager). Such meta-information concerns version numbers, (transitive) ...
Joop Eggen's user avatar
  • 2,041
5 votes
Accepted

Is it reasonable for an R package to import another package just for coding convenience?

In general, it is completely up to you - the creator of a package - to define your package's dependencies. Ultimately you are saying to future users of your package: you must be willing and able to ...
BrianH's user avatar
  • 6,112
5 votes

Doubt about package-by-feature and circular dependencies

I was thinking to expose some Interfaces in a contracts/interfaces package in such a way that specific classes such as Record and DataStorage would implement them and there wouldn't be a circular ...
Laiv's user avatar
  • 14.6k
4 votes

Writing R packages to replace .R scripts?

I think your question is not really specific to R, the same issue often arises when a group of teammates has some code to share amongst them, written in whatever programming language they use. With a ...
Doc Brown's user avatar
  • 206k

Only top scored, non community-wiki answers of a minimum length are eligible