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

131–140 of 704 posts

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

#131

Earlier quoted context omitted.

This approach is a trap. Management need to know that this needs a rewrite, and a more capable team, and that persuing on aggressive roadmap while things are this bad is impossible. If they say no, and you try to muddle your way through it anyway, you are setting yourself up to fail. If they say yes, ask for the extra resources necessary to incrementally rewrite. I would bring in new resources to do this with modern…

Why would the existing team stick around knowing their jobs would be slowly rewritten into oblivion by others?

Where else are they going to go if they prefer this mess?

Why would they need to be replaced if they’re ultimately convinced to enter the 21st century?

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

#132

Earlier quoted context omitted.

You're assuming the existing flow is working perfectly and I agree with you that testing is a godsend. I constantly yell that testing is great. Heck, I even worked for Pivotal Labs that does TDD and pair development, and loved it. Let's say you start to write tests and start to see issues crop up. Now what? How do you fix those things? Github actions!? They don't even have source control to begin with. There are so m…

Source control seems like a straightforward first step, regardless of what approach is going to be taken going forward

One would think, but how do you go from source control to deployment on the production server though? If they were editing files on the server directly, there could be a whole mess of symlinks and whatever else on there. Even worse, how do you even test things to see if you break anything?

It is a can of worms.

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

#134

Earlier quoted context omitted.

Does not compute... Ship of Theseus is just regular old development of course it never gets done but new features aren't put on hold.

I mean like “we want to replace X with Y”. Y incrementally starts replacing X, but 100% migration is never achieved, meaning double the API surface area exists indefinitely. Because the migration doesn’t block new features, that means the org gets tired and reallocates the effort elsewhere before it’s ever done, with no immediate consequences. Rinse and repeat.

I think you've not witnessed Ship of Theseus, but "build Ship2 next to Ship1 and start using Ship2 while Ship1 is still being used and keep saying you're going to migrate to Ship2 eventually but meanwhile Ship1 and Ship2 diverge and now you have 2 ships".

I recently witnessed this mess and it is an enormous mess. Don't build Ship2 in the first place. Instead, replace Ship1's mast and sails, and rudder etc until you've replaced all the parts in Ship1. That's the SoT approach.

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

#135

Earlier quoted context omitted.

This approach is a trap. Management need to know that this needs a rewrite, and a more capable team, and that persuing on aggressive roadmap while things are this bad is impossible. If they say no, and you try to muddle your way through it anyway, you are setting yourself up to fail. If they say yes, ask for the extra resources necessary to incrementally rewrite. I would bring in new resources to do this with modern…

Why would the existing team stick around knowing their jobs would be slowly rewritten into oblivion by others?

[deleted]

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

#137

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…

Huh. You are literally saying do a full rewrite. But it's also the worst idea? Edit: A full rewrite always meant replacing every part of a system. Whether you do it gradually doesn't really matter.

[deleted]

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

#138
I think you already gave the answer to your self, but didn't realize. You have two options:

1.) Leave this mess behind you and quit - and miss an opportunity to learn a lot about code, yourself, teamwork and solving real world problems

2.) Work together with your team and solve problems, that probably will improve your skills more than anything in your future

I recommend you to give 2.) at least 6 months, before your quit.

What I would recommend:

- Create a git repository (I would not init it on the production server, but copy the code over to your machine, init, experiment a bit, and if you found a reliable way, repeat this process on the server)

- For the first weeks, continue developing on the server with one main branch, but at least push it to a central repository, so that you have a kind of VCS

- Setup a dev system, that points to a cloned (maybe stripped down) prod database, where you can test things

- Add composer in dev and see, if you manage to migrate this to production

- As you said, you already have an API, that is called via curl. That might be the way out of your mess. Create a new API namespace / directory in the old code base, that is fully under version control, uses composer and as little of the OLD mess of code as possible (you won't get out of this with a full rewrite). Write unit tests, wherever possible.

- I recommend to use jsonrpc in your situation, because it is more flexible than CRUD / REST, but this is up to you

- Get SonarQube up and running for the new API and manage your code quality improvement

- New features go to the new API, if possible

- Start to move old features to the new API, create branches and deploy only ONE folder from dev to prod: the api directory

- The database mess is a problem, that you should not solve too early...

This should take roughly a year. Have fun ;)

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

#140
post #7

1. 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. 2. Slowly start extracting code and making small functions. Document like crazy in the code as you learn. Keep the single file or close to it, and don't worry about frameworks yet. 3. Introduce unit tests with each new function if you can. After all that is done, make a pla…

> 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.
Post reply on HN