Live data from Hacker News

Ask HN: Started a new job and their existing code sucks. What to do?

news.ycombinator.com

41–50 of 66 posts

Re: Ask HN: Started a new job and their existing code sucks. What to do?

#41
"It's almost an Italian restaurant" made me crack up.

I had the same problem when I started working at a startup a few years back. The code base was a spaghetti factory, but that was the least of the problems. No one was prioritizing issues properly, management was aloof, the bugs being discussed in the product were huge oversights, deadlines were looming, but nothing about the trajectory was indicating that anything would be met. I left after a week, a year later, they went out of business.

So I guess the take away is, if it's just code, being new, you will always run into differences, poor code (maybe there were reasons for quickly scrambled code), oddities, but don't let that throw you off, maybe they need more people so they don't need to scramble so hard? Bringing it up, or butting heads will only keep you from progressing. If you want to stick it out, assimilate and just prove yourself through superior code/work ethic. But if the code is a symptom of a much bigger mess in the company, then maybe look for something else? It's tough, and we would really need to be there to understand the whole situation.

Re: Ask HN: Started a new job and their existing code sucks. What to do?

#42
I found myself in a similar situation recently. This may give you something to think about...

http://thecodelesscode.com/case/33

You might want to do some reading of books about how to promote institutional change from within. If you can read, and then get your manager to read, "Creating a Software Engineering Culture" by Karl Wiegers, that might help. Also, "Refactoring" by Martin Fowler is highly advised.

Regardless, maintaining good relationships with your coworkers, and specifically your manager is key. One key insight I have gathered over the years is that whenever possible, there are benefits to avoiding telling someone "this is a problem/bad/whatever and needs to be fixed" if it is instead possible to say "That's great, and it would be even better if..." The criticism in the first form invokes a immediate defensive reaction once someone hears "this is a problem" which may cause them to not hear whatever you say next, and can create a teacher vs. student dynamic (see Pavlov's work on negative conditioning) in which they may actively start to resist your suggestions, while the second form is more likely to cause them to feel good at having been praised and want to seek further approval (positive conditioning, which tends to be much more effective and produce more long-lasting behavior changes in most circumstances). Some research on self-serving bias suggests that people are much more likely to believe what you are telling them if you can phrase it in a way such that it sounds like praise.

Good luck!

Re: Ask HN: Started a new job and their existing code sucks. What to do?

#44
Do you the like the new job (except for the code base) ? Like the domain, co-workers etc. If so then propose that you can increase the velocity of release by proposing good architecture practices.

Then have them write integration tests for all the major test cases and start peeling the layers. It is almost kind of fun to develop in brown field instead of green field. Looks like the code grew organically without much thought.

Re: Ask HN: Started a new job and their existing code sucks. What to do?

#46
post #30

Here's the idealistic answer: see if you can get a very private interview with the head of the company; even the board of directors. You are accepting money, so you actually have an obligation to get this information to them. Doesn't mean you'll be believed necessarily, and yes it's high risk but the obligation is there and the reward - the difference you'd be making if the ship can be turned around - is large. Of co…

> very private interview with the head of the company; even the board of directors Are you assuming that OP works in a small SV startup? Most jobs are in companies where that isn't plausible.

I'm not assuming the original investor wasn't the owner/proprietor, but I mention the possibility. I do assume a board, if that's not present, bail.

Re: Ask HN: Started a new job and their existing code sucks. What to do?

#47

Be a little more relaxed about this. Legacy code often looks like a big elephant which needs lots of fixes. Look to the tiny things instead: - just make the function / class you're working on nicer, preferably just a small function. Apply some common quality standards to it, clean code, nice docs. - repeat this for a while, and you will have a nice set of examples and guidance for the other team members by setting an…

If there’s literally no structure in place for running tests, then OP cannot just add “a simple test case.” OP also needs to build the test runner. That requires convincing his manager, who is likely the one responsible for this mess (by claiming maintainable code is not a priority). Personally I think it’s irresponsible to hire new employees before having a maintainable project. It’s much easier to onboard employees…

- test infrastructure in every language is really a matter of minutes these days. Being able to run it locally is sufficient for a first step.

- hiring people for unmaintainable projects is literally the default for the majority of companies as everyone starts out small without directions and either fails or becomes something big. Legacy code is basically everywhere, clean code is the minority.

Re: Ask HN: Started a new job and their existing code sucks. What to do?

#48

Be a little more relaxed about this. Legacy code often looks like a big elephant which needs lots of fixes. Look to the tiny things instead: - just make the function / class you're working on nicer, preferably just a small function. Apply some common quality standards to it, clean code, nice docs. - repeat this for a while, and you will have a nice set of examples and guidance for the other team members by setting an…

"Be a little more relaxed about this" is probably the best advice haha. I think I just freaked out when I saw their code/had to debug it. But, as @pascalxus said, this is probably very common in many places.

It is much more common than decent code that just lets you iterate and implement good stuff. Also the lesson to take away: code like this is everywhere and often it powers the things you really do not want to be run by something like that.

Considering that you will face this probably with your next employer again, deep breath and just enjoy the actual engineering work!

Re: Ask HN: Started a new job and their existing code sucks. What to do?

#49

Sounds normal. How many jobs have you had previously?

It's so normal that I'm actively looking for a new career. I'm tired of being paid to write and maintain garbage code for garbage people.

You're not special yourself. People think same about you and your code.

Re: Ask HN: Started a new job and their existing code sucks. What to do?

#50
You were hired to help fix the problem not add to it. No rewrites, no major refactors yet.

Fix bugs, for every bugfix add a regression test so it never happens again. Find a list of the most recent bug fixes, findout if there is a common pattern. If so, target that.

Are there code reviews? If not start one. Is there a coding standard? If not start one. With code review & standards in place. Start adding small tests. Small refactors with tests only.

Are there things that need to be done in a specific order most of the time? Document it, build a checklist.

Are there good logs? If not, add them.

The difficult work right now is not technical but social. The team needs a good process and to follow a best standard.

It's gonna be tough, cultures are difficult to change, but be patient and remind yourself. You were hired because they have problems not because they want to give away free money or help you out with a job.

Post reply on HN