I get that when you begin doing some web you use php, write spaghetti code and over time you learn about frameworks, composer, SOLID, typing and the rest. And the logical thing is to then apply this to your codebase and make it better.

What I don’t get are projects that never evolve, even after several years and sometimes some popularity, there is no PSR-anything, no composer, just about 150 files in the same directory with no classes, just random functions all over and requires/includes (I mean you know what kind of code I’m talking about, right?).
What pisses me off is to see professional solutions, made by a company, with code written by a “professional” programmer with 14000 lines files and things like:
Seriously? You call yourself a developer but can’t even intergrate the first thing written all over any beginner tutorial??? WTF!!! You never heard about sanitizing user input or prepared statements??? Are you living in a cave stuck in 1997????
And I also hate it when the codebase just doesn’t evolve in terms of structure and tools, it just gets crappier and crappier with shitty code added all over for every new features.
And the worst part is that these kind of devs are probably the majority. On the web we only read about/see the ones interested in staying current, but a whole bunch of devs (not necessarily php) are working in the industry and are just clueless about everything (good practices, new language features, etc…).
/END RANT
I hear you. The challenge we face is the cowboy coder is often faster so becomes very protected by management. The business people just want to see their features in place and tune out when words like ‘technical debt’ and ‘scale’ are spoken.
Let’s also not pretend that aggressive managers and deadlines won’t turn all of us into spaghetti coders.
Team members like this suck, because while they knock stuff out, it inevitably drags the codebase down, making it harder to fix things later. That hour, day, or week saved by “just getting it fixed” adds hours of work later, so all that time you “saved” gets wasted and compounded.
Yeah, that’s on software companies that have been stuck in the past. I guess there are no code reviews and/or QAs right?
Eventually this becomes unsustainable and they initiate a full system re-write. And that’s a whole different story.
Refactoring a code base cost a lot of time and money and companies dont find it worth it since nothing changes for the end user.
The reason why theyre called professionals is because they have been maintaining this shit hole of a code base for years and are a requirement for the company to run.
Security issues aside often a code base gets “frozen” in the business world. Once it has been developed to complete a task and it completes that task well you leave it the hell alone. There’s no reason to rewrite things for the sake of rewriting things. “We could rewrite these functions into namespace classes!” “Why? It works fine as is.” “BECAUSE IT’S mOdErN!”. I get it. You want modern clean code, but it’s a dangerous game to start tinkering with production ready and stable code “just because”.
Coding standards change over time. Every year in fact. Things are always moving forward. Coding style is always moving forward. Naming conventions are always moving forward. Surely you do not expect production ready and stable code to be rewritten dozens of times for the sake of following those practices? Those practices are also just guidelines. They’re not commandments chiseled into stone. Additionally who is going to pay for all this? You think you can ACTUALLY pitch rewriting a code base to upper manager, which will cost time and money, “just because”?
I feel like some developers here live in a fantasy land where everything is Laravel and VueJS. I hate to break the bad news, but you’re the minority. Most businesses are running on old, but stable code. Not some Fancy Framework 3.8. If you can’t work within these dated code bases then your knowledge is likely stuck inside frameworks. It’s the ol’ “Learn Javascript before VueJS” saying, but lets spin that for PHP too as maintaining old code bases is pretty much required and will even be the case when your current version of Laravel or what have you gets “frozen”.
With that said you should obviously refactor old code as you learn more and your coding experience increases, but that often just isn’t an option in the real world.

