Live data from Hacker News

Ask HN: Inherited the worst code and tech team I have ever seen. How to fix it?

news.ycombinator.com

521–530 of 704 posts

Re: Ask HN: Inherited the worst code and tech team I have ever seen. How to fix it?

#521
Been there. Done that. Entire IT department had quit when I walked in. Saved the company.

Took a couple years to recover mentally from it. First off. Make sure whomever is in charge understands how screwed they are. Hiring and retaining staff in is a complete nightmare.

Get someone between your team and management.

Learn to say no to everything. Better yet. This is your go between job. Do not allow management access to any IT staff. They will destroy morale.

Support and slow cleanup is only work that is done for a year or more. No new work.

make sure people who had a part in decisions are gone. Otherwise your wasting your time.

End of day. Decide if your up for this.

Re: Ask HN: Inherited the worst code and tech team I have ever seen. How to fix it?

#522
It sounds like doing a full rewrite with the same team will just spend a lot of time to develop something just as crappy. This is unlikely to be a successful route.

There are some things it should be easy to sell to both the team and to management. First, adding git into the mix. Tell them it's like backing up your work forever. You can roll most changes back to the beginning of the repo, easily. I say most changes because rolling back the code won't roll back changes to the database.

Likewise, creating a preprod environment means you can make sure new stuff doesn't bring down the system before you roll it out. Yes, it will cost a bit more but having that extra assurance and the ability to do a little experiment is considered worth it by almost every other team on Earth.

If you can get those two things in place, you can make it policy that nothing is done directly on production because the risk is too high.

Then you can tackle refactoring code, a little at a time.

Focus hard on training the team. If they are as junior as you say, they need to learn good habits before their ability to ever work as professionals is destroyed. Don't explain it to them that way. Smile and tell them you just want to help them develop their careers, which should be pretty close to the truth.

Above all, keep your resume up to date and your ear to the ground. It sounds like you may burn out before all the work is complete. Have an exit strategy, just in case.

Good luck!

Re: Ask HN: Inherited the worst code and tech team I have ever seen. How to fix it?

#523

Earlier quoted context omitted.

"Have everything in writing, complete with date and signatures" It is possible that the executives won't take it well to all of the formality here (writing and signatures). How would you convince them that this is necessary?

"Have everything in writing" is a bad mindset and is not going to save you. Exeutives are looking at you as the expert to deliver a good outcome. Which means making good decisions, managing expectations and keeping everyone in the loop. Generally, if it gets to the point of having to dig up who signed off on what, you've already failed. Often you won't even get the chance to dig up those emails, because delivering a…

> because delivering a bad outcome is enough for execs to write you off without even needing to hear your excuses.

What makes you think they are excuses? Constantly chasing moving targets and not having even one of them agreed upon in writing is heaven for bad execs. I've seen it happen a good amount of times, my colleagues too.

I don't view the "you changed requirements 20 times the last month and I can't keep up with your impossible imagined schedule" statement as an excuse.

Re: Ask HN: Inherited the worst code and tech team I have ever seen. How to fix it?

#524

First off, no, a full rewrite is not only not necessary, but probably the worst possible approach. Do a piece at a time. You will eventually have re-written all the code, but do not ever fall into the trap of a "full re-write". It doesn't work. But before you re-write once line of code - get some testing in place. Or, a lot of testing. If you have end-to-end tests that run through every feature that is currently used…

