Live data from Hacker News

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

news.ycombinator.com

281–290 of 346 posts

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

#281

Earlier quoted context omitted.

This seems like a great post to vent a little bit. I'm definitely a bit touchy on this subject. I like to think I'm pretty good at programming, development, and generally architecting solutions. I don't have a lot of experience, but I have a bit of talent and spent a lot of free time learning. Solving problems with computers is something I'm passionate about. I started this particular project without any idea of what…

Thanks for sharing this. Venting is good, and in this case a win-win, since this is good info (very relevant in a thread about encountering "bad codebases"). Hopefully OP sees it. You could well be "the other developer" where OP is. Open question: how does one fight against what's been described in this comment? What specific sorts of communication skills? One thing that comes to mind is learning when and how hard to…

You really can’t, it’s not productive to assume this a skill you need or is beneficial (although it can be) and if people pick up your code and joke, laugh, or belittle without context, as in this case, it’s not your fault, don’t let it effect you. You’ll find the vast majority of developers are childish and immature, and not very good at their jobs, that’s been my experience at least.

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

#282

Earlier quoted context omitted.

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".

Surely in a commercial setting the primary factor is RoI rather than time? Will rewriting this old, stable, code increase profits or substantial reduce revenue impacting risks?

#notacoder

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

#283
> 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.

Even the worst projects tend to have logging. You can hook into that, and whilst it's not great, you can test that correct log messages are made.

The TDD book, does in fact step you through examples with no tests and show you how to hook them in.

It isn't quite as hopeless as you think it is. In fact this is the kind of system I quite enjoy working on.

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

#284

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.

Even if I didnt do anything, the code keeps breaking!

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

#285
Upon reading that, my idea is that that person had too high a workload to do it all the “right” way, was learning on the job, or both. They might realize it all could be more clean and proper, but not have the ability to make that investment in fixing their technical debt.

On my own code, every time I have gone in and thought I was going to fix it by refactoring or rewrites, I slowly and sometimes tragically re-learn all of the edge cases I was writing around and frustrating things I discovered when I was writing it in the first place. There may be non-obvious problems regarding other peoples’ APIs, for instance, that necessitate methods which appear to be poor practice from the outside.

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

#286
Read "The Clean Coder." Robert Martin addresses this very issue directly. He mentions some modem code that was hideous, but worked very effectively. Knowing that code doesn't last very long before having to be replaced, he realized that it wasn't worth the confusion. Look just a bit longer term than your first year or two: will this code end up being overcome by events within that timeframe? If so, don't mess with it.

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

#287

Earlier quoted context omitted.

This seems like a great post to vent a little bit. I'm definitely a bit touchy on this subject. I like to think I'm pretty good at programming, development, and generally architecting solutions. I don't have a lot of experience, but I have a bit of talent and spent a lot of free time learning. Solving problems with computers is something I'm passionate about. I started this particular project without any idea of what…

Thanks for sharing this. Venting is good, and in this case a win-win, since this is good info (very relevant in a thread about encountering "bad codebases"). Hopefully OP sees it. You could well be "the other developer" where OP is. Open question: how does one fight against what's been described in this comment? What specific sorts of communication skills? One thing that comes to mind is learning when and how hard to…

> Open question: how does one fight against what's been described in this comment? What specific sorts of communication skills?

This would be worth its own Ask HN, if it hasn't been posted before.

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

#288
post #184

Earlier quoted context omitted.

> Being able to read and work effectively in legacy code is an essential skill for any software engineer. This is key advise. It makes the difference between a person who enjoys the art of coding and a professional who get paid for work. Basically you have to first proof why the invest of rewriting brings any financial benefit. Till then, be professional and maintain it.

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…

Well, that makes you a colleague who I would not want to have around. Someone who only cherry picks his duties and cannot work beyond greenfield projects.

I agree that work should produce happiness. And I agree there are places where the work is not everyone's fit (e.g. bureaucratic customizations). But being not able to cope with bad code is a no go in my opinion.

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

#289

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…

In the meantime, use an issue tracker to keep a handle on all the stuff you actually need to do to bring this code up to speed. If a test needs creating, add an issue for it. I'd personally not keep this in a tracker that your manager uses to track metrics, but keep it separate and build it up.

If it's really a rewrite job, you'll end up with a lot of entries in there of varying size and complexity. You can start moving those issues across to whatever issue tracker your boss does keep an eye on as you get to them.

That way, you're not just walking in, announcing that the entire lot is garbage, and wasting time rewriting it all (which is what the business will think you're doing if the current implementation is at least vaguely functional), but you're gaining familiarity with the code and compiling a decent sized todo list that you can present at the appropriate time, as well as a list of fairly quick wins that you can get done when you have some downtime.

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

#290
post #273

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…

>and micro services. Work in the cloud. Avoid enterprise. How is this even related? Worst code I've seen was in financial sector, but the project is so huge that is no chance of upgrading it without complete rewrite, 65% of code when I left it was still in Java5 with no option to upgrade to 7 any time soon, it's just too big, so we can understand why it's shit. Second worst code was in a startup, micro-service orient…

Thanks. Saved me a response :) I am in an Enterprise and we have deployed cruft code into the cloud :) and were even cloud native or whatever bullshit bingo brings up next in terms :)
Post reply on HN