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

381–390 of 704 posts

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

#381
I have a slightly different take than most other commenters. Perhaps you won't like what I write, since it goes against some widely held beliefs.

If the code generate 20 mio revenue, then it is very successful code. It might be ugly, but clearly something works right. You say "the mess is just too huge to be able to build anything" - nevertheless these three juniors have managed to build something with great business value. Most likely they are more productive as measured in revenue pr development effort, than most of the experts giving you advice in this comment section. The worst code is code which doesn't work or doesn't fulfill its purpose - regardless of how many patterns and best practices it implements.

The dirty secret in software development is most advice and "best practices" have no empirical basis. If "bad" code is highly successful, is it really bad? If theory does not match reality, is it reality that is wrong?

So before you try to change everything, you should eat a bit of humble-pie and try to understand how the code became successful in the first place. Otherwise you very easily throw the baby out with the bathwater.

For example:

> it doesn't use composer or any dependency management. It's all require_once

I'm not familiar with PHP patterns, but I would venture a guess that this "require_once" pattern is also the simplest? If you talk to real seasoned experts, they will harp on "keep it simple", while complex patterns are often being pushed by sophomores and consultants.

> no code has ever been deleted. Things are just added . I gather the reason for that is because it was developed on production directly and deleting things is too risky.

Perhaps, but this is actually reminiscent to the open/closed principle, part of the SOLID framework, which at least at one point was considered best practice: Improve code by adding and extending, not rewriting working code already in use.

> no MVC pattern of course, or whatever pattern.

Great! Patterns are an antipattern. Or slightly less flippant: Patterns are not a sign of quality or a goal in themselves. Patterns are solution to problems, so only appropriate if you have that problem in the first place.

Bottom line: You might learn a lot from working on this project.

> Resistance to change is huge.

I can understand that, if they have built something highly successful, and now you waltz in and declare that they are doing everything wrong because they are not using enough patterns.

You are right about source control though.

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

#382
post #178
post #157

Earlier quoted context omitted.

This is the sanest answer. No amount of leadership is going to help an incompetent team. A codebase with massive technical debt, tight coupling, and accidental complexity will be hard to improve incrementally. Impossible without competent engineers.

I agree it's the sane answer. But I don't think these engineers are incompetent. They lacked direction, accidentally followed worst practices, and _still_ came out on top. I would say they are good engineers but perhaps bad project managers / architects.

Not a developer, but I was onvolved, and are again involved, in some crucial dev projects on which the future success of my employer depends. Any developer who deploys to production without testing, or worse, develops directly in production is by every definition at least incompetent. If not an incompetent wannabe rockstar ninja cowboy without even realizing it. And those devs are dangerous.

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

#383

1. Grab a copy of Working Effectively With Legacy Code 2. You say you don’t manage the team. I guess you have some kind of ‘tech lead’ role. I think to get things to change, you’re going to need buy in from management and the team. If the budget is tight it will be harder to say ‘we need to invest in fixing all this stuff instead of whatever it is that actually makes money’. Whatever you do must have a good business…

Agreed, especially starting with Working Effectively with Legacy Code.

One of the hard things about what we're assuming is OP's tech lead role is that they're having to influence changes up (with management) and down/laterally (with the team). Things that might convince the team are going to be generally different than the things that might convince management. Management will probably be more convinced by things like improved lead time for changes, eliminating risk of failure, improving confidence in correctness of feature roll-out (though some of this depends a lot on the industry / domain and the incentives of management). Meanwhile the team will be more convinced by things like making their job easier or setting themselves up with more and better skills to take a "better" job down the road.

The rub with all this is that if the team doesn't like OP's changes (e.g., using source control), they'll have management cover right now. At each step it's important to show why it's better.

A way to do that—hard to tell if it's the right way without knowing more about the team's dynamics—is to make a lot of the changes for your own work. For example, set up your own test environment, develop there, then using this mystical "source control" magic apply the safely-tested changes to prod. Eventually someone will notice that you're not breaking prod as much as everyone else. ("You" here being either OP, or someone else in the same situation.)

All of this is just nuance, politics, and team dynamics layered on top of the excellent recommendation I'm replying to.

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

#384
post #283
post #208

Earlier quoted context omitted.

You don't not use source control because nobody directed you to and you 'accidentally' .. what, forgot about it? You don't use it because you haven't heard of it; = not competent.

I find it hard to imagine you’d never heard of source control by now. You’d have to have been living under a rock for the past 15 years.

Or been drinking to much of the "move fast and brake things" koolaid for all of the 5 days of your career.

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

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

So there was a physicist, an engineer, and a business guy, and they were discussing God.

The physicist said that God must be a physicist, because He had to know about matter and energy and so on.

The engineer said that God must be an engineer, because He had to do something useful with the matter and energy - turning chaos into order.

And the business guy asked, "Where do you think all that chaos was coming from?"

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

#386
Similar experience so my advices are mix of Tech & Non-tech

1. Stop cribbing 2. Start using version control/git, Build Test/UAT environment 3. Upskill your team - As you mentioned your current team MUST have also inherited the code from someone else 4. Try tools like dead/junk code finder, lint etc 5. Try other refactoring tools and techniques 6. Most imp: Try to gain trust and Read 1.

A) Is current system stable [Understand it is messy!]? If it is stable there are ways and means to build/design/architech parallel future roadmap without adding more mess.

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

#387
Well, I would prepare 3 envelopes.....

No, seriously, some projects like this are lost causes. The company wants to just get maximal return on minimal effort. A rewrite is going to be a sunk cost with no return.

Basically, your job is to limp it along if you can't prove that a rewrite will make them more money.

If you don't like that answer, you might as well look elsewhere.

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

#388
You can't fix the code until you fix the team. Do they trust each other? Are they capable / comfortable working together? Is there a process in place that works and they all understand? Are there skills deficiencies? Is the culture bad? Are they afraid to make or admit mistakes due to blame culture? You can't fix anything you fear to acknowledge.

Get the team functioning well, then improve the code.

Post reply on HN