I think you’re entirely right. But what about when you need to add new features. At some point, having a shitty codebase will also mean spending more time debugging and implementing new stuff because changing one thing in a file has unexpected impacts everywhere (lack of encapsulation). So if you’re a smart manager you’ll want to dedicate some time for refactoring/improving the codebase, even if that’s something the end user doesn’t see, it is, IMHO a good bet for the future.
It’s really only a subset of programmers that see it as a craft with its own aesthetics. The rest will be satisfied with any old crap that works, even if just barely.
Yeah I think you summarized well my thoughts 😉
To be an engineer, dentist, doctor, accountant, etc. you have to be certified. They are professions.
Whatever the statistic was of what % of programmers that were “self taught” (60% or something), meaning they picked it up because they were curious, and eventually got paid for it. It happened to me and found myself handling data that these days would be a GDPR-red-flag, for which I didn’t feel qualified, but meh, I was paid to handle it.
One programmer can be totally different from another. There is no standard. There is no profession. It’s scary if you think about it. VW emissions…..
Relevant XKCD: https://xkcd.com/2030/
To be honest though I think a lot of self taught programmers care more about the code they’re writing than people who just blagged their way through a qualification for the money.
Does the code work as intended? If so then shrug.
With respect to staying current. Some years ago PHP implemented the yield concept. I know what it does and sometimes come across it in third party code but I have never actually written code using it. Never saw the need. I suppose that makes me out of date and what not but again, shrug.
SQL injections? Yes those are bad and I would not intentionally use any libraries that contain the sort of code you posted. I guess that I’m just lucky that in my own tiny corner of the development world, I don’t come across much ‘professionally’ written code like you described.
I have only used generators / yield once. It is a feature that can be amazing in some specific instances (like reading and parsing something huge in a piecemeal way), but for most code it won’t make a difference if you use a generator or another way of solving the problem. Still a useful language feature, and not necessarily connected to staying up-to-date.
Staying up to date and improving code for me would be things like using the type system, using static analyzers, using a framework which is kept up-to-date, maybe running PHP in docker containers. Those things lead to a different way of coding and better results, at least in my experience.
I am in hiring mode, hired 25 professionals of all kinds, now I have 4 of them left. These are the only people who want to work and don’t cheat. All others are fired. World is full of professionals!
/rant
Are you, mr programmer, thinking that the project that feeds my whole family and allows me to pay for new car is bad? Like, does it not work? Tell me then what is wrong.
Aaah I see, I see your pain. Anyway… we need a new icon that matches current UX trend. Can you?
Now more seriously: it’s not up to you if a customer wants his project rewritten to the newest frameworks & shit. I am a programmer and God kill me if I am going to chase the new tech stacks when I reach 40yo. If I am not willing to follow them why a normal human would pay for it? He would not.
You are right from technical point of view that this code is terrible and I would (as a contractor) refuse the cooperation with that customer unless he would pay me to increase the security since a contractor often takes responsibility for such failures unless proven that the code is not written by one of his employees (may be hard without git or sth). Still, hosting such a thing is dangerous for the one who picks it up. GDPR and stuff.
Anyway, stop ranting about it because this is how things shifts there. Nontech people / customers just don’t care (they pay you to suffer for it), and contractors don’t want to say to their customers that “hey we need 70 work hours to totally rewrite everything to make it modern and cool. We will also need to RETEST everything if nothing breaks. What u think?” because this could be last thing they wrote to a customer.
There IS one thing you can do tho – change your job. Probably you are more than average developer so you can at least put in your CV that you are not interested in taking over old systems written by interns. Some companies may have a good projects and you may be wrong dude in wrong place. Don’t change others, change yourself
Interesting you bring this up, since I have worked for a company who takes this careless stance to the product and moved to a company who cares about produce and keeps upto date with modern standards and techniques. (We are currently exploring upgrading to php8)
But this is way to common, the company I left, are still using php 5.6, I every page is its own file, all procedural, all a mess. The ceo actually wanted to put tests and inspector in because developer would constantly push up code which was buggy, most of it wasnt even their fault, the code base they were working on was a complete mess. But those tools just said everything was bad (which it was, phpstorm would tell me this all day)

PS. if you want to explore code bases from all your favourate companies they are here, have fun: https://git.rip/exconfidential
Mr. M. “I’m-a-15-year-PHP-veteran!” Trechel, of Webster, Texas (suburb of Houston), who didn’t even know what composer or even npm were in 2019 and who’s work I had to redo about 90% of the time.
Heck, the entire coding team of US LawShield in February 2019 when I arrived as their team lead, of 8 developers, only TWO knew what composer was and only ONE (the 2 year experience “junior” who outcoded all of those code monkeys) knew how to use it.
The average years of experience in the group was supposedly 15 years. I had a guy who stood up tall my first day there and told me “After 30 minutes with you, I don’t know a single thing you’re talking about. MVC? Composer? Adapter pattern? Heck, I’ve never even seen a phpunit test and I have never seen anyone use xdebug.” He quit 2 days later.
They shed their entire dev team, including me, almost all of us voluntarily. Good software devs last there a week. I’ve tried to warn people in the interviews, I’ll whisper “Hey, this is going to be the most toxic culture and worse code you’ve ever experienced. I think you might want to keep looking, even if they’re paying 2x Houston’s rate” but 3 guys did join anyway. One of them lasted, even past me (was laid off 2 months later), 2 of them quit within the first week.
As of March 2020, only Mr. I Have 15 Years Experience Trechel remained on staff. They had already purged in a mass layoff me, the PM, the BA, and the last competent dev, and the last semi-decent guy quit in February. Then coronavirus hit and they retrenched and just basically cancelled all of their dev plans. “If it’s not broken now, it won’t be broken tomorrow” is their new motto.
I did almost all of Mr. Trechel’s work. In 2019, he only did 2 or 3 PRs without me having done 90% of the rewrites, and this became a constant sore thumb between me and my manager, a C-level exec, because I kept wanting him to get, you know, fired for beign an absolute terrible dev. They kept him, let me go.
When they brought me to that small 8×7 room and the new HR lady told me that “We are removing the Tech Lead position and no longer require your services”, I couldn’t stifle my sincere laughter! My manager, the C-Level exec I had a good rappot with, just looked down, ashen faced. He never said a word the entire time. HR Lady asked me, “Why are you laughing?”
“Because! This is the most toxic place I’ve ever worked, but I don’t give up even on abusive relationships. I didn’t want to work here for a year and it’ll be a year in a few days and I was already praying to God for guidance, so this is literal answer to prayers.”
Sir, this is a Wendy’s.
Thanks for posting this, I’ve worked at both good and bad places, but stories like this help me to fuel my energy to finish my own project and (hopefully) sell it.
and who’s work I had to redo

Members
Online

source