Live data from Hacker News

Maintaining code quality when nobody cares

mkdev.me

141–150 of 245 posts

Re: Maintaining code quality when nobody cares

#141

I've tried this approach in the past and and it has made me very bitter. Eventually I realized that the company I worked for enforced no accountability for bad code, so I would often open the solution later and found a pile of ugly hacks or other mess. Code reviews? Refactoring? "We don't have time and no one is going to pay for it". Eventually you come to a conclusion that if no one cares then why should you? If any…

It can be very frustrating, but ultimately it's a reflection on you.

Whether you're a coder, or a librarian, or a janitor, take pride in your work. Do the best job you can.

If everyone else's code looks like crap, that's on them. When new people come on, they'll see your work compared to the slackers, and start emulating you, not them.

Like anything in life: Do the right thing, even when you're surrounded by villains.

Re: Maintaining code quality when nobody cares

#142

> It turned out that the project I was invited to started as early as 2014. Do you think it means that it’s big and complicated? Then you’re right. And it’s also really old. Is it just me, or is less that four years not "really old"?

That seems pretty fresh to me, but I may just be jaded: I'm working with a mission-critical PHP project with portions -- including fossilized third-party libraries -- fossilized since 2009.

Re: Maintaining code quality when nobody cares

#143

Earlier quoted context omitted.

This is absolutely the situation I am in right now, and I desperately need all the guidance I can get. We’re talking thousands of lines of React components that rely regularly on manipulating global js variables, mixed with MVC 5 written in Razor delivering variables in script tags, mixed with outdated jQuery, that’s all just concat’d together with gulp and that hasn’t seen a refactor in years of changing hands with…

Personally I thrive in this kind of environment, it's a kind of comfortable chaos. MVC5 is positively modern compared to many of the products I've worked with which have included (within the last 5 years) VB6 winforms but mostly aspx webforms. Understand that previous developers might not know what a DOM is have likely written ad-hoc jquery snippets, included 3 different versions of jquery-ui until they happened acro…

> if someone is working on a new part of the product or is fixing a bug in legacy code be absolutely ruthless in what you'll let passed in code review. This may not do you any favours socially but a reputation for harsh code reviews isn't all bad.

In my experience this is the most important thing. I particularly focus on the "what the heck does this code even do" aspect - the person who is modifying the code needs to be able to explain exactly what the code does and why it is correct (don't accept "it compiles and the one unit test we have passes"). Forcing the team to understand the code will make it very difficult for them to continue adding bad code to the pile, as they won't be able to explain what they bad code does, or will realize the code is bad in the course of trying to explain it.

Re: Maintaining code quality when nobody cares

#144

Earlier quoted context omitted.

A clever quote saves us from having to think! (paraphrased from some original quote I can't remember)

Yes, but in this case someone else did the thinking for you and it is actually pretty accurate. If the only time you care about quality is when you are being checked, audited or supervised then it will not work. Quality needs to be infused all across the board and needs to be reinforced from the management downwards throughout the whole organization, not just in the quality control department. So Ford was definitely…

isn’t this like saying quality code is code that is correct without unit tests? They seem unrelated

Re: Maintaining code quality when nobody cares

#145

I've tried this approach in the past and and it has made me very bitter. Eventually I realized that the company I worked for enforced no accountability for bad code, so I would often open the solution later and found a pile of ugly hacks or other mess. Code reviews? Refactoring? "We don't have time and no one is going to pay for it". Eventually you come to a conclusion that if no one cares then why should you? If any…

It can be very frustrating, but ultimately it's a reflection on you. Whether you're a coder, or a librarian, or a janitor, take pride in your work. Do the best job you can. If everyone else's code looks like crap, that's on them. When new people come on, they'll see your work compared to the slackers, and start emulating you, not them. Like anything in life: Do the right thing, even when you're surrounded by villains…

Put another way:

"If it's just a stepping stone, then be fascinated by the shape of the stone"

-Ze Frank

Re: Maintaining code quality when nobody cares

#146

Code quality depends on you. If you are maintaining the system then for your own sanity, clean it where you can. If you are writing the system for someone else to maintain, clean it where you can, because you will probably be the poor sod who will have to maintain it later on. If you can't clean it now, write down everything you know about the system, all those little annoying assumptions that nobody else has documen…

You can try, but then your meticulously documented ticket about why it's a very bad idea to put SQL query fragments into "hidden" HTML form elements never gets prioritized into the sprint.

Meanwhile, the same outsourced developers are making even more things you haven't found yet for whatever managers have the most political clout this week.

Re: Maintaining code quality when nobody cares

#147

I've tried this approach in the past and and it has made me very bitter. Eventually I realized that the company I worked for enforced no accountability for bad code, so I would often open the solution later and found a pile of ugly hacks or other mess. Code reviews? Refactoring? "We don't have time and no one is going to pay for it". Eventually you come to a conclusion that if no one cares then why should you? If any…

Don't stress about code quality.

Quality code is it's own reward. Yes, clean code is more fun to write and work with. But, just think of it as a different kind of optimization problem. If the investment is not going to pay off in the future, then it's not worth doing in the first place.

PS: This is not giving up, it's about getting even better by becoming ever more flexible.

Re: Maintaining code quality when nobody cares

#148
post #123
post #80

Earlier quoted context omitted.

In general I agree with your points. But you seem to have some gripes with "senior" engineers. I think if you left that out your points would be better. In the end it comes down to management not understanding the work and rewarding unproductive behavior. This has nothing to do with "junior" or "senior."

While I haven't personally worked at such a company, I've observed some "toxic" workplaces and found that typically it is, in fact, the senior staff who are the biggest part of the problem. Only certain types of people achieve seniority in a toxic organization, and they are typically those who (deliberately or incidentally) benefit from the culture that everyone else hates. They build a clique and try to build influe…

I guess that makes sense. If the org is dysfunctional the best people at some point will have left leaving the not so good people.

But I think that change often has to come from management. Even if you are senior you often can't do much about stupid management other than leave.

Re: Maintaining code quality when nobody cares

#149

Earlier quoted context omitted.

Yes, but in this case someone else did the thinking for you and it is actually pretty accurate. If the only time you care about quality is when you are being checked, audited or supervised then it will not work. Quality needs to be infused all across the board and needs to be reinforced from the management downwards throughout the whole organization, not just in the quality control department. So Ford was definitely…

isn’t this like saying quality code is code that is correct without unit tests? They seem unrelated

Or more like, you write unit tests even if no one asked you to.
Post reply on HN