Live data from Hacker News

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

news.ycombinator.com

51–60 of 66 posts

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

#51
>> No good practices are being followed, there are no tests, huge components that should be modularized, no organized architecture at all.

I am not blaming you here, but it's our job to ask during the interview process a few questions from the Joel test. Then tell them just show me the systems, just one engineer opening up their Travis CI or any other dashboard, some git repo with test coverage number (no need to show code). If they don't show, don't join.

>> Just don't care and keep doing what you're told to do If the earlier engineers on the team say so, most likely that's the way to go. May be striking conversations over coffee and try figure out if somebody else earlier tried to buy a refactor and it did not work. May be the management just does not care, then find a new gig if this is horrible.

If it were lack of capability/experience, do some rough estimation and propose a refactor plan for every delivery, that is some critical pieces get refactored in each delivery. If this is also not acceptable, then seriously find a new job. Best!

>> This is my first time starting a job with such a bad existing code,

Well, and this may not be the last time; unfortunately this is how this circus works.

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

#52

>> No good practices are being followed, there are no tests, huge components that should be modularized, no organized architecture at all. I am not blaming you here, but it's our job to ask during the interview process a few questions from the Joel test. Then tell them just show me the systems, just one engineer opening up their Travis CI or any other dashboard, some git repo with test coverage number (no need to sho…

>> it's our job to ask during the interview process a few questions from the Joel test

I know. That was totally amateur on my side. I was excited because it's a nice company and just accepted their offer. And they're nice guys. It's not like they're assholes but their mentality towards coding standards is frustrating.

Anyway, at the end of the day, I know it's my fault for not asking those questions during the recruitment process. :(

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

#53

I'm not sure why nobody else has said this yet, but go find another job and then quit. There's no reason that a good developer should have to toil away in obscurity on a shitty codebase.

I'm here for only a week but I must admit I think about quitting.

I could always go back to my previous job (I only left because it's a bigger company and much higher salary). The only problem is that I moved to a different country and I signed one-year contracts (work, housing, etc.), so I'd ended up paying a lot of fines for breaking them.

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

#54

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

What's the point of adding regression tests to spaghetti code?

All you're doing is making it an even bigger pain in the ass to refactor. And at this stage he probably doesn't even properly understand the business logic behind the code anyway and will make duff tests.

I'm admittedly pretty meh about tests, never seen good ones that are flexible and actually test the functionality instead of the implementation. One of my client's actually had a contractor add a bunch of tests to some existing code that took him a month or two and caught a whole one bug in 4 years that would have probably been caught in QA any way.

Otherwise I generally agree, but you can refactor as you go, which I've done plenty of times. Depends on team size and how productive you are to the other devs, but you can single handedly refactor really bad sections and setup a general outline of how the code should be laid out within a year, though you need to start getting people on board.

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

#55

I'm not sure why nobody else has said this yet, but go find another job and then quit. There's no reason that a good developer should have to toil away in obscurity on a shitty codebase.

I'm here for only a week but I must admit I think about quitting. I could always go back to my previous job (I only left because it's a bigger company and much higher salary). The only problem is that I moved to a different country and I signed one-year contracts (work, housing, etc.), so I'd ended up paying a lot of fines for breaking them.

[deleted]

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

#56
post #39

First at all, something akin to Chesterton's fence applies. Somebody new to an organization rarely understands all the factors that go into a code base, and even if they're right that the code base is bad, they are generally not yet equipped to safely fix it. Second, this might be a first for you, but a new person coming in and deciding that the current code base is unsalvageable and needs to be completely rewritten…

I agree but sometimes the whole thing is so clown shoes from the ground up it just plain isn't going to work as is. That does happen.

Its obviously working if the company is hiring right?

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

#57

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

What's the point of adding regression tests to spaghetti code? All you're doing is making it an even bigger pain in the ass to refactor. And at this stage he probably doesn't even properly understand the business logic behind the code anyway and will make duff tests. I'm admittedly pretty meh about tests, never seen good ones that are flexible and actually test the functionality instead of the implementation. One of…

