r/ProgrammerHumor • • 27d ago

Meme theJoysOfMonorepo

Post image
3.9k Upvotes

106 comments sorted by

View all comments

6

u/za72 27d ago

so why use monorepo??

28

u/ACoderGirl 27d ago

OP's complaint isn't a mono repo one. You only get merged conflicts if people changed the exact same files as you. That will happen regardless of repo type. All you can do is avoid having multiple devs working in the same area at the same time.

I work in a mono repo and it's amazing. Alternatives like git subrepos suck and are confusing. While you do have more instability because of changes in dependencies, it also means you're catching those issues earlier, which is easiest. It's easier to prevent those incompatibilities in a mono repo due to the ease of running tests at the current main version. Also easier to fix other team's issues and extend tooling and such because you don't need to figure out their repo and as much of their workflow, etc.

5

u/ElCthuluIncognito 26d ago

For me it’s having everything in a review in one place. So much better, and contrary to OPs experience, has made getting a review markedly easier. I just have to chase one person instead of putting together a strike team every time. Though that may be more because it came together with dissolving hard lines between projects on our small team (Conways law in full effect)

2

u/minequack 24d ago

And you understated it. You only get merge conflicts if people changed the exact same lines as you.

0

u/BigBoetje 23d ago

You get conflicts for changes in the same file but most tools can handle changes for different lines without issue.

1

u/minequack 23d ago

No, same lines. 

  Merge conflicts often happen when people make different changes to the same line of the same file, or when one person edits a file and another person deletes the same file.

12

u/[deleted] 27d ago edited 27d ago

[removed] — view removed comment

8

u/Reashu 27d ago

As someone who will happily rant about the superiority of the tab, I still have to admit that repository structure matters a good deal more. Sure, you can do anything if you invest in tooling, but you can do it ten times faster if you just choose the model that fits existing tools.

2

u/[deleted] 27d ago

[removed] — view removed comment

5

u/Reashu 27d ago

Some problems I've seen (on both sides...):

  • The aforementioned merge queues vs syncing changes between repos
  • Access control woes
  • Having to do a sparse/shallow checkout due to size vs having to checkout three repos to work on one service
  • Seeing PRs, alerts, etc. you can't do anything about vs having to check for them in multiple places
  • People thinking that backwards compatibility doesn't matter for a service if you update the client in the same PR (users won't get the new client immediately...)

1

u/[deleted] 27d ago

[removed] — view removed comment

1

u/Reashu 27d ago

Just because you can doesn't mean you should. As I said, tools exist that support particular models of work already, e.g. most GitHub features are organized around repositories. There are probably ten or so companies in the world that can justify building their own source control platform, but the rest should design their work around one of the existing ones.

1

u/za72 27d ago

oh kinda like inheriting a terrible code base and doing a rewrite?

1

u/ThoseThingsAreWeird 27d ago

I'm sure however theyve set it up they could keep the monorepo and quash the persistent merge conflict problem somehow.

Yeah this is the confusing thing to me

Being a monorepo doesn't inherently mean PRs will have persistent conflicts. It just sounds like a bad setup of some sort, or projects not getting properly scoped

Like right now another team is working on an area of the codebase that my team also wants to be updating for a project. So we shuffled projects around and they're going first, sticking us on all the PRs. We've taken a different project on instead, and we'll touch the shared code in the new year 🤷‍♂️

0

u/love_weird_questions 27d ago

monorepo done well doesn't expose this kind of problems, you'd have them as well in a polyrepo setup on the specific app/component affected by the conflict

0

u/[deleted] 27d ago

[removed] — view removed comment

1

u/love_weird_questions 27d ago

yes sorry it was meant to reinforce your point

4

u/RavingGigaChad 27d ago

Because companies love it especially in the AI age. Easy for Claude to write code for every context or domain if it can access everything at once.

3

u/Test_NPC 26d ago

Multi repo structures have the exact same problem; instead it's distributed between 10 repos & prs AND you're almost guaranteed to hit conflicts on the files specifying out the versions between repos (since literally everyone is forced to touch those files).

Multi repos are effectively just monorepos but with 10x the work handling merges and versioning between them.

1

u/za72 26d ago

sounds like picking the right tool for the job

1

u/El_RoviSoft 27d ago

You either should use custom monorepo (like Yandex and their SVN fork) or shouldn’t at all. Yandex’s arc have sticky ship for cases like this.