DEV Community

Discussion on: When using multiple JS classes which is a better way of writing code?

Collapse
 
dtinth profile image
Thai Pangsakulyanont

I cannot give concrete recommendations here, but I find myself using these signals: Scrolling and File Switching.

If you find yourself scrolling and switching between files less often, you are more likely moving in the right direction.

  • Excessive file switching may signify that things that are supposed to change together live on separate files. So, maybe they can be merged into the same file.
  • Excessive scrolling may signify that there are unrelated code getting in the way. Maybe you can rearrange them so related code become closer, or you may move unrelated code to its own file.
Collapse
 
athul7744 profile image
Athul Anil Kumar

This is fantastic advice. Easy to remember. Easy to implement.
Thank You.