Slowly Stronger Together
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
Nobody knows for certain who this quote belongs to, all we know is that it's some of the best advice you'll ever encounter.
I cannot think of a place of work I’ve been a part of, a study group, or anything of ilk where the person coming into new work did not immediately blame their predecessor for various things.
Now, I’d like to take a moment and state that I’ve had the fortune (or misfortune) of working with a number of consultant agencies who wrote programs and code for companies that I went on to work for. So I mean it when I say, I understand. I have seen things done by others that can only be attributed to malice. As much as I try to give people the benefit of doubt, people can be monsters. That's why I want to talk to you about coding. The coding I do on a computer, sure, but also the coding that you do everyday in your life.
There are many reasons people write bad code (okay, okay: Technically "hard to maintain code"). As with all things in life, your style could get in the way, your ideas could be amazing but require precise execution, or you have other things get in the way that prevent you from writing a masterpiece.
All of which, by the way, are excuses you'll hear in school or the workplace on the daily...
"That's not how we do things."
"Here, let me do that--if you do it you'll mess it up."
"Sorry, I'm kind of busy."
So first, let’s say that I’m paranoid. I don't use social media because of it--much to the chagrin of our editor, Dan, who relies heavily on social media to promote our mission. Oops, sorry.
That said, in my paranoia I want to make sure that no one can ever steal my code. Let's imagine that I come up with a bright idea to ensure that never happens: I start coding in this ridiculous manner that, at a glance, can indicate it was written by me.
Problem solved? Nope.
While this may seem like a great idea to the paranoid person, that violent axe-wielding psychopath we chatted about earlier might not feel the same way. This bearded manic will be knocking at my door shortly after they inherit my code--which, by the way, sounds like the plot of an excellent horror film.
All this in the name of fashion. All this in the name of paranoia. All this in the name of me. Well, as many women who have worn high heels before will tell you, there is a time when fashion gets in the way.
Hence, it's important for coders to bring their digital dancing shoes.
On the other hand, what if you're a genius? No, really. We're talking certified DaVinci level creative mind. If people just listen to you, you say to yourself, you can set all of this right. You can fix their miserable little lives.
Sure, your idea might amazing, but your genius is only as good if it can be used by others. A lot of companies don't understand this. If your solution only works in the test cases and can’t be applied more broadly, then it's not worth much. The technical term in statistics for this is over-fitting. Don't over fit. People like broad solutions.
Don't we love duct tape because it can be used on so much more than ducts?
We all like to think of ourselves as individuals and not components of a greater whole, but everyone must work with someone else at some level.
Everyone is on a team in some capacity, even if it that team is as broad as all of humanity and it is on you as a good team member to integrate and work well with others. Don’t get me wrong, if you can improve your cog without causing any issues for others, then by all means, put the better piece in, even if it looks a bit weird.
Teamwork, simply put, makes the dream work.
Now take that attitude and apply it across your life. Seriously consider whether your behavior is making the world a better place for others or a worse one. Genuinely ask yourself if you're doing something simply to antagonize your spouse (who, by the way, might turn into a violent psychopath if you put you dishes in the sink one more time). Wise up. Bring back the golden rule.
If you inherit a project that is awful to work on, don’t just complain about how awful it is and then do nothing to fix it. If you’re going to work on it, leave it better than you found it.
No one likes to clean up after others, but everyone you ever work with will love you for doing so and they will go out of their way to work with you because of it. Not to mention that if you ever happen to pass them a piece of garbage, they’ll automatically assume that you did your best to clean it up.
And that's a nice thing to know.