I fully agree with this, but I think it misses a key step: As the team’s manager, it’s your job to get buy-in from the executives to gradually fix the mess. You don’t need to tell the team exactly how to fix it, but you gotta get buy-in for space to fix it. One approach is just to say “every Friday goes to adding tests!” (And then when there’s some reasonable test coverage, make fridays go to refactoring that are eas…

Do not waste time with a company that is going to collapse unless they are willing to do whatever it takes.

Re: Ask HN: Inherited the worst code and tech team I have ever seen. How to fix it?

#525
A good start would be the easy to fix things that can be done in a day: - Start using git.

- Start using migrations. (build migration file from current DB)

- Start using CI/CD. (Run migrations, pull/push PHP files, add new nginx routes and reload nginx)

- Start using docker for dev env.

Then I'd focus on the application itself, and that will probably take some days/weeks of work if the routes are complicated or the PHP version is very old(12 years/PHP 5.2 or 5.3 should not be too much work):

- Upgrade the codebase to PHP 8.1. (Reactor might be useful here, but PHP code is generally not hard to update.)

- Consider doing routing using a PHP entry file instead of nginx.

Then new features can follow whatever pattern you want, and old code/DB-schema can be upgraded as you go.

Many of your points are non-issues: PHP is fine. You don't have to use a framework. You only need caching if you need it. PHP itself does not necessarily need a templating language.

The fact that there are a bunch of route entries in nginx suggests that there at least is some form of pattern, for something.

A full all-at-once rewrite would probably break a lot of things at once, so I would just do the low hanging fruit first and modernize the codebase as it's being worked on.

Re: Ask HN: Inherited the worst code and tech team I have ever seen. How to fix it?

#526
Is it doing anything novel? What functionality does it do above and beyond CRUD?

If the answer is no, pick a common MVC framework like Django or Rails or Adonis, generate the models from a copy of your database, and make a minimal proof of concept.

This will go a lot longer way than just complaining about how bad everything is, and how everything needs a rewrite.

Re: Ask HN: Inherited the worst code and tech team I have ever seen. How to fix it?

#527
This is startlingly similar to the situation I'm in, where a solo PHP developer of 15+ years didn't take one moment in all that time to manage the complexity of his code or factor it sensibly. I expect the next year to be pretty awful as I try to get the system to a stable and maintainable state.

Re: Ask HN: Inherited the worst code and tech team I have ever seen. How to fix it?

#528

Earlier quoted context omitted.

I fully agree with this, but I think it misses a key step: As the team’s manager, it’s your job to get buy-in from the executives to gradually fix the mess. You don’t need to tell the team exactly how to fix it, but you gotta get buy-in for space to fix it. One approach is just to say “every Friday goes to adding tests!” (And then when there’s some reasonable test coverage, make fridays go to refactoring that are eas…

> But this often fails because when Friday comes, something is on fire and management asks to please quickly squeeze this one thing in first. There's a solution to this problem: nothing goes live on Fridays. > and making the code touched by that change better. Getting buy-in from management on this always appeared to me as weird. The alternative is a codebase that can only ever get worse over time. So you either gott…

> Getting buy-in from management on this always appeared to me as weird. The alternative is a codebase that can only ever get worse over time.

Well that's just the thing: they have no notion of a "bad code base". To them that's an excuse and a negotiation leverage by the programmer to ask for more money. They judge others by themselves I guess.

Re: Ask HN: Inherited the worst code and tech team I have ever seen. How to fix it?

#529
post #64

> this code generates more than 20 million dollars a year of revenue From a business perspective, nothing is broken. In fact, they laid a golden goose. > team is 3 people, quite junior. One backend, one front, one iOS/android. Resistance to change is huge. My mistake, they didn't lay a golden goose--they built a money printer. The ROI here is insane. > productivity is abysmal which is understandable. The mess is just…

No post body was provided.

Re: Ask HN: Inherited the worst code and tech team I have ever seen. How to fix it?

#530
First off, congratulations! I think you’ve found yourself with an amazing opportunity.

First and foremost, always remember that you and your team are there to support that revenue stream. At the moment the junior developers have done that, but it sounds like they are at an inflection point and need help moving on.

Either one of two cases exists. The current state of software development is holding the business back from growing, or the business is near its limit, but the software is still a possible source of expense, reducing profit, either through excess maintenance or potential for failures.

In either case, your job is not to fix, it’s to lead and help.

First listen to each one of the developers in detail. Find out what they think are the problems. What difficulties they have on a day to day basis. Then teach them.

Perhaps they complain about losing work, or problems merging code. Teach them source control. Perhaps they really fear production changes causing outages. Teach them how to use a staging stack.

If the business is making revenue and sustainable, then you’ve got time and space. And always remember, that revenue is your goal along with your teams productivity. Your goal is not your own happiness with the stack.

If you stick with this company, the opportunity for personal and professional growth is incredible. You’ll learn skills you’ll use for the rest of your career.

So stick with it. And just remember, everything you know about how to run software development is the end goal. It’s where you want those developers to be at the end of the journey. But always listen to them first, and help them by teaching them how to help themselves.

Post reply on HN