109
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)...
49
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 ...
34
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 ...
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 ...
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 ...
25
votes
How to extract code into library allowing changes without workflow overhead
I will be quite provocative on this one. If you have a lot of shared code between your many microservices, it may be possible that you have artificially broken down your system into too many ...
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 - ...
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'...
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. ...
11
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 ...
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 ...
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. ...
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 ...
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 ...
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 ...
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 ...
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 ...
8
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 (...
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
...
7
votes
How to extract code into library allowing changes without workflow overhead
Two other answers already say "avoid that situation". But that's not always a solution. Sometimes, for some reason, you cannot really avoid this if you want or need to stay DRY. So let me ...
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 ...
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 ...
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 ...
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. ...
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 ...
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 ...
6
votes
How to extract code into library allowing changes without workflow overhead
There is no better way to do it unfortunately. The minute you have a shared dependency that has business logic (or anything derived from the requirements) you created a synchronized rollout dependency ...
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 ...
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 ...
5
votes
If taking over code of a third party, what are the delivarables?
It's all about what you have in the contract. If the contract writes the delivery must include documentation, revision history then it must be delivered. Otherwise, you might not have legal grounds to ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
project-structure × 202architecture × 21
project-management × 19
python × 18
c++ × 17
design × 16
java × 15
c# × 15
design-patterns × 9
git × 9
visual-studio × 9
projects-and-solutions × 9
unit-testing × 8
naming × 8
directory-structure × 8
.net × 7
version-control × 7
libraries × 7
file-structure × 7
javascript × 6
php × 6
web-development × 6
testing × 6
c × 6
node.js × 6