Live data from Hacker News

Ask HN: Codebase at my work is a complete mess, what should I do?

news.ycombinator.com

11–20 of 346 posts

Re: Ask HN: Codebase at my work is a complete mess, what should I do?

#11
Before going to management to talk about someone, I would talk with that person. Maybe he/she hates the code as much as you do. Sometimes, shitty code just happens. Avoiding it is part of the job, but not always a possibility.

And if you have the option to rewrite it and you think you can do a good job, go for it and good luck!

Re: Ask HN: Codebase at my work is a complete mess, what should I do?

#13
One thing you can try doing is to rework sections of the codebase gradually over time as you change them. Don't touch code that is working and doesn't need to be updated, but if you are working on a feature in one corner of the codebase, see what you can do to improve that part of the codebase.

This is easier to deal with both in terms of selling it to management and making sure you don't actually break the whole system compared to a full scale rewrite. I've made that mistake before and it wasn't fun. As others have said, code that's in production and works and is making money has value. The "cleanness of the code" is not something business owners care about, unless it causes problems.

Re: Ask HN: Codebase at my work is a complete mess, what should I do?

#14
There's a book called "Working Effectively with Legacy Code" by Michael C. Feathers which I heartily recommend.

I got it a while back when working on a similar sounding codebase and it was very useful. It's got chapter headings like "My Application Has No Structure" and "I'm Changing the Same Code All Over the Place".

If your company has a books budget get them to buy it, but I'd personally drop the £35 it costs on amazon given how useful this has been to me over the years.

Re: Ask HN: Codebase at my work is a complete mess, what should I do?

#15
This sounds normal.

Back in the 90's and early 2000's, almost nothing had automated tests. Miraculously, things still got done by manually testing.

On the other hand, I worked at shops where every getter and setter had a test. Not much got done there.

Re: Ask HN: Codebase at my work is a complete mess, what should I do?

#16
post #3

Are you working at my company? Ok, more seriously: that’s the way existing code is about 90% of the time - it’s the reality of working in our field. It may or may not reflect on the original developer. Maybe they were learning a new framework. Maybe they were rushed. Maybe it was originally intended as a prototype but ended up in production. Maybe the requirements have grown or changed significantly since it was impl…

If you’re going to take this to management, I would not bad-mouth the original developer.

This. If there are deficiencies in the code base, focus on those, their effects, and the gains from fixing them. Blaming people is rarely a good idea, for many reasons.

If the original dev worked on the code base for a long time, they're probably already aware of them. God knows I'm all too aware of the deficiencies in code I wrote years ago, but that's frequently how things look after years of updates and feature creep. Everyone on our team has code like that, and when new guys come in and point them out, we just sigh and say "yeah it would be great to rewrite that knowing what we know today". But budgeting time for that is not easy.

Edit: Also, like others said, I think you need to adjust your expectations. Working with code like that is life, and you should appreciate the fact that you, with your outside perspective and youthful energy can make a change for the better. But it's going to involve lots of refactoring and test writing.

The "Legacy Code" book referenced in another post is a great overview of this. I'd say of all programming books I've read, it's one of the ones that are most relevant to my day to day work.

Re: Ask HN: Codebase at my work is a complete mess, what should I do?

#17

There's a book called "Working Effectively with Legacy Code" by Michael C. Feathers which I heartily recommend. I got it a while back when working on a similar sounding codebase and it was very useful. It's got chapter headings like "My Application Has No Structure" and "I'm Changing the Same Code All Over the Place". If your company has a books budget get them to buy it, but I'd personally drop the £35 it costs on a…

Yes, so good. Martin Fowler's Refactoring is an excellent companion to Feathers' book.

Re: Ask HN: Codebase at my work is a complete mess, what should I do?

#18
post #5

Yah i went to a big name host and found the same thing. I was fooled into joining because I met with a data scientist and an "experienced web developer" without actually looking at their code. Long story short, 2 years later it was the most frustrating experience ever and I left, hating the code the entire time. I was paid a lot and the people were cool so that made me hang around but the culture promoted hanging on…

> I was fooled into joining because I met with a data scientist and an "experienced web developer" without actually looking at their code.

Is it typical to be able to look at a company's code before signing up? After having a similar experience, I wish I could make that a standard part of my interviewing process. (Brief backstory: I would never in 1000 years have taken my first development job if I had seen the code first, but HR and the carefully selected engineers who could tell positive stories gave me a false impression of what was going on.)

Post reply on HN