Live data from Hacker News

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

news.ycombinator.com

251–260 of 346 posts

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

#251
> but there're no tests to check whether my adjustments are correct.

Start here. Start writing tests. Lots of tests. This is part of what makes it engineering and not just craftsmanship.

Once you have enough code coverage (this will take a long time), start rewriting small parts of the system. You will have your tests to fall back on to verify you new design is correct. For each part of the old system, once you are confident, replace with your new code.

This all needs to be communicated up front as a long term goal. It's not about a rewrite. It's about the tests and having high quality software.

Something you need to understand, they may not want or need high quality software. Quality costs money. Sometimes good enough is all they can afford right now, even though we know the tech debt will accumulate interest. A part of your pitch is to communicate how important quality is to the long term viability of the software.

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

#252

Earlier quoted context omitted.

Just to offer a different opinion here: I think happiness at work is the most important thing for me personally, and I have no patience for legacy codebases that look like shit. I mean, you are offering good advice for a person that wants to fit in as his highest priority, no doubt about that. But there are people (like me) who don't enjoy working deep down in complicated shitty code to the degree that I don't even w…

I consider the ability to work with legacy codebases an essential skill. If you can’t do that, you’ll be changing jobs like other people change underwear. Any codebase that sees real usage will accumulate cruft, odd behavior and legacy code over time. Dealing with that and assessing what’s worth refactoring and what’s best cut or even just left as it is to reach a business goal is the skill that differentiates a seas…

Are you saying you don’t change underwear often? ;)

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

#253
post #242

Welcome to the real world. I had the same thoughts when I first joined. Learn to enjoy the feeling of thriving in a mess. Don't let yourself become fragile by it. Try to slowly turn that frustration into appreciation that you're growing as an engineer. Being an efficient, competent and likable worker even around ambiguity, spaghetti code, pressure and less-than-optimal communication will make you a rich and happy eng…

"Being an efficient, competent and likable worker even around ambiguity, spaghetti code, pressure and less-than-optimal communication" most underrated engineering skill IMO - if only there was an interview question that could tell me that about candidates

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

#254
post #201

I've been on both sides of this issue in the span of my career. I've joined companies with absolutely horrific code, and I've hired people who thought my code was shit. My advice is don't complain and don't attempt any significant rewrites for the first 6 months or so. Your job at first is simply to understand the code and demonstrate that you are able make improvements to it without breaking everything. Doing so wil…

>> My advice is don't complain and don't attempt any significant rewrites for the first 6 months or so. I would agree with this, you need to be careful. I've seen a friend start at a new company with a horrendous code base, bring up the issues and be let go because they hurt / offended the existing developers. SOme people are really precious about their shitty code and can't take criticism, esepcially in small compan…

> I would agree with this, you need to be careful. I've seen a friend start at a new company with a horrendous code base, bring up the issues and be let go because they hurt / offended the existing developers.

I'm not sure if I agree. As a programmer I feel my primary responsibility is towards the code, not the company, not my colleagues feelings, not the customer. There are other roles who speak for them (sales, product owner, managers, etc.), I speak for the code.

When you get into the office in the morning, you hang both your coat and your ego on the coat rack, you can pick them back up when you leave. If someone can improve the code by tossing away 3 years of my work, then by all means. Doesn't matter if the person who suggested it is a senior with 20 years experience or the fresh out of college guy/girl who started just last week. You judge the idea on it's own merits, not by who suggested it.

I really don't get the tendency of allistic people to involve emotions in parts of their life where it's not helpful at all.

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

#255

Earlier quoted context omitted.

I consider the ability to work with legacy codebases an essential skill. If you can’t do that, you’ll be changing jobs like other people change underwear. Any codebase that sees real usage will accumulate cruft, odd behavior and legacy code over time. Dealing with that and assessing what’s worth refactoring and what’s best cut or even just left as it is to reach a business goal is the skill that differentiates a seas…

Are you saying you don’t change underwear often? ;)

Not every few hours and I’ve seen people quit a job between starting late on the first day and an early lunch break. So literally faster than I usually change my underwear.

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

#256
post #201

Earlier quoted context omitted.

>> My advice is don't complain and don't attempt any significant rewrites for the first 6 months or so. I would agree with this, you need to be careful. I've seen a friend start at a new company with a horrendous code base, bring up the issues and be let go because they hurt / offended the existing developers. SOme people are really precious about their shitty code and can't take criticism, esepcially in small compan…

> I would agree with this, you need to be careful. I've seen a friend start at a new company with a horrendous code base, bring up the issues and be let go because they hurt / offended the existing developers. I'm not sure if I agree. As a programmer I feel my primary responsibility is towards the code, not the company, not my colleagues feelings, not the customer. There are other roles who speak for them (sales, pro…

> When you get into the office in the morning, you hang both your coat and your ego on the coat rack, you can pick them back up when you leave. If someone can improve the code by tossing away 3 years of my work, then by all means. Doesn't matter if the person who suggested it is a senior with 20 years experience or the fresh out of college guy/girl who started just last week. You judge the idea on it's own merits, not by who suggested it.

>I really don't get the tendency of allistic people to involve emotions in parts of their life where it's not helpful at all.

I complete agree

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

#257
post #201

Earlier quoted context omitted.

>> My advice is don't complain and don't attempt any significant rewrites for the first 6 months or so. I would agree with this, you need to be careful. I've seen a friend start at a new company with a horrendous code base, bring up the issues and be let go because they hurt / offended the existing developers. SOme people are really precious about their shitty code and can't take criticism, esepcially in small compan…

And some people are sick to their back teeth of listening to new devs come in and whine about poor code without understanding any of the context. Perhaps you do know better than everyone else, but you ought to make damn sure of it before you open your mouth

The first course of action if you find some ugly/bad code is to ask a dev with more history with the codebase why it's like that. In my experience 9 times out of 10 the answer is "we know, it's like that because of reason but we haven't had the time to fix it yet".

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

#258
post #210
post #201

Earlier quoted context omitted.

>> My advice is don't complain and don't attempt any significant rewrites for the first 6 months or so. I would agree with this, you need to be careful. I've seen a friend start at a new company with a horrendous code base, bring up the issues and be let go because they hurt / offended the existing developers. SOme people are really precious about their shitty code and can't take criticism, esepcially in small compan…

> SOme people are really precious about their shitty code and can't take criticism, esepcially in small companies. It's very easy to criticize, often not easy to understand the situation where the bad code was written. Maybe the hastily-written code was the thing that saved a company from bankruptcy and was written by dedicated engineers, and bringing your friend to fix it was the plan all along, and what they needed…

> It's very easy to criticize, often not easy to understand the situation where the bad code was written.

A lot of people seem to think that criticism of the code is the same as criticism of the person who wrote the code. They are not the same thing. Root knows I've written plenty of crappy code over the years for very valid reasons. You are not your code, saying the code sucks doesn't mean I think you suck.

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

#259
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…

> Is it typical to be able to look at a company's code before signing up?

I guess it is not typical, but at one company I interviewed for I had a day for implementing something (a small feature and some unittests) which allowed me to check their codebase. I liked what I saw and worked there for some months.

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

#260
> I started "repairing" the project but there're no tests to check whether my adjustments are correct.

I'm so frustrated and depressed by it.

If you were to apply TDD to this, you would begin by writing a test verifying existing code, then you will piece-by-piece rewrite it and use your tests to make sure you didn't break stuff.

Post reply on HN