Pregunta

I entered yesterday to my new job and while browsing their repositories, I noticed they have a project for every resource of a REST API. For example, if they need to add a REST resource called "people", they proceed to create a whole new repository that contains only the endpoints of the resource "people".

Honestly I've never seen something like this before and I can only see downsides of this design, for example for every piece of reusable code, they just copy and paste it multiple times across the projects that are part of the REST API and sometimes they make a library and share it across the repositories. Even with the library approach I think this will be a mess to deal with. Am I wrong? Does this design provides any advantages?

Currently there is only one maintainer and he is on vacations so I need to wait for the next week to ask him about this decision.

¿Fue útil?

Solución

Generally more projects == good. But only because the standard 'bad' approach is a single massive project with everything in.

Separation enables the compiler to enforce dependency boundaries and forces you to think.

So in your example, by putting each resource in its own project you stop those projects depending on each other. Isolating their sections of code into libraries, enabling you to test them separately and helping with your change control.

However, there is a bit of a change with .net standard, in that the compiler will try to make each project a nuget package. If you want to distribute multiple projects as a library in a single package you will have to do some fiddling around.

This again forces you to think about your dependencies and how you are going to seperate them. Will calling code always use this set of classes together or will some code only need set x and some only set y?

The next step after separating things into project is to separate them into their own source control and use binary references. You know for sure that you haven't broken something when you are using the exact same same dll as before

Licenciado bajo: CC-BY-SA con atribución
scroll top