Code culture problem

"This is shit" my coworker exclaims as we browse some code looking for a particularly unpleasant bug. "Hmm" I reply.

Such accusations, and likewise similar sentiments, are being heard around offices with increasing frequency. And the saddest part is, the code is usually not particularly shit. What does that even mean? Could it have been done better? Of course! Most code could be better, and given infinite time and resources would have been. Sure there is some bad code around, we've all seen it, hell we've all written it, but that isn't even the issue here.

The issue is one of having a "this is shit" culture.

It is a culture that I am seeing become more and more common in the web community. Continuing the example above, when I asked my coworker to explain himself, explain why is the code shit, I couldn't get a straight answer.

"It just is, look at it" he replied puffing himself up further and further, his brow furrowing as if I must be half-witted for not being able to comprehend the amount of shit that is the code. And you know what? I start to feel half-witted. I can barely stop myself from scoffing along with him and extrapolating on just how smelly and brown this code we are looking at really is.

Before I go on, I realize this story doesn't paint my coworker in the best light. So let us fix that. He's a great guy. Honestly one of the nicest people I have ever met. He is friendly, has a family he loves to talk about, runs marathons, helpful, smart, etc etc.. Another thing about him: he is a relatively new developer. He is still learning the basics, and this is nothing to be ashamed of, we have all been there at one point. I happen to find myself there on a weekly basis and I've been doing this for some time now. So why would the first instinct of a nice, smart guy who is working on his first large web project be to accuse some code of actually being shit in disguise before even trying to understand it?

Rule of life: the shit flows downward.

This problem is not isolated to just newer developers. Many experienced people act the same way. You can be an amazing, seasoned developer and still have a negative affect on your team and project by behaving in such a manner. Even more so because the newer members look to you as a source of knowledge and experience. And the more people who embrace the "this is shit" culture, the easier it becomes acceptable and even desired. Soon developers are revered not for contributing to the project, but for putting down other's contributions to the project. The most vocal and negative developer soon becomes the most respected developer. Everyone suffers, the project suffers, and a few people get to pat themselves on the back and feel great about themselves for being so full of shit.

So why do we do it?

No one wants to feel stupid, and no one wants to feel inferior or bad at their job. Once a "this is shit" culture starts to spread one of the only ways to make sure that you are on top is to put down others. In the end it is a culture that values negativity rather than focus on solutions.

So what is the solution to this particular problem? Stop it. Don't blurt out negative assessments of others code for no reason, and with no understanding. There are ways to bring up issues with the code base that are not mean spirited. If there is some smelly code out there, look for ways to make it better. Start by understanding the code, and then find ways to improve upon it. If you start to notice a negativity trend in your own projects, don't adhere. If someone says to you "this code is shit" ask them why, and then go through and work on making it better. Talk to the person who wrote the code originally, perhaps there is a reason why they did it that way. Work with your teammates not against them.

Next time I notice a suspicious smell wafting from my monitor, I'm going to turn to my coworker and ask, "How can we improve this?" Because, lets face it, sometimes code is shit, but that doesn't mean we have to be too.