DEV Community

Steven Mercatante
Steven Mercatante

Posted on • Updated on • Originally published at stevenmercatante.com

Code With Intent


This post was originally published at https://stevenmercatante.com


When people ask what makes someone a senior software engineer, they tend to get the same responses: ability to ask meaningful questions, mentoring others, putting aside one's ego, technical ability and so on. But, there's something else that is just as essential that is rarely mentioned: making the intent of your code clear.

This can be accomplished a few ways:

  • variables and functions have clear names that express their purpose
  • functions are small and have only one responsibility
  • code should be self documenting, but if that's not possible...
  • ... comments should be added that explain why the code is written this way, and how it works
  • functions and classes are organized so that new contributors can quickly find what they're looking for

It's easy to neglect some of the above when you're new to programming, or under tight deadlines. But making the effort is absolutely worth it. Your code will be easier to understand, easier to test, and easier to refactor. New contributers will thank you. Future-you will thank you, too. After all, there's nothing worse than coming back to a codebase you wrote 6 months ago and wondering what the hell is going on. So take the time now to make your intent clear - even if it only helps future-you, it'll be worth it.

👋 Enjoyed this post?

Join my newsletter and follow me on Twitter @mercatante for more content like this.

Top comments (0)