DEV Community

Discussion on: What Are Your Strategies for Enhancing Code Reusability & Maintainability?

Collapse
 
valeriavg profile image
Valeria

Ooh, my favourite question!

The formula that worked best for me is keeping things that belong together close to each other. Each separate feature gets its own folder and has all related components inside: repositories, controllers, utilities, templates etc.

The only rule is to never import anything from siblings: if something needs to be reused it should be moved to the top.

This way, whenever I make changes I always know the exact scope of what those changes might affect. Helps tremendously with debugging!

And lastly, keeping things simple makes everything so much more pleasant to work with! So I avoid fancy abstractions unless they are truly necessary and prefer simple functions to classes.

Collapse
 
anshulnegitc profile image
Anshul Negi

Well written.
It would be great if you post any image of this architecture.

Collapse
 
valeriavg profile image
Valeria

Good point, I think I can make a whole article out of it! Will post here once it’s out too πŸ‘Œ

Thread Thread
 
anshulnegitc profile image
Anshul Negi

Sure waiting for it.

Thread Thread
 
valeriavg profile image
Valeria

Here it comes, hope you'll find it useful:
dev.to/valeriavg/plug-play-modular...