Who Are You Coding For?
2019-10-20 18:36
The Lesson
Consider this brief, hypothetical exchange between two developers, maybe in a meeting where others are present.
Developer 1: "...so, I solved the problem this way. This causes e.Data to overwrite the previous line."
bool overwrite = e.Data.Contains(".....");
WriteLog(e.Data, overwrite);
Developer 2: "You know you could just include the condition in the WriteLog call. You don't need to go to the trouble of setting a variable."
WriteLog(e.Data, e.Data.Contains("....."));
Developer 1: "Sure. So, why did I?"
Developer 2: "Huh?"
Developer 1: "Why did I use a variable?"
Developer 2: "I don't know."
Developer 1: "Because I'm not coding for me today. I'm coding for other developers, and my future self. I want it to be as easy for them as possible to understand what this code is doing."
Why I wrote this
My grandfather was once desribed as a bridge-builder. Even if he were (metaphorically) crossing a river just once, he'd build a bridge for whoever came after him.
Think about this as you make coding, architectural, and documentation decisions. What you do will affect someone in the future. Are you focused on finishing now, as fast as possible? Or crafting your code so that someone thanks you later on.
Who are you coding for?