Writing Code That Future-You Will Thank Present-You For

D
Dick Edidiong Bassey
·

The most common excuse for unreadable code is time pressure. The code works. There is a deadline.

This fails the arithmetic: the time to write readable code is minutes. The time to debug unreadable code that breaks three months later is hours.

The practices: name variables and functions for what they represent, not how they work. Write short functions that do one thing. If you need a comment to explain what a block does, refactor the code until the names explain it.

Write code for the next engineer. The next engineer is usually future-you.

— Dick Bassey | DevDick | 2024