BETTER PROGRAMMING

5 Habits I Keep Reminding Myself to Be a Better Developer

Be your best self, at least when it comes to code

1. Code for your future self

Some people say code as if others are trying to read and understand your code, and it’s a great piece of advice, however, because I’ve been there, when I’m writing code I like to think of my future self, maybe a year from now, coming back to this new function and having to work on it. Let me explain what I mean by this, a few years back I had the pleasure of working on a complicated piece of software which required me to code a library to handle the rendering of very complicated and dynamic structures. Without any doubt, I embrace myself into the task, and thousands of lines of code later it was a marvel. The library ended up being at the core of the application, it was heavily everywhere throughout the application, and boy I was happy with it. However it was time for me to move on to a new team, and delegate the app to another team.

2. Let your commits tell the story

There are 3 types of developers in this world when it comes to commit messages and we will explore them all:

  • Messages are just personal and no one should read them
  • No PR goes through until you fix that message

Too lazy to explain what I did

Let’s start with the first type. Most of us I believe fall into this category, for different reasons we commit in a rush, or we are simply annoyed by it, so when we are prompt to enter the message we do the typical “WIP”, “Changed something”, “asdf”, etc.

Messages are just personal and no one should read them

Another type is not really lazy, he/she just doesn’t care, and why would they? “Commit messages are for me and no one should read them…” I’ve heard that many times, and if that’s the case and that’s what the team is going for that’s fine, just do me a favor, squash your commits when you merge, and put a decent message then. If your personal commit history is not relevant, erase it from this planet as soon as your code is merged.

No PR goes through until you fix that message

And, there’s the other extreme, and I’ve been there myself as well. When you jump from being too lazy, to realize how important commit messages are, you tend to overdo it, though I personally think is better, don’t get too sentimental if someone doesn’t follow everything exactly as you wanted. As long as the messages are clear enough it should be fine.

3. Go the extra mile, but no more

There’s the phrase, “Aim for the moon, if you miss, you may hit a star.”, and some people do that to projects. We get the requirements to build a form to sign up to our newsletter (we just need email input and a submit button), but in our heads, we follow a process which goes something like this:

  1. We need a function to validate the email
  2. But maybe they ask us to add a name later, so let’s generalize the validations with RegEx
  3. Maybe RegEx is not enough, let’s build a full validation library
  4. ….

4. Document & test your code

I’m sorry to be the one telling you this, but documenting your code is important, maybe boring, but very important. I’m not saying you should write a whole document of everything you plan to change in advance, but do the small things, use proper variable names, comment your code, write down the basic steps to install and run your code, etc. Also, make sure you test your code, start a culture for at least maintaining test coverage. If you add code, make sure it’s tested. Testing could be a full section here, but for many is as annoying as documenting so I’ve decided to merge them together.

5. Never stop learning

In our environment the only constant is change, and thus we should change to keep up. To change we need to keep learning new things, new frameworks, methodologies, algorithms, techniques, etc.

Conclusions

On your day to day remember the things that make you a better developer. You can use my list or make your own, whichever it is, practice your list every day, and grow your development skills. Introduce these practices to your team, agree on what’s the best for your needs, and just do it!

  1. Let your commits tell the story
  2. Go the extra mile, but no more
  3. Document & test your code
  4. Never stop learning

I’m an entrepreneur, developer, author, speaker, and doer of things. I write about JavaScript, Python, AI, and programming in general.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store