
Ask HN: How to improve code quality at a new job? - arnath
I recently was hired to a new position as a senior developer (probably in the upper 1&#x2F;3 of seniority) and found that their code quality is kind of abysmal. The code base is pretty sizable and has a bunch of issues: one giant project with all the code in it, very few unit tests, 15 levels of interfaces for single objects, stuff like that. I want to bring it up to my boss and try to push the team toward better practices but I&#x27;m not sure what the right way to do this is. I&#x27;m not sure whether it&#x27;s from a lack of knowledge on the part of the team or an old cold base that they just keep iterating on. It&#x27;s not really feasible to suggest they stop doing new work in order to fix all these problems. Does anybody have experience in a situation like this? What&#x27;s the right way to push overall code quality in the right direction?
======
tikkabhuna
We've had this problem with an old codebase. Some things that happened at my
company. Note that this was driven by my boss, who is excellent, and not
myself.

* Started collecting metrics on code quality. Sonar was setup to do analysis every day. We could see lines of code + test coverage. Its harder to argue against facts. * Introduced better guidance on what is required for a change (detailed tickets, unit tests) and started enforcing code reviews. This can help reduce the "damage" being caused. * Started educating management/business sponsors on why code quality is important. Explaining that poor code can/will make business changes more difficult, they were happy for us to dedicate more time on improving. Used the metrics as evidence. * Hired people who shared his vision. Soon after he joined, he hired others who were dedicated to writing high quality code and keen to refactor the codebase. * Identified and prioritised the biggest issues. Estimating developer time cost vs business/development value. These required sign off from business sponsors/management.

We still have problems trying to get everyone onboard. Often it can be easy to
get everyone to verbally agree to address an issue, but walking the walk is
never as easy as talking the talk!

Its been 2/3 years and looking forward there's still a whole mountain to
tackle, it seems like we've barely scratched the surface. Looking back, you
can see how bad it was and it has actually improved significantly.

Good luck!

------
gus_massa
Take a look at this old article by Joe: " _Getting Things Done When You 're
Only a Grunt_" [https://www.joelonsoftware.com/2001/12/25/getting-things-
don...](https://www.joelonsoftware.com/2001/12/25/getting-things-done-when-
youre-only-a-grunt/)

