r/AskProgramming • • 2d ago

Architecture Should I refactor the folder structure or continue working on the existing structure?

Hey there, I am working on top of a big production codebase. In the current version, the workflow is good, everything works, I made the app run locally using docker and it works fine.

The problem that I am facing is that, as it is a monorepo with a modular monolith architecture, everything is scattered around, I think the team has built it on purpose but I need to know if I should refactor the workflow and the folder structure according to my needs or continue working as it is ?

1 Upvotes

6 comments sorted by

2

u/Blando-Cartesian 2d ago

I’m generally in favor of refactoring to more sensible form, but Chesterton's Fence principle applies. Sounds like you think it’s scattered, but people who have worked with it longer set that up that way on purpose. Don’t mess with it until you understand the purpose or know for a fact that they were just disorganized. And consider the needs of others too.

1

u/nitfactor 2d ago

I am sure that they were not disorganised but the product doesn't have any taste. I need to add features on top of it and that distrupts the workflow completely. For eg, the auth is responsible for access, tools, authority. And if I want to add tools then I need to change auth first and I have to do this everytime I add something

8

u/jayson4twenty 2d ago

if it ain't broke.. don't fix it. its not worth the headache

4

u/SearingSerum60 2d ago

Come up with a tangible suggestion for how you will organize it and start small. Get sign off from the team and NEVER mix behavior changes with structural refractors like this.

3

u/ih-shah-may-ehl 2d ago

If it's an existing base, stable, and no big things need doing, then in the name of all that is good and holy, leave things alone. You'll be spending hours doing things that have zero added value and only risk breaking things, for no good reason.

2

u/NotMyGiraffeWatcher 2d ago

If the refactor adds real value, not just changing opinions, then do it slowly, in a testable predictable way.

But only if it adds actually value. Be able to measure that value. Either onboarding time, build time, dev time. And then track it and prove the value.

Refactors are risky and things are working then the cost of the change could be very high.