Ranting about all the WTF I just experience.
-
Short Story:
Working on a project for about 3 weeks. Started with some fun like "ohh, by the way, did you bring a notebook? Because we have neither chair, table nor hardware for you. Ahh - and no we do not have VPN. You must sit here in a very low table all day with your hardware"
First time in this project i though about getting out as fast as possible.Then I saw the code. I almost literally puked. Here is a best of what I found so far:
several methods with > 100 required parameter. Current record I found is about 180 Parameter.- Funfact: these methods encapsulate perfectly fine classes (really, they wrap classes!) like phpmailer into a single blob of a method.
The existing classes are more or less collections of methods. No class contains data, only logic. Which means all methods of the user-"class" start with ->($user_id, ...) which is very annoying. Ahh and of course none of the objects buffers any database calls. You need name, address, city and country of the users? - That will be 5 DB calls to the same table / key.
Includes are random used. There are single files with about 15.000 lines of code, containing about 300 methods with totaly different scope. Extra Candy: This file includes nearly everything else in the project, because there are so many different methods in there. WTF do they wonder the (PHP) Compiler needs 2-4sec for these files? (They load and parse about 20MB of Code every time...
-
-
@DieWaffel So basically everything that could potentially suck, turned out it does suck.
I hope at least the money is decent.
-
@thegoryone said in Ranting about all the WTF I just experience.:
@Onyx Come on now, just because most PHP devs live on a diet of lead paint and glue doesn't mean we all do
Dude, I am a PHP dev.
And who the fuck stole all my glue?
-
@thegoryone PHP backend for the web UI, HTML/JS frontend, C++ service that monitors stuff this fucking Asterisk bastard does, all mine!
I need a lot of wall candy to get me through the day.
-
@thegoryone said in Ranting about all the WTF I just experience.:
20 quid says the dev has no idea how to do
UNION
orJOIN/LEFT JOIN
etc. 5 calls will also by design be even slower thanSELECT *
for the average user table unless you're pulling down > 100 fields I'd say.It may disturb you even further: Each of the calls does 3 or sometimes up to 10 JOIN operations.
That's wrong, though. PHP isn't compiled, it's interpreted. I'd say for a 15000 line file 2-4 seconds would be generous, I'd not be surprised if it took 10+ seconds to run at that state.
Should have said Parser, not Compiler. Shame on me. In C or C++ this would be a much smaller Problem, the Compiler takes much of the junk out. But in a scripting language it is fatal.
That's only a bad thing depending on how they're called. Inside a magic method like
__contruct
or__autoload
? Not so bad. Insidefunction getUserAddress(...)
? Step away from the keyboard before I beat you with it. What they should be doing is creating a single point of entry for PHPMailer (or depending on how you feel if you're using a framework, use inheritance and call it from the base class) and run arequire_once
against the PHPMailer files. Which is how I (And most other devs) do it. In this case you're going to (by necessity) have a class declared inside a method, but as it's a 3rd party code library this is mostly fine. You could pass data directly to PHPMailer but this would require you to go in and mess about with PHPMailer which is a greater evil.No no and no. Your Idea would make some sense. These Methods work more like:
method (p1, p2, p3, p4, p5, p6 ...)
$obj = new car(p1, p2, p3);
$obj->set_color (p4);
$obj->set_brand(p5);
$obj->set_wtf(p6);and so on, calling each method on it and passing the parameters...
You already know what you need to do. Go. Go now, while nobody is looking!
Hiding in plain sight, while getting paid and looking for something else :)@Onyx PHP does not write bad code, bad developer write bad code.
-
This post is deleted!
-
@DieWaffel said in Ranting about all the WTF I just experience.:
@Onyx PHP does not write bad code, bad developer write bad code.
Why does everyone feel the need to defend PHP from me? :P
I mean, I'll call on its bullshit, but generally it gets the job done and I kinda like it overall.
-
@Onyx Because you looked like one of the guys who blames stuff on a language, not on the devs :) BTW: I know PHP can do some wired things. Ever compared a array to an int? or an Object to an bool? Most things are well though after all, some other stuff is just strange.
-
@DieWaffel said in Ranting about all the WTF I just experience.:
Ever compared a array to an int? or an Object to an bool? Most things are well though after all, some other stuff is just strange.
I'm sure it's no crazier than JavaScript. I'm starting to suspect nothing is crazier than JavaScript.
Well, except Ruby which will let you multiply strings...
-
Incredibly common to see students doing it this way though (I was guilty of this myself the first time I built a CMS...in 2004)
Yepp, but this is a project with 4 freelance developers and some guy calling himself "senior" who created the blob-methods and call it architecture. Nobody is allowed to change it. I'm going to give a big party after leaving.
-
@DieWaffel said in Ranting about all the WTF I just experience.:
Incredibly common to see students doing it this way though (I was guilty of this myself the first time I built a CMS...in 2004)
Yepp, but this is a project with 4 freelance developers and some guy calling himself "senior" who created the blob-methods and call it architecture. Nobody is allowed to change it. I'm going to give a big party after leaving.
Are you sure it is "senior" and not "senor"?
-
BTW: I missed something in the first Post. They are growing "elseif trees". - Something like a if-then-elseif-elseif with 100+ "cases" and some of the "cases" are nested 20-30 layers deep... It seems the original programmer did not know about switch-case or even something like "SELECT file_to_include FROM dynamic_includes WHERE action = $action" - Ohh wait. To do this you need to understand includes and structuring code.
-
@thegoryone No no, you don't
include
SQL injection,mysql
is controlled usingini_set
.
-
This post is deleted!
-
@Onyx said in Ranting about all the WTF I just experience.:
Well, except Ruby which will let you multiply strings...
Works in Python as well.
-
Cootie-induced duplicate post redacted
-
@Onyx said in Ranting about all the WTF I just experience.:
Well, except Ruby which will let you multiply strings...
Really? One of the questions that came up during the interview for the job I start Monday, when discussing the general topic of scripting for automating tasks, was whether I know Ruby. It's possible I might need to learn it. I think (and hope) most such scripting can be done in languages I already know (perl, csh, bash, tcl) or am in the process of learning (python), but it's possible. :shudder:
-
@HardwareGeek said in Ranting about all the WTF I just experience.:
Really?
onyx@shodan ~> irb irb(main):001:0> "really"*10 => "reallyreallyreallyreallyreallyreallyreallyreallyreallyreally"
-
@Onyx Ah, repetition. Yes, that works in other languages, too, although some use a different operator.
My brain interpreted your statement as meaning that Ruby supported multiplying a string by another string (which also works in other languages if the strings look like numbers) —
"some string" * "another string"
— and quite logically refused to derive any meaningful result from that operation.
-
@HardwareGeek said in Ranting about all the WTF I just experience.:
My brain interpreted your statement as meaning that Ruby supported multiplying a string by another string (which also works in other languages if the strings look like numbers) —
"some string" * "another string"
— and quite logically refused to derive any meaningful result from that operation.Hmm...my algebra tells me it'd be
"someanother somestring stringanother stringstring"
, or some variant thereof. (String concatenation fails commutation, after all.)
-
@DieWaffel said in Ranting about all the WTF I just experience.:
Ahh - and no we do not have VPN. You must sit here in a very low table all day with your hardware"
What's the point of them being concerned about security if you do the work on a personal machine?
-
I'd assume dot product.
some string
another stringsaonmoet hsetrr isitnrging
-
@HardwareGeek I kind of liked Ruby.
I think it suffers a lot from its relationship to Rails, the same way that JavaScript suffers from its relationship with DOM.
-
@AyGeePlus said in Ranting about all the WTF I just experience.:
I'd assume dot product.
Wouldn't that be
"some string"."another string"
? (Extra fun in PHP! )
-
@DieWaffel said in Ranting about all the WTF I just experience.:
No class contains data, only logic
Stateless! that's what the functional proggramers do
-
@asdf
and smalltalk
-
@DieWaffel said in Ranting about all the WTF I just experience.:
several methods with > 100 required parameter. Current record I found is about 180 Parameter.
-
@blakeyrat said in Ranting about all the WTF I just experience.:
I think it suffers a lot from its relationship to Rails, the same way that JavaScript suffers from its relationship with DOM.
There's more of a problem with the tendency to need to be running fast on an upgrade treadmill; the Ruby community tends to be poor at long-term support of gems and there's a similar mesh-of-stupid-dependencies problem that we have in Node/npm.
I really don't see why I should need a 16GB VM to serve what is mostly simple web pages to a small number of users…
-
@dkf said in Ranting about all the WTF I just experience.:
I really don't see why I should need a 16GB VM to serve what is mostly simple web pages to a small number of users…
Last time I checked in with the crazies in web development, the reason I usually got was something along the lines of "Just because I can, therefore I will". And why would they think about sharing computational resources with other products/services?
-
@WPT said in Ranting about all the WTF I just experience.:
Are you sure it is "senior" and not "senor"?
"senile"
-
-
It sounds to me like someone has found the bastard method of building procedural programs in object-oriented systems. You can suspect this when (1) class is singleton; (2) the only class is 15,000 lines; (3) program globals as static members (but only if needed). Amirite?
Usually created by dyed-in-the-wool procedural programmers who are absolutely determined that, "OO is total bullshit. There must be some way to build a decent procedural program in this stuff." Triggered by non-procedural languages like Smalltalk or BS standards that require use of classes.
-
@CoyneTheDup More or less. The Senor Dev thinks this is how OOP has to be. I tried to explain to him the data / function inside an Object, encapsulation and object responsibility etc. He simply did not understand it. He does not want to understand it. Therefore he wrote these bastard functions encapsulating Objects. He simply does not understand how to USE an proper object / class if you give it to him.
He thinks with this "class-as-function-libary" he did absolutly understand OOP and this is the only correct way. He was really pissed and confused as I told him "You not even scratching the surface of OOP and its benefits." Guess I'm the first one who spoke this out.
-
I guess the Senor must have mistaken "language that supports OOP" as OOP, the practice itself.
I remember this also happened to the Agile manifest for development too.