95 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)...
user avatar
46 votes

Should we call Web API from MVC application in same solution?

Great question! I'm always looking for a better way to structure my projects.. Each point you raise has merit and having explored a variety of solution structures I have to say that I agree the ...
user avatar
  • 561
39 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 ...
user avatar
  • 24.9k
33 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 ...
user avatar
30 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 ...
user avatar
  • 409
25 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 ...
user avatar
  • 11.8k
23 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 - ...
user avatar
21 votes

What's in the "contrib" folder?

Looking at popular open source projects which come in mind, I see no mention of any “contrib” folder: jQuery, Express, Sass, LESS, MongoDB, Redis, Puppet, Chef NUnit, Ruby on Rails, Laravel, Jenkins, ...
user avatar
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 ...
user avatar
  • 9,911
12 votes

Structuring Procedural vs OO code

A lot of procedural code is very OOP-like. Basically, instead of object.function(params), you do function(object, params). You can group your files accordingly. However, what a lot of long-time OOP ...
user avatar
12 votes

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

I vehemently opposed Vehemence makes others stop listening and, at the same time, it limits our perception of the problems, hence their solutions too. To my experience, we become vehement at ...
user avatar
  • 11.8k
11 votes

Delete unused source code from the repository or keep an archive folder?

Since the history is preserved in version control, there is absolutely no reason not to remove code you don't need. By the way, this applies as well to commented code within the source: don't comment ...
user avatar
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. ...
user avatar
  • 9,027
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 ...
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. ...
user avatar
  • 4,435
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 ...
user avatar
9 votes

What's the best way to organize our unit tests

The most common structure seems to be the src and test directory mirror. src/module/class test/module/class_test However, there is an alternative structure that I have seen which I now believe to be ...
user avatar
9 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, ...
user avatar
  • 68.6k
9 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 ...
user avatar
  • 125k
8 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 ...
user avatar
  • 81
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 ...
user avatar
  • 186k
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 ...
user avatar
  • 1,706
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 ...
user avatar
6 votes

Should we call Web API from MVC application in same solution?

Directly accessing your business objects directly (I assume you mean in your controller) will be quicker & easier. what if client wants to host API and web on different cloud server and apply ...
user avatar
  • 4,274
6 votes

Structuring Procedural vs OO code

To be honest, this seems a bit like going backward and programming with one hand behind your back, but if by "structured", you mean, like how people created programs before Object Orientation in ...
user avatar
6 votes

Project structure: where to put business logic

I think you got Fowler wrong, he is advocating 3, not 1 (see http://www.martinfowler.com/bliki/AnemicDomainModel.html). Note that he is not talking about "business logic inside entity classes", he is ...
user avatar
  • 186k
6 votes
Accepted

Delete unused source code from the repository or keep an archive folder?

The problem with deleting is that they are "out of sight" and therefore "out of mind". The problem with archiving is that links or relative references will no longer apply. Tricky... Personally I ...
user avatar
  • 48k
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 ...
user avatar
  • 12k
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 ...
user avatar
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 ...
user avatar
  • 4,000

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