What are err, req and res?

Today, I was at another School of Code hackathon event, mentoring a team of three Developers as they planned and built an application within a day.

During the day, we looked at some example documentation that included variable names like err, req, and res.

I don't like short variable names like this.

I'd suggest calling them what they are - error, request and response.

This makes the code clearer and easier to read and understand, particularly if you aren't using types and need additional context.

Readability is important as people read more code than they write.

- Oliver

Was this interesting?

Sign up here and get more like this delivered straight to your inbox every day.

About me

Picture of Oliver

I'm an Acquia-certified Drupal Triple Expert with 17 years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.