DEV Community

Discussion on: Learning To Make Maintainable Code

Collapse
 
sazarubin profile image
Sergey Zarubin

Great post!

In my (short) experience I've noticed, that I can escape overcomplicating the code while keeping in maintainable and extendable with simple and objective rules:

  • not declaring functions or props that I think I maybe will need in future, because it will take equal amount of time to do it right now or later
  • keeping functions/classes short, less than one screen
  • keeping internals of functions/classes on one layer of abstraction (it's so obvious now, but it was not until I was told about it)
  • keeping an eye on number of responsibilities of function/class (it must be equal to one)

Also, Rich Hickey (author of Clojure) states, that simplicity is an objective metric, which is correlated with the number of interleavings in program. Great, but still opinionated, talk about it, and some other things: youtu.be/cSwPOpOKr3w