> What's the point of adding regression tests to spaghetti code? All you're doing is making it an even bigger pain in the ass to refactor

Refactoring is changing the code to make it more understandable while keeping the functionality the same. That is the perfect time to add tests. Adding tests before refactoring will help someone understand the code first and will also let you know if you've broken something.

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

#58
post #30

Earlier quoted context omitted.

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

* whooooosh *

OP did not say a single thing about the size of the company, nor anything to suggest that they have been hired in a significant management role. It's entirely possible that they're going into a junior role in Amazon for all we know. Your replies, in contrast, don't even admit those extremely-common possibilities, and I find that omission baffling.

So, confused, I'm trying to think of explanations, such as that all your experience has been with smaller companies... or that were your born into upper-management Jeff Bezos is a golf acquaintance.

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

#59

First at all, something akin to Chesterton's fence applies. Somebody new to an organization rarely understands all the factors that go into a code base, and even if they're right that the code base is bad, they are generally not yet equipped to safely fix it. Second, this might be a first for you, but a new person coming in and deciding that the current code base is unsalvageable and needs to be completely rewritten…

> Second, this might be a first for you, but a new person coming in and deciding that the current code base is unsalvageable and needs to be completely rewritten is pretty much a cliché in our industry.

Amen.

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

#60
post #58

Earlier quoted context omitted.

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.

* whooooosh * OP did not say a single thing about the size of the company, nor anything to suggest that they have been hired in a significant management role. It's entirely possible that they're going into a junior role in Amazon for all we know. Your replies, in contrast, don't even admit those extremely-common possibilities, and I find that omission baffling . So, confused, I'm trying to think of explanations, such…

You assume that the head of Amazon wouldn't want to hear personally about a lot of very bad code being casually tolerated over a long period of time under his watch. I find that baffling. Ignoring something like that is not very "day one." (To use Bezos' mantra.) Amazon also have a board who are probably competent and interested in the company not ____ing up. That a complaint might get lost in the shuffle or noise of a big company doesn't mean it shouldn't be made; but it may mean it shouldn't be made just once.

Yes, there are bosses who don't want awkward info. At NeXT, Jobs didn't want to know (in those days) he just wanted stuff done, so even though his N.A. managers pretty much knew the European manager was not telling the truth about his spectacular sales success they didn't make sure the information got to Jobs, since he didn't seem to want it. Worse, the European staff regulars who were asked to do the dirty work and did know there was a big problem (if only because they say huge stacks of computers piling up in warehouses collecting dust, say) didn't see fit to inform Jobs. The company failed because the European manager was committing massive fraud to fake sales. (Without that, it might have failed for other reasons but that's why it failed.)

But Jobs was unusual in more than one way (and did learn that lesson.) Why on God's earth assume that upper management never wants bad news? The truth is that upper management is often very well-aware that frequently middle managers, and low-level managers tend to serve themselves even to the point of putting the whole company at risk and see it as a big part of their job to prevent that; but they don't know how and where until they're told. The fault with upper management is more usually that they assume that some floor employee would have knocked on their door if anything odd was going on; but as the discussion here shows so vividly, that's by no means always true.

Yup, again, there are some bad bosses who are going to drive their companies into the ground if they can, but it's a dereliction of duty to assume that. If you're taking money from a corporation, twiddling your thumbs while it starts to goes into a steep dive, or continues one, isn't ethical.

Of course, if you go over a boss's head, you absolutely have to have done your homework, and to be right. It's not something to be done impulsively, but it's a duty.

Books such as "The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers" by Ben Horowitz take great pains to convince those heading or managing businesses to make sure every employee takes responsibility for what happens to the company as a whole (from the employee's action and inaction) if that boss wants their company to survive. I could name many others.

Post reply on HN