Notes from John Papa's Readable code

  • Start with a style guide, not with how but with you. So, the developers are convinced to follow that.
  • Meaningful names for functions
5 Second rule
  • If you make your code readable in 5 seconds, then its easily maintainable.
  • Make the intentions clear.
  • Organize for readability. Properties followed by methods
  • Smaller functions

Less then 20 lines of code

Choose a convention
function getCustomers()
function fetchAdmins()
function pullOwners()

to

 function getCustomers()
 function getAdmins()
 function getOwners()
  • Consistent naming and spellings matter

Provide Clarity through code not comments

Less comments - Comments can mislead - Code might change underlying comment might not

Use Prettier

Write dirty code and clean it up - Iterate