Dear fellow Stack Yacker,

You can say that coding is a means to an end. We write code to produce software to achieve business goals and solve problems for end users - users who could care less whether it’s Java or JavaScript, React or jQuery under the hood.

Do we even need to care that much about how we write our code then? As long as it does what it needs to do, we did our job right?

TLDR; Yes and for two reasons:

Business objectives, users wants, needs and demands change over time. To accommodate, our software should be easily malleable, or simple enough to make changes to in a timely manner. Sure, many users don’t care how the car runs, but they sure don’t want to wait 3 weeks to get their tire changed.

Now let’s think about who is responsible for making those changes - developers! Not all changes to a code base are going to be easy, but the code and the architecture of the codebase itself should not get in the way. Writing unmaintainable code will lead to those 3 week wait times for even the simplest of tasks.

How can we help ensure we are writing code we’ll be proud of at the end of the day?

🤯 Avoid over-engineering

Keep it simple. As Albert Einstein said, “If you can’t explain it, you don’t understand it well enough”. This goes back to the point that the end-user does not care how clever the code is under the hood. They just want software that is useful. Writing simple, elegant, and expressive code is one way to assure your output will be useful to others.

🤔 Code with your colleagues in mind (or your future self)

Although I don’t always hit the mark here myself, every time I write code I think about how easy it will be for my developer colleagues to understand what the hell is going on. This ties back to avoiding over-engineering and writing clean and expressive code. This mindset also helps you improve over time. Put in the work to write easily-readable code, leads to better PR reviews, which leads to better and constructive critique, which leads to you being a better software engineer.

🤮 Understand what bad code looks like

Quick and funny story here. A few weeks back, a team member and I were looking for some sort of code example on CodePen. We got to one sample and at the exact same time in the same way blurted out “yuck!” Maybe you had to be there, but the point I’m trying to make is that we both were able to point at what we were looking at and think this is not good. The code layout was awful, everything was jumbled, variable names that were not descriptive, etc. We had no idea what this code was doing, and even if it worked and would be a great solution, we didn’t want to take the time to even read through it.

🤩 Have a desire to be proud of your work

This may seem like an obvious one, but I think it’s the most important. To write your best code, you have to want to be proud of what you’re putting out. Even if you are a seasoned developer, the moment you stop caring, your code quality will fail.

A few questions for you:

How much do you care about the code you write? How is this demonstrated in your work? What are areas do you think you could improve on as a developer?

Thanks for reading. 🙏

Christian

Subscribe at stackyack.substack.com