Live data from Hacker News

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

news.ycombinator.com

101–110 of 346 posts

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

#102
medium level = 2 yrs experience? with degree?

i have news for you, it’s like this at all companies.

you can’t fix it. it grew that way from the people there. you need to outnumber them 2:1 to make headway.

grin and bear it. fix what you can along the way. trust me, the next guy will consider your code garbage. no matter how good it is!

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

#104
Start writing tests, change no production code. You need to understand how it works (by reverse engineering its behavior with tests you’ll learn this) and you need to verify your changes don’t accidentally change existing behavior unless the existing behavior is verifiably wrong, and hey, you may find instances of this too, but don’t start making changes until you have a suite of tests that can spot behavior changes. There are times when things that appear to be bugs are actually weird features that the business needs to function. Sometimes cruft is actually a bug fix.

Start with high level integration tests of the most critical business processes. Then, work your way down to frequently used functions/classes/modules. After the whole thing is covered you can start cleaning/repairing, and I’d suggest doing so incrementally/as you’re adding new other features (make sure all new features come with tests).

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

#105
post #79

So you're the new guy that's been assigned to this project...possibly at the request of the current developer who desperately needs help...possibly because it's the project that existing staff don't want to work on...possibly to learn the project so the current developer can be moved to other projects. Every software company has these projects and many developers have been in your position. As long as the software is…

Rewrites are riskier when requirements need to be reverse engineered from the current solution, or if requirements are complex. When requirements are simple, rewriting should be simple.

This should at least give you the opportunity to contain technical debt to the most complex requirements.

To say "everything is complex therefore we cannot rewrite anything" is pretty implausible and mediocre.

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

#106
post #80

Is it buggy? Is it insecure? Is it slow? If the answers to those questions are no. Then you the problem and you should look for employment elsewhere. You are unhappy in that job, and you rewriting the codebase would potentially make the above questions answer to a YES, inflicting damages in the company. Now, if the above questions have yes as an answer. Talk to your manager, explain how it won't scale, how it is hack…

A software project can be fast, reliable, and secure while also being extremely poorly engineered and extremely difficult to maintain and extend.

Not a large one.

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

#107
post #100
post #95

Earlier quoted context omitted.

> The fact a new resource (you) has ... I am not familiar with this lingo. Why exactly is the OP a resource? Is this usage of "resource" common in business speak?

Unfortunately, yes. We are just replaceable cogs.

I'm okay with this. They are paying me because the work isn't something that I'd do in my free time. I'm okay knowing that others can do my job as well as I can.

Its not art, it's a job. (to me)

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

#108
There's a lot of good advice here, but I'll add one thing. Learn the codebase really really well. Figure out where the seriously bad problems are. Figure out why the codebase is this bad, ideally from the original developers (not in an accusatory fashion, try to frame it as learning from them). Figure out the context of the bad code, otherwise you might end up repeating it. Write up notes and sketches and plans of the bad code.

Then, isolate a section that is practically reeking. Maybe it's even so bad that it's leaked into the user experience. It has to be a super small part of the codebase though. Plan out the refactor, making sure to make it backwards compatible (that means no regressions, no changes to internal interfaces, etc.). Start the refactor, then when you reach about the 70% mark (which will be more like the 30% mark considering regressions and stuff), try to pitch the refactor. But don't pitch it as a refactor. Figure out any problem that the user or manager is having, whether it's slowness, crashing, etc. and then slide in your refactor as the solution. Like hiding spinach in brownies. If there aren't any problems, well, then maybe the codebase isn't that bad.

And remember, 50% good code and 100% done is better than 100% good code and 50% finished when it comes to refactors.

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

#110
Been through this in one of the largest car dealer companies in the world. Get them to buy third party components and slowly replace existing ones. Implement new features inside new, bugless, tested environments. Try moving sql to procedures and table functions. Add missing features like udp syslog logging, CI/CD, etc. That will increase developer happiness.
Post reply on HN