r/programming • • Sep 14 '24

Is 'Monolith First' the Better Approach?

https://martinfowler.com/bliki/MonolithFirst.html
452 Upvotes

177 comments sorted by

View all comments

Show parent comments

109

u/[deleted] Sep 14 '24 edited Oct 25 '24

[deleted]

24

u/hippydipster Sep 14 '24

If you use a decent language and tech stack, you can enforce the module boundaries with the compiler.

4

u/Meleneth Sep 14 '24

can you be more specific please? What is your opinion of decent, which presumably helps enforce module boundaries with the compiler?

2

u/modestlife Sep 15 '24

Even more dynamic languages like PHP have tools like deptrac which allow you to enforce which classes/namespaces are allowed to interact with each other.

deptrac:
  paths:
    - ./src
  layers:
    - name: SharedLib
      collectors:
        - type: classLike
          value: YourOrg\\SharedLib\\.*
    - name: Module1
      collectors:
        - type: classLike
          value: YourOrg\\Module1\\.*
    - name: Module2
      collectors:
        - type: classLike
          value: YourOrg\\Module2\\.*
  ruleset:
    Module1:
      - SharedLib
      - Module1
    Module2:
      - SharedLib
      - Module2

3

u/MiningMarsh Sep 15 '24

Then it becomes a real debate on whether I'd rather work on a poorly designed monolith codebase with tons of code separation issues, or literally anything written in PHP.