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…
Ask HN: Codebase at my work is a complete mess, what should I do?
41–50 of 346 posts
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#42Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#43Bookmark this page so that 15 years down the line in your career you can reflect on it. You will have delivered a working software product against all odds, under impossible budget and time demands. Finally they let you hire some help and instead of getting busy helping writing tests and refactoring he starts thinking about the best way to throw you under the bus to your superiors.
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#44> I've already made some comments about rewriting it and the response was basically "ok".
This means that the person in charge of the code is probably aware of its shortcomings.
> The person in charge of this project was working on it alone
This suggests that probably the codebase started out in a neat form and became messy over time due to understaffing/bad planning/feature creep. There is only so much he/she could do as an overworked single dev having to manage a large system.
Your senior is probably very happy to have another dev helping with this. I wish I had someone helping me. Take it as an opportunity, dealing with legacy is a challenge but you can grow a lot as a developer!
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#45- don't be rude but make it clear you think the code is messy and you can clean it up. Explain it to non-programmers in terms of time needed to add new features and the much greater chance of bugs and side effects
- get a few style rules going (do A and not B, group regions/routes/modules -- with only comments at first, if needed) to apply ONLY to new code going in.
- every time you have to touch old code, bring it up to style, even if your changes don't directly address spaghettiness
- slowly (and more confidently now that you're more familiar with the code) refactor parts of the code
- get at least some sort of test structure in there
It'll take a long time but it'll mostly work and you'll probably find it very satisfying. I know I do. Be polite but firm. Believe me that everyone knows the code is a mess and if someone is willing to put in the legwork, every developer worth their salt will respect you for it. You'll have the authority you need to enforce your stylistic choices and the future structure of the code.
Remember above all else, though, that your job is to write working code, not pretty code that developers like. Your goal should be to infect it with order, not tear it out and rebuild it.
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#46Is 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…
Somebody fathered a legacy codebase.
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#47Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#48you should ask yourself a few questions. 1. Is this code in production already making profit? 2. How often is this code updated? 3. Is it profitable to fix that code or just to learn from that experience and move on?
If someone is still confused after reading these, ask yourself: Will the profit I gain from leaving this alone allow me to replace the entire module in a larger refactor later?
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#49Is 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…
Someone's a bit touchy on this subject. Is there a reason you're using a throwaway to voice this opinion?
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#50When basic things are not being done right, it feels almost demeaning to try to start a conversation with someone that the variable name "stuff" might not be descriptive.