Lurker News
I have to find a strategy to fix this development team without managing them directly. Here is an overview:

- this code generates more than 20 million dollars a year of revenue
- it runs on PHP
- it has been developed for 12 years directly on production with no source control ( hello index-new_2021-test-john_v2.php )
- it doesn't use composer or any dependency management. It's all require_once.
- it doesn't use any framework
- the routing is managed exclusively as rewrites in NGInX ( the NGInX config is around 10,000 lines )
- 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.
- the database structure is the same mess, no migrations, etc... When adding a column, because of the volume of data, they add a new table with a join.
- JS and CSS is the same. Multiple versions of jQuery fighting each other depending on which page you are or even on the same page.
- no MVC pattern of course, or whatever pattern. No templating library. It's PHP 2003 style.
- In many places I see controllers like files making curl requests to its own rest API (via domain name, not localhost) doing oauth authorizations, etc... Just to get the menu items or list of products...
- no caching ( but there is memcached but only used for sessions ...)
- team is 3 people, quite junior. One backend, one front, one iOS/android. Resistance to change is huge.
- productivity is abysmal which is understandable. The mess is just too huge to be able to build anything.
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 know a full rewrite is necessary, but how to balance it?

Comments (676) 322 threads

Earlier comments
rudi_mk2 replies#
Save yourself a lot of trauma and get out of this mess. Been in a similar situation, spent five years trying to fix things, gave up. Could have saved myself some of the therapy I now need.
ncmncm1 reply#
This alternative is not to be neglected. You don't have to save the whole world. Save what you can that is worth saving. If you are competent to build good new things, do that.
molteanu1 reply#
Why is 'saving the world' even on the table here or in similar cases? Guys making $20mil a year don't look to me like they need saving from above. If you have that kind of money I trust you know what you're doing and can pay for help when help is needed. Otherwise, you don't deserve that cash. Other people might spend it better.

I, for one, have never been saved out of good heart or pitty. Every doctor visit somehow results in money being transfered from my bank account to theirs.

ncmncm#
Those people didn't have to be doctors, or nurses or med techs. They all need to make a living, but not necessarily by probing you. A good many of them entered medicine because it seemed like something they could do to help people. Even if that has since all burned away, you still benefited.

I spent a career not becoming a millionaire at Microsoft (definitely on the table, at the time) because Microsoft was and remains too evil. Likewise Oracle. Or making weapons. I do not answer Google recruiters' e-mail, and not just because Google interview process is far too annoying for anybody with any self-respect to tolerate. (Who does work there? Many worked for companies Google bought.)
Doing work that benefits humanity, or natural ecosystems or whatever, is the reason to do things. The money it pays is how you afford to be able to spend your life doing that.
I feel sorry for people who work knowing the work they do makes the world worse. But not very sorry, because most have a choice. Some find ways to add value from within, e.g. two I know at Oracle do Free Software full time. I mostly cannot tell which do or don't, so I do not condemn all Microsoft, Google, Facebook, Oracle, BAE employees. But I choose not to be there.

speedgoose2 replies#
Yes, life is too short and there are so many much better jobs to waste time on such a project.
bsaul3 replies#
i can imagine how some super senior engineer may like this kind of very challenging experience.
speedgoose#
True, perhaps some are into maintaining shitty legacy systems with not enough budget.
sph#
A super senior consultant might: they are paid by the hour/day and they are free to fire the client and leave if the working situation becomes too hairy.

As an employee, the best advice is GTFO.

underwater#
OP is clearly not senior. If they were they would know how to get from A to B.
rvba1 reply#
Do you work at Google? They never repair things. Hence 5 (10?) unfinished chat programs.
speedgoose#
A Google employee would have told you that they work for Google.
caprock1 reply#
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 plan for next steps (framework, practices, replace tech etc).
Along the way, take the jr backend engineer under your wing, explain everything, and ensure they are a strong ally.
Call me crazy, but that project sounds like fun.

peteradio1 reply#
> 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.

bckr1 reply#
OP is leading a team, not hiding in a churning out code. The "secret superpower" strategy doesn't work here.
peteradio2 replies#
Where does OP say they are team lead? They sound like a junior.

Continue this thread — 2 replies

academia_hack2 replies#
I've been in almost this exact same situation with a slightly smaller team and "only" about $5 million running through the tangled web of php.

We did a complete rewrite into a Django application, it took 2 years and untold political pain but was absolutely the correct choice. The legacy code was beyond saving and everyone on the team agreed with this assessment - meaning our political battles were only outward facing.
In order to get support, we started very small with it as a "20% project" for some of our engineers. After level setting auth, cicd, and infrastructure stuff, we began with one commonly used functionality and redirected the legacy php page to the new python-based page. Every sprint, in addition to all the firefighting we were doing, we'd make another stealth replacement of a legacy feature with its updated alternative.
Eventually we had enough evidence that the replacements were good (users impressed with responsiveness, upgraded UI stuff like replacing default buttons with bootstrap, etc.) that we got a blessing to make this a larger project. As the project succeeded piecemeal, we built more momentum and more wins until we had decent senior leadership backing.
Advocating for this change was basically the full time job of our non-technical team members for 2 straight years. We had good engineers quit, got into deeply frustrating fights with basically every department in the company and had rough go of it. In the end though, it did work out very well. Huge reduction in cost and complexity, ability to support really impactful stuff for the business with agility, and a ton of fulfilling dev experience for our engineers too.
All this is to say, I understand where everyone warning you not to do a rewrite is coming from. It's a deeply painful experience and not one to be embraced lightly. Your immediate leadership needs to genuinely believe in the effort and be willing to expend significant political capital on it. Your team also needs to be 100% on board.
If you can't make this happen and you're not working on a business which does immense social good and needs your support as a matter of charity, you should quit and go somewhere more comfortable.

catears#
It sounds to me like you did a full rewrite by replacing the app piece by piece, sprint by sprint, releasing changes quite often and bringing that value all the way to the user. I think that is really clever.

My impression from others in this thread is that they mean "start from scratch and build until features are on-par with current product" when they say full rewrite.
Your version of full rewrite seems like it is generally applicable, but I have very little faith in the latter approach.

rocqua#
This sounds like the story of a proper, piecemeal, rewrite where the whole team was on board.
francasso#
I will add myself to the others suggesting you to look for another job.

1) A rewrite from scratch is almost always a bad idea, especially if the business side is doing just fine. By the way, when you want to sell a rewrite, you don't sell a rewrite, you sell an investment in a new product (with a new team) and a migration path; it's a different mindset, and you have to show business value in the new product (still ends up failing most of the time, but it has a better chance of getting approved).
2) You never ever try to change people (or yourself) directly. It's doomed to failure. You change the environment, then the environment changes the people (if the changes are slow and inertia is working for you, otherwise people just leave).
Since probably it would be too hard to change the environment by yourself and given that your team seems fine with the status quo, my advice it to just manage things as they are while you look for another job. Otherwise my bet is that your life will be miserable.

Load more comments