LastExceed
✅ When should/shouldn't I split off code into a separate lib project?
I am cleaning up a massive legacy codebase at work. At the time my company acquired it, it consisted of 71 projects (spread across 6 solutions, which we have already merged into 1 for easier dependency management). 11 Of these are executables, the rest are libs. Some of these libs are definitely unnecessary (e.g. only containing 1 class that barely even warrants its own namespace), others are definitely necessary (e.g. needed by multiple executables). Likewise, there is a huge "common" project that is referenced everywhere because it contains all sorts of things, and dependants usually only need a small subset, so it seems reasonable to split it up to reduce coupling.
So far we have brought it down to 1 solution with 31 projects, but I'm reaching a point where I'm no longer confident in making these decisions solely by gut feeling, and I'd much prefer having some clear principles to follow, because I've come to realize that splitting based on what's-needed-where can be done with endless granularity, and I don't know where to draw the line.
1. What are some general rules of thumb to follow?
2. How does project splitting affect
* IDE performance
* compile time
* binary size
* runtime performance?
3. Is an executable depending on another executable (as opposed to extracting a shared lib project) even a fundamentally bad thing?
76 replies
how do transitive dependencies work?
here is a project dependency diagram generated in rider: https://i.imgur.com/yCfVEuX.png
why do only 3 other project projects have a transitive dependency on
Contenit.Interfaces
(direct dependency of LVS_Common
) even though all projects in the solution depend on LVS_Common
in some form?1 replies
✅ how can i let an interface implement a function of a super-interface, instead of shadowing it?
this doesnt compile, because
IOne.Foo
is considered a separate function that shadows ITwo.Foo
. how do i tell IOne
to provide a default implementation for ITwo.Foo
instead of shadowing it?24 replies