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

411–420 of 704 posts

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

#411

A lovely knot to unravel! First, get everything in source control! Next, make it possible to spin service up locally, pointing at production DB. Then, get the db running locally. Then get another server and get cd to that server, including creating the db, schema, and sample data. Then add tests, run on pr, then code review, then auto deploy to new server. This should stop the bleeding… no more index-new_2021-test-jo…

Solid advice. I did 2 full re-writes with great success and to add to this list I would also make sure you are communicating with executives (possibly gently at first depending on the situation), really learning about the domain and the requirements (it takes time to understand the application), investing in your team (or changing resources - caution not right away and at once since there is a knowledge gap here). The rewrite will basically have massive benefits to the business: in our case: stability (less bugs), capability to add new features faster and cheaper, scalability, better user experience etc. This can get exiting to executives depending on the lifecycle of the company. Getting them exited and behind is one of the core tasks. Dont embark on this right away as you need more information, but this will matter.

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

#412

Thank you for so many suggestions. The main issue is productivity within a context where the company is trying to reinvent itself in terms of marketing and business model. This has for consequence that many new big features are being requested and promised by management to headquarters. But in the last years, all bug evolutions have been failures. That's why I've been asked to intervene. I love the idea of the strang…

What is a bug evolution? Do you mean a bug fix?

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

#414

A lovely knot to unravel! First, get everything in source control! Next, make it possible to spin service up locally, pointing at production DB. Then, get the db running locally. Then get another server and get cd to that server, including creating the db, schema, and sample data. Then add tests, run on pr, then code review, then auto deploy to new server. This should stop the bleeding… no more index-new_2021-test-jo…

Agree with this approach. You have nginx in front of it already so you can replace one page at a time without replacing everything. One thing I haven’t seen mentioned here is introducing SSO on top of the existing stack, if it’s not there. SSO gives you heaps of flexibility in terms of where and how new pages can be developed. If you can get the old system to speak the new SSO, that can make it much easier to start w…

I think "SSO" here maybe doesn't mean "Single-sign on"? Something else?

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

#415
I used to work on a 15 year old PHP codebase. Everything was mixed in the same file - PHP, SQL, CSS, JS… These are some things we did

Start using Git

Start doing code reviews, for newer code

Only refactor as needed. Don’t rewrite, it will likely end in disaster (we tried and failed)

Start deleting dead code. If you’re paranoid, comment it out for a few releases, before deleting

It is all about ROI - for example, removing inline CSS might be good practice, but does it really matter that much in your codebase? Maybe there are better things to do.

Even when refactoring, try to do it in stages. For example, simply splitting a large file into two or more files, without changing the code too much might be a good start.

For any new code that is being written have strict code reviews and rules in place, so past problems aren’t repeated

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

#416
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…

This 100%. This line is an immediate nail in the coffin:

> This business unit has a pretty aggressive roadmap as management and HQ has no real understanding of these blockers. And post COVID, budget is really tight.

I've been at a company not unlike this... several MLOC of VB WinForms that was total spaghetti, but a highly successful app that brought in a lot of revenue. In our case the majority of the dev team was in agreement that the situation wasn't sustainable, and at first (meaning when I joined the company) we had engineering leadership who mostly agreed. They brought in several rounds of consultants to evaluate the code base and announced plans for a major modernization effort. But the consultants largely agreed with the dev team that the code was in such bad shape that it effectively needed a rewrite. At one point we did a prioritization and t-shirt sizing exercise and came up with _30 man years_ worth of items in the "critical tech debt" bucket. Apparently engineering leadership was not aligned with the C level suite about how much money they were willing to spend on this thing, because within the next year there was 100% turnover of management in the engineering org. A couple of (talented!) people who had been hired for the modernization effort left first, then the other engineers who knew the code base well followed. Last I heard the company was limping along relying on Eastern European and Indian contractors to keep the lights on.

In short OP, you can probably get some wins; maybe some major process improvements like using source control, maybe more minor things like introducing patterns or frameworks so that net new code isn't a total mess. But there is zero chance that you're to do anything like a rewrite or major refactoring without leadership understanding that they're in an unsustainable situation and a willingness from them to invest time and money to fix it.

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

#417
What do you mean you have to figure out a strategy without managing them directly? Why are you involved then?

How could the budget possibly be tight if this thing makes $20M a year?

Even at a 5% R&D budget you should be able to hire at-least a couple more devs.

Do you mean to say the whole company makes $20M? If not, what other costs are associated with producing this revenue?

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

#418
post #140

Earlier quoted context omitted.

> Build a functional test system, and write a big suite of tests which ensure preservation of behavior. Make it easy to run and see the results. Keep it to yourself and don't let anyone know why you are so effective. Demand a raise early once you are sure of your value. Edit: why not? Clearly this is a huge value that would be wholly unappreciated without leveraging it yourself.

OP is leading a team, not hiding in a churning out code. The "secret superpower" strategy doesn't work here.

Where does OP say they are team lead? They sound like a junior.

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

#419
post #66

Earlier quoted context omitted.

The problem with people new to the company starting a rewrite from scratch is that they often are poorly informed on why things were the way they were before. If you start big, you can have bad outcomes where the new system might be objectively worse than the old one... but you are stuck trying to get the new thing out for the next 5 years because too many people sunk too much political capital into it. As an example…

The problem is that most developers are crap and self centered on working with the tech they like. You need to work with someone who doesn't care about filling up their CV with "ruby microservices" and get stuff done. If I went into a business to do a rewrite and decided to use $shinyNewTech because I want to build up rust experience I'd probably end up wasting years with little results.

The existing app was a large rails monolith. This wasn’t a small 10 person team but a 50 person org. Groups can get funny ideas sometimes.

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

#420
So I think the first option you should strongly consider is just running. It's a valid tactic and if the management team is difficult, is probably the best one for you.

If you stay you need to manage your relationship with the management team. This involves the usual reporting, lunches etc. You need to setup some sort of metrics immediately. Just quarterly might be sufficient. Nobody is going to care about bug fix counts, your metrics should be around features.

Testing and version control are a good place to start. But you are going to need to get them started there and you will pretty much need to instill good discipline. You will be herding cats for quite a while. If you can't get these two items going well in 3 months then abort and leave. You don't want to stick around for when the money printer stops working and nobody can figure out why.

Post reply on HN