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
46 votes
Accepted

What's in the "contrib" folder?

It is for software that has been contributed to the project, but which might not actually be maintained by the core developers. Naming it "contrib" or "Contrib" is a long established convention, but ...
Bryan Oakley's user avatar
  • 25.3k
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

What's the best structure for a repository?

Based on my experience with open source, you should consider a few things before setting up a structure: Things to consider Language and Technology: Frameworks and languages dictate a lot of what your ...
EMarshall's user avatar
  • 439
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
24 votes
Accepted

How to deploy a junior programmer

I normally develop and push straight on the development branch. With all due respect, this is a problem. Nobody should be pushing directly onto develop, certainly not if you're using gitflow - ...
Philip Kendall's user avatar
15 votes

Is it a good idea to share repositories across microservices in Spring Boot Application?

I vehemently opposed Vehemence makes others stop listening and limits our perception, hence our capacity to find solutions too. In my experience, we are vehement at defending or opposing ideas we don'...
Laiv's user avatar
  • 14.6k
14 votes
Accepted

Have the unit test "using" the project, or just have same namespace?

Your unit tests are in a separate project and serve a separate function from your main code, so putting them into a separate namespace makes the most sense to me. If you're considering putting them ...
svick's user avatar
  • 10k
11 votes
Accepted

Avoid dependency version conflicts?

It's not your problem. It is up to your end user to resolve. It just comes with the territory of using third-party dependencies, and I've had to resolve dependency conflicts more times than I count. ...
Samuel's user avatar
  • 9,187
10 votes

How can I effectively use one file per class in C++?

In C++ you have full flexibility how you want to organize your files. But you have to get accustomed to this freedom to make the good choices: A first practice is to have include guards in headers, ...
Christophe's user avatar
  • 76.6k
10 votes

If taking over code of a third party, what are the delivarables?

You're being offered a release with source. What you're asking for is the source code repository. No modern developer would want to be without the history in the repository. The question is, what ...
candied_orange's user avatar
10 votes
Accepted

How do I start using Git for differing code bases from different servers?

Push the production stuff into the master branch of a new repo. Create a develop branch from that, and then merge the staging server into it. You may wind up with conflicts that need to be resolved. ...
mmathis's user avatar
  • 5,458
10 votes
Accepted

What's the best way to handle a large multi-file class in Javascript?

In situations like this, when I have one part of my program that needs to stand alone as a single, self-contained module but contains many thousands of lines of code, I prefer to take a compositional ...
Ken Halbert's user avatar
10 votes
Accepted

Adding library as dependency only to use one function

This really really depends and has to be decided on a case by case basis. Also, the modern JavaScript ecosystem has a strong bias towards using tiny libraries, so conventions from other ecosystems do ...
amon's user avatar
  • 134k
9 votes

What's in the "contrib" folder?

It's meant for libraries or components that contribute to the project, but aren't owned or a part of the project itself. I've always used it as a common or shared location to put any third-party ...
Amac's user avatar
  • 91
8 votes

How can I effectively use one file per class in C++?

Say I have some kind of game where there is a class representing the game world and a class to represent the units. If the game world class has a method to get the unit at a location, that's all well ...
Doc Brown's user avatar
  • 206k
8 votes

C project avoiding naming conflicts

What about having a global structure variable prefilled with function pointers? lib.h #pragma once typedef struct { void (*doFoo)(int x); const char *(*doBar)(void *p); } YourApi; extern ...
Calmarius's user avatar
  • 1,893
8 votes
Accepted

How are large JavaScript applications supposed to be structured?

If you are not familiar with JavaScript patterns, I can tell you a lot of large applications and libraries are using Revealing Module Pattern, but there are many other patterns you can use depending ...
53777A's user avatar
  • 1,716
8 votes
Accepted

best way to install local package into docker image

I'm not sure why people have downvoted you, other than there is a well documented and easy way to go about this. Docker images are layered, and you can build all your essential-for-all-images ...
Mitch Kent's user avatar
7 votes

What's in the "contrib" folder?

Git is a great example of open source software that uses this convention: https://github.com/git/git/tree/master/contrib Here's a relevant excerpt from that README.md file: Contributed Software ...
Alex W's user avatar
  • 170
7 votes
Accepted

What is the idiomatic way to split code between separate files in Rust?

In multi-paradigm languages such as Python, C++, and Rust, it is not always easy to see what should be in the same file. In particular with Rust, it is not even necessary to keep data definitions (...
amon's user avatar
  • 134k
6 votes

Elements of structure in a functional program

Not sure this is going to entirely satisfy your question, but hopefully gets near. Requirements / use cases / functional specs / whatever-you-call-them are still great tools for communicating an FP ...
Kasey Speakman's user avatar
6 votes

How can I effectively use one file per class in C++?

Your options for resolving circular dependencies are: forward declaration Yes, this really is commonly used and isn't considered a hack. Note that only the public interfaces of your two ...
Useless's user avatar
  • 12.6k
6 votes
Accepted

Should automated unit tests be part of the build?

Disclaimer: I'm not a purist regarding testing. I like to do my TDD, but I don't think 100% coverage is necessary for all projects. That being said, the rule of thumb should be "every change must be ...
Machado's user avatar
  • 4,110
6 votes
Accepted

Unit Test : Do I need to make an unit test for each class in my project

Business rules are the most important thing to test. Those should be in behavior objects (objects that DO things) not in value objects (getters and setters). Testing should never be done blindly or ...
candied_orange's user avatar
6 votes

How to deploy a junior programmer

To add to @Philip's excellent answer I think you also have to look at this from a human point of view. If you stratify your working practices then you are denigrating your Junior Developer's skills. ...
Ewan's user avatar
  • 74.6k
6 votes
Accepted

What is a proper way to structure a Python project consisting of smaller packages that have shared code?

You can absolutely use namespace packages to group your packages under a project namespace. This also provides a solution for your common package: make it a dependency of your main packages. You would ...
amon's user avatar
  • 134k
6 votes
Accepted

Is it a bad idea to model dependencies using a project's directory structure?

This approach is not as good as good as it might appear. Directory structures are not as flexible as programming languages expressivity. Let's look at some problems you have to think of in your ...
Christophe's user avatar
  • 76.6k
5 votes

How does one structure an assembly-language project?

A book could be written on this topic. I bet some have . . . It's hard to answer because each tool-chain has its own strengths, shortcomings and quirks. I must have structured different projects a ...
Mark's user avatar
  • 226
5 votes

Have the unit test "using" the project, or just have same namespace?

I've used unit tests project with the same namespace as the real project (by manually removing the Tests suffix on the test project namespace) for a few years with zero issues. I think it leads to ...
julealgon's user avatar
  • 287

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