3 ms·
When you split your libraries into separate projects, you have to start versioning them. And every update to the code requires other teams to then update their
by the_duke 10y ago
When you split your libraries into separate projects, you have to start versioning them.
And every update to the code requires other teams to then update their library/app to use the new version, and apps depending on that dependency... you get my drift.
You end up with a complicated dependency headache which hurts productivity.
With a monorepo, you can statically identify all places where your library is used and update those automatically with tooling, or manually. You can also monitor where and how a piece of code is used across the company, etc.
If you then ensure that only commits get accepted that pass the relevant tests, you end up with a sane and working HEAD that's always up to date.
Of course there are lot's of drawbacks as well.
But Google and FB seem to have concluded that this is the better approach for them.
- groovy2shoes 10y ago> When you split your libraries into separate projects, you have to start versioning them. Or you can have your tooling use the convenient built-in versioning provided by the VCS. It's not called a "version control system" for nothing. > And every update to the code requires other teams to then update their library/app to use the new version, and apps depending on that dependency... you get my drift. This happens regardless of whether the codebase is organized as a monorepo or not. I've been subjected to monorepos at my previous and current employers, and we run into difficulties with this all the time. At least once a quarter, I get an e-mail from someone telling me that they updated such-and-such, and now the build fails in one of my projects. So I have to sit there and figure out wth they changed, why it's causing my code to fail the build, and how to fix it. Only once was the problem actually in my code (my Makefile, actually, which failed to bind some variable that was expected by the build system but wasn't documented anywhere, and of course the build system spits out a worthless error message, but I digress). > You end up with a complicated dependency headache which hurts productivity. Again, monorepos aren't immune from this, nor do polyrepos inherently suffer from it. > With a monorepo, you can statically identify all places where your library is used and update those automatically with tooling, or manually. You can also monitor where and how a piece of code is used across the company, etc. There is literally nothing preventing this from being doable with a polyrepo. In the case of updates, you may need to have the updated repos checked out, but it's not like you can only ever have one repo checked out at a time. > If you then ensure that only commits get accepted that pass the relevant tests, you end up with a sane and working HEAD that's always up to date. I've never worked anywhere on any project that disallowed commits that didn't pass the tests. It's typically been up to the committer to ensure that what they commit is acceptable. Furthermore, while my employers thus far have all been customers of AccuRev or Perforce (whose only real feature beyond what Subversion offers is that they cost lots of money), and have not personally had the pleasure of working with a DVCS at my day job, this workflow of "allow only test-passing commits" is wholly contrary to the "many small commits in quick succession" workflow afforded by DVCSs, which I contend is one of the biggest productivity boosts afforded by DVCSs (along with cheap branches and network unnecessity) and one of their main draws. And even so, it's still rather easy to maintain a sane and working HEAD with a DVCS (thanks to the cheap branches if nothing else). If you find that you can't do anything you've listed here without a monorepo, that's a tooling issue rather than an organizational one. Frankly, I've never seen a large monorepo I felt was justified. Every single one was just baggage held over from a time long past when a single repo still made sense for the codebase.
- agentgt 10y ago> You end up with a complicated dependency headache which hurts productivity. >With a monorepo, you can statically identify all places where your library is used and update those automatically with tooling, or manually. You can also monitor where and how a piece of code is used across the company, etc. Aka you have to figure out dependencies regardless of monorepo or not. Aka you need dependency management. Of course you could make the argument everyone has to use the latest greatest but you now have the possibility of changing one dependency and requiring an entire redeploy of the whole company.... I have seen what people do in these cases during desperate times... they copy the code and put it in their own project which sort of defeats the purpose and worse it is now not tracked (well I suppose if they have a good enough SCM comment it sort of is). > If you then ensure that only commits get accepted that pass the relevant tests, you end up with a sane and working HEAD that's always up to date. It depends on workflow. For some HEAD is what is actually deployed. If that is the case it is fairly difficult to achieve that goal with a giant monorepository if you have tons of teams doing microservices and deploying often.