by steffres · 3y ago · 0 comments
I think that submodules are better suited for separation of concerns and performance, even while achieving the same composite structure as an equivalent monorepo?
The reasons for those things being separate projects had a history (dating to a time before Git was popular, even) and can be explained, but ultimately it doesn't matter; by the time I was around, all of those reasons ceased to exist or were simply not important.
I will personally never, ever, ever, ever allow Git submodules in any project I manage unless they are both A) extremely low traffic, so updating them constantly doesn't suck, and B) a completely external dependency that is mostly outside of my control, that cannot be managed any other way.
Save yourself hair and time and at least use worktrees instead.
So, atomicity of changes can be guaranteed, but you need to write a few more commits. However this effort of small increases of commits is far outweighed by the modularity imo.
Not remotely, as the scale of the codebase increases, the benefit of modularity goes to zero and the benefit of atomic changes increases.
Also: it's not always feasible to break up a change into smaller commits. Sometimes atomic change is the only way to do it.
The advantage of this is, that work can be done by devs on the individual modules without much knowledge of the overarching architecture, nor strong code ties into it.
Right now our persistence is done with SQL, but we could swap it with anything else, e.g. mongo, and the parent codebase wouldn't notice a thing since the submodule only returns well defined python objects.
Of course, this comes at the cost of higher number of commits as you mentioned. But in my opinion these are still cheap because they only affect trivial quantity and not brain-demanding quality.