How to make your code more readable using helper functions?

On one of our current projects we began to notice that there are certain sections of the code base that are just plain ugly and hard to read. Some of it we wrote ourselves but it’s been too long for us to recall how it works without diving into it line for line. Here are a couple ways to make your code easier to read and more easily maintainable.

Why do we care about making our code more readable?

  1. Another developer can understand your code faster;
  2. Leverages the existing code base – If your code is well-organized and easy to read, you or another developer can reuse functions or statements without having to reinvent code (aka DRY).
Top