Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
What why how do you even... I don’t even... what? Can’t unsee, can’t believe this.
-
C0D4669024yThat's suppose to be $product[0] referencing the ID
$product[6] is an int... still not sure what it does yet though, but there's another table with 1,000s of records...
that i think it's meant to be FK'd too
Some people don't know what associates are 😔 db results by index are scary.
But anyway, back to this other table of .. aliases, it has a many to many lookup across several tables based on "type" within it, so... i think I just found the dark hole in the universe. -
@C0D4 someone clearly either didn’t/doesn’t understand shit about db design (apparently it’s possible, since I saw one of our juniors struggle to understand the subject and only hardly passing their course on it - even with my help. I struggle to figure out how ppl not grasp something so logical?) OR they like to see the world burn...
-
C0D4669024y@100110111 😅
I'm not sure which this is, I've been around databases enough to walk around with some idea of what's suppose to be going on, but this is.... well.
Product table
-> alias table
-> -> alias table mapping table
( I don't have a better name for it 😅 but it maps the I'd of the alias table to another table per record )
Related tables so far:
type
category
manufacturer
supplier
It's like the multiverse was injected into a single tb table, rather then just joining into the actual table 🤦♂️
I'm not sure why people don't grasp database design, it's not like you can't join 2 or 3 tables together.... but rejoining 1 over and over again... seems madness to me. -
don't fucking lie, you and I both know why: cuz we fucking can.
PHP is not for engineers it is for rockstar engineers -
C0D4669024y@87percentrum god died supervising this mess.
@AleCx04, I've been called many things, this is beyond the rockstar!
This is just 1 line of the 1200 others I need to dig through at the moment, I want to refactor, but there's parts I can't even fathom properly 😑 I need a whiteboard to map the joins on this bad boy! -
@Jilano @C0D4 i once found a legacy php app that had one file being included that contanied nothing more than a closing php tag.
For whatever reason, removing it and just adding the closing tag fucked the entire app up.
I laughed, my senior dev laughed, the cms adming laughed, the manager at the time was confused, and we just rewrote it
to this day, i still have no clue why shit was the way it was
php, the language of legends and masters.
i ain't shitting on it, you both know, i love this thing and i love youse two ye crazy bastards -
C0D4669024y@AleCx04 I think early versions of Yii, maybe it was magento, suffered from similar. Drive you insane trying to work out why you keep getting "headers already sent" errors, when there's nothing outputting. 😑
Ah, the good days were fun!
Php is like a Chinese finger puzzle, except some bastard keeps changing the puzzle as you unlock it 😆.. or the gift that doesnt stop giving. -
NoMad136664y... I've seen this before. 😬😳
Tho, not the same exact thing, so I'm almost sure we've both worked on the mess the same exact person has created. I can't remember lots of details now, but he did have a love for just writing shit for the sake of line count and avoiding libraries altogether. Magic numbers checks out, tho the aliasing is new to me. I guess he improved on his programming, I mean bullshitting, through years. Lol.
Does he still create functions outside of classes but in the same file? Lol. -
C0D4669024y@NoMad thanks for handing him over, although he's someone else's problem now, I've just got the... artwork... to admire.
Unfortunately, classes are to advance for this one, everything is a function, and every function has a bulk and individual alternative... sort of anyway -> check next comment.
Sometimes it feels like the coding style and implementations changed daily the way things are written. -
C0D4669024y@mundo03 you do realise any language with list to string conversion, can achieve this same madness right?
But I get it, #phpBad -
@mundo03 mmm php. Gib moar. But keep the fucking dimwits out, we don’t need them, let snek and js have them.
-
C0D4669024yOk, let's get some insights to these queries:
In order of execution....
$query = "long ass query"
$query2 = "another long ass query"
$query = "set temp var"
$query = "set another temp var"
$query2 = "a long ass insert"
$query9 = "select * from 2 tables"
# wait where did the other 6 go 🤦♂️
$query10 = "select * from another table"
$query11 = "insert some data from query10"
$query5 = "delete some records"
# found 1
$query6 = "more inserts"
#enters a function ... yay back to $query
$query = "delete stuff"
$query = "insert stuff we deleted with new stuff"
# enters a function another function
$query = "select * from another table"
$query = "delete that stuff we just queried"
$query = "insert new stuff that looks like the old stuff"
$query = "update the stuff we just inserted 🤷♂️"
# enters another function
$query = "delete things"
$query = "insert the things with new details" // update... why can't we do an update
# enters another function... I'm seeing a pattern here, although we found some new numbers
$query12 = "delete stuff"
$query13 = "insert the stuff again"
# back to main process
$query6 = "delete stuff I'm pretty sure we already deleted before"
# wait, didn't we already do 6?
$query7 = "update some timestamps"
$query7 = "insert timestamps we didn't update"
$query7 = "update some counters this time"
.... thats not confusion
$query8 = "update everything to 0"
Whoooo we made it!!!
And yes that's the actual variable names 😆
@NoMad, I'm not enjoying this script 😢 -
NoMad136664y@C0D4 condolences 🤣🤣
It will get better: he has unused variables all over the place and even those were referenced by other scripts from a different galaxy super randomly. and god forbid, if he designed the DB too, you're in for a good ride. (the DB stuff he did were hella not optimized. It was dying all the damn time) -
NoMad136664y@C0D4 oh, and he loves copy paste. You'll see he has made the same "if" statement's body copied like it's a virus spreading itself.
-
C0D4669024y@NoMad it's not dying, it's hella slow at times though, but I think the multiverse table is going to be the issue there 😅
So many ways to join a single table, it's, hmm, well , amazing and scary all at the same time.
Hahahahahaha that if() copy/paste is fun, I swear it's the same guy some how.
If($thisIsTrue){
// do stuff
$thisIsTrue = false;
//or do this other stuff
}
If($thisIsTrue){
//do this other stuff
$thisIsTrue = false;
}
🥲 the pain -
NoMad136664y@C0D4 for us it was dying because it had hundreds of writes and a few reads per second. It's a mystery to me to this day how his shit worked. I think he was firefighting all the time tbh.
-
C0D4669024y@NoMad now it's my fire, and I'm just watching it burn 🤣
I dont have the time to Maintain this properly and keep up with my day job, but... trying to understand this mindset and adjust this code to handle a new change... it's like a playdoh version of the tower of Pisa, it's gonna fall at some point 😑 -
NoMad136664y@C0D4 Tbh the best course of action for the long run, is to make a whole different system and switch slowly. He did nothing good.
Tho, the company was not exactly good either, so I hate to admit that even I myself adopted his style and didn't give a rat's ass about the shit I wrote. ¯\_(ツ)_/¯
Related Rants
is it just me, or do some people just make life difficult for the fucking sake of making life difficult?
now, lets ignore the lack of sanitised data, lets also ignore the lack of prepared statements, and for the love of god... lets ignore some magic numbers, because I still don't know what they mean yet....
but why! why would you create an array, implode it, smash it into a database query on the fucking fly, instead of just adding the data into the query in the first place.... it's not like you were doing this right to begin with, but this... this is next level!
rant
legacy
php
computations are free right
magical
dont fix whats not broken