Live data from Hacker News

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

news.ycombinator.com

151–160 of 346 posts

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

#151
Somehow a lot of people have got it into their head that all code is art, that everything is always beautiful, that it makes sense to take the time to make a great design for solving every problem, that if you aren't working with beautiful code then you aren't a good developer. That's all nonsense.

Think about other engineering disciplines - "okay" engineers can build new bridges, great engineers can cheaply fix existing bridges so they never fail again. It is the same with software. Good engineers make new programs, and whenever they see a problem, they start from scratch, wasting time and money. Great engineers massage existing code into something amazing, increasing efficiency without breaking the bank.

As a side effect, if you make something crappy more reliable, it makes the creator look bad, as they should. Otherwise, you will look bad.

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

#152
“If it looks stupid and it works it ain’t stupid”. On a more serious note. Always share your findings. First with peers, second with managers. Either you’ll learn why it works as it is or you show a risk and opportunity to improve. Nothing to lose in either way.

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

#153
post #95
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…

> 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?

It is a term to enforce the concept of humans as commodity in a commercial environment by the overhead.

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

#154
Do you know why that software is a mess? Nine times out of ten, even with bad developers, it is because of changing business logic requirements, bug fixes, and dealing with corner cases. Your rewrite will, by definition, throw all that accumulated knowledge away.

What you _can_ do is separate large swaths of code into methods, even if they are only called once. This will make debugging much faster and more effective. Pretty much anytime you have a section of code that starts with a comment "// Foo the bar", you should consider isolating it into a function "fooBar(int a, char *b)" which you'll notice is even more informative that the comment, and can easily be stepped over when debugging with only the final return value confirmed to be as expected.

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

#155
post #47

Are there tons of global variables?

I recently rewrote a flashing tool that was used for programming engineering samples (which there is an extremely limited supply of) and production equipment. Literally everything (and I mean everything) in the old implementation was a global variable that would just be recycled throughout the runtime of the program. Excluding loop counters, you could count the number of localized variables on two hands. The call-and…

At my work it's a few hundred globals, often times used in a few hundred different places scattered over, again, hundreds of files.

To make things more fun there rarely is a function with less than a 1000 LOC, written in a Winforms Button_Click handler. Less than 10 functions I've seen take parameters and return a value, almost all rely on globals being set and set some themselves in return.

After the manager and main author of the software asked me to build a new UI and leave the underlying code untouched I decided to leave the company and work on someone elses messy code

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

#156
Protect yourself: put everything in writing, and decline to make any change that you are not confident that you understand. It is not your responsibility to fix this situation, and don't let yourself think so.

If you change the code, you become implicitly part-responsible for it. And if you change complex code that does not have tests, you will break something.

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

#158
post #95
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…

> 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?

Yes. It (being called a resource) is common in Big companies where they literally see you as a "resource". This is worse when you are a 'resource' in a big service company.

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

#159
In that position I would highlight the lack of tests as a problem. This can be done “nicely” if required. “I know there was probably time pressure but without tests only the super human awesome XYZ can safely make changes and littlenold me really needs some help & protection” or done in a not so nice way “well the first thing is to finish what’s there by surrounding with tests, I’m surprised there are zero allready, it’s kind of in professional”

Then concentrate on slowly but surely cover & refactor to support improvements

Much safer than a rewrite IMHO

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

#160
You have 2 options.

1. You rewrite the code. You said you would hate that, so not an option 2. You develop on top of the spaghetti code. You said you would hate that.

So, no matter how, you would hate working at this job.

That's why the only option left for you is really telling your boss how things are and that you can't see yourself working on this project.

You'll probably receive an offer with a 50% salary increase, so you can take that, but you should have a new job lined up already at another companyy.

Post reply on HN