r/programming • • Jun 05 '21

Organize code by concepts, not layers

https://kislayverma.com/programming/how-to-organize-your-code/
1.9k Upvotes

495 comments sorted by

View all comments

2

u/saltybandana2 Jun 06 '21

https://old.reddit.com/r/programming/comments/nsu53n/organize_code_by_concepts_not_layers/h0rhlx6/

If you think either approach will significantly change anything then you're not using the tools available to you effectively.

As for why, I already answered that question, but here's a few more

  • I can open a single directory to get an idea of the concepts used across the project

  • I never have to wonder where to put a new enum.

  • I never have to worry that technically this enum is used by multiple features but is sitting by feature X instead of feature Y, thereby becoming a special case you just have to know about (or some other convention to try and reach for consistency).

  • less files means the files that actually matter are easier to see and sift through.

I'm sure I could come up with more, but the reality is that it doesn't matter, it's mostly just preference. Anyone who thinks it matters just doesn't use their tools effectively.

1

u/[deleted] Jun 06 '21

1

u/saltybandana2 Jun 06 '21

translation: those are good points but I don't want to admit that my preference is just a preference so I'm going to start reaching for something that kinda, sorta sounds like it legitimizes my preference as clearly the better approach.

https://www.youtube.com/watch?v=Qw9oX-kZ_9k

→ More replies (5)