Not sure if this is a WTF or not, would like opinions



  • OK, so there's a project I used to be associated with. It's in PHP, and had two developers, me and this other guy.

    First bone of consternation: class names. The project started out life back in the PHP 4.x days and was being slowly reworked to be OOP over time. The software itself had a name of a few letters and let's say it began with the letter A. (Anonymity, yo) Now imagine that all classes being added should have no more than 5 letters, and begin with the letter A.

    Just for fun, imagine that there's a class with a two letter name.

    And this is because you don't want too much typing. Never mind IDEs with autocomplete, this is solely about not having too much typing.

    Then just for fun, I suggested the notion of an autoloader and perhaps a PSR style structure (rather than the strange mish-mash style previously in place). I observed that files and classes would have to be altered... now, bear in mind: if you have a class called aaaaa (since, no, capital letters were "incorrect" even though that's a standard too), it might not be in a file called Aaaaa.php. It was just as likely to be in a file called Class-Thingy.php where Thingy would be descriptive of the class's function in a way its name might not be.

    But that too was turned down. Not least because it would have meant the other developer's precious naming convention would be broken, but because that encouraged laziness and laziness from developers is a bad thing.

    Without getting into "PHP is TRWTF", am I insane in thinking these things are WTFs?


  • BINNED

    @Arantor said:

    a project I used to be associated with. It's in PHP

    Without reading further I have already identified two major problem area's for you.

    @Arantor said:

    Without getting into "PHP is TRWTF"

    Oeps ... sorry spoke to fast then



  • Also, apostrophes are a WTF in themselves.



  • Why don't you kill them with fire? They are clearly loonies.



  • Overall WTF parser:

    • PHP and developers, on the same sentence
    • Marketing style naming conventions
    • You having existential doubts over this
    • PHP refactoring? Never heard such thing

    WTF count: over 9000, and that makes me sick 😞



  • @presidentsdaughter said:

    PHP and developers

    I'm one of those.

    @presidentsdaughter said:

    PHP refactoring? Never heard such thing

    I do that.

    @presidentsdaughter said:

    WTF count: over 9000

    That's nothing. The code I've written has a much higher score.


  • BINNED

    @presidentsdaughter said:

    PHP and developers, on the same sentence

    PHP manages to annoy me almost daily.

    But do pray tell, what divine language should I use for my web application, that has to run on a Linux server?

    Perl? Python? Ruby? Choose your WTF!

    Perl might be OK but there are conflicting opinions from what I saw, I can't stand the sight of Python, and Ruby... I know it's hip and all but I kinda have my doubts.



  • Java of course.



  • @presidentsdaughter said:

    Java of course.

    Is that you, @Nagesh?



  • Now make it something people can download and run on their server, which means cheap (or worse, free) 'n' shitty shared hosting.


  • BINNED

    @Arantor said:

    Now make it something people can download and run on their server, which means cheap (or worse, free) 'n' shitty shared hosting.

    Not a factor in my case actually. Even though downloadable packages might become an option in the future only an idiot would install this app on a public-facing cheap-o server...

    Crap.

    So, this Ruby stuff... how hard is it to get a web server running it going? And is there a way to make it damned near impossible?


    Filed under: Covering my ass



  • @Arantor said:

    am I insane ...

    I'm not sure. Insufficient evidence.

    @Arantor said:

    ...in thinking these things are WTFs?

    Not at all. Definitely WTFs. Why would you impose a limit on name lengths and then take up part of that length by requiring every class to include the name of the program? And why not have descriptive names?

    Honestly, I think this should be moved to the sidebar, maybe even Code SOD.



  • It's not so much that you'd include the name of the program in the length, but you'd have some relevant prefix.

    Every fucking class got the same two letter prefix wherever possible. Dude also wrote his own CSS preparser because LESS and SASS didn't quite do it for him, and when I did something with terribly unexpected results, he never could tell me if what I did was a bug or intentional behaviour.

    I'm so tempted to write it up properly but you'll see the many WTFs I made too.



  • @Arantor said:

    I'm so tempted to write it up properly but you'll see the many WTFs I made too

    If it was long enough ago, they can be forgiven as learning experiences. Plus, you were working with PHP. How much worse could it be?



  • It wasn't that long ago... I was still making commits last summer. It's on Github too, but under a thou-must-not-fork-except-for-making-a-repo-from-whence-thou-canst-commit licence.



  • @Onyx said:

    So, this Ruby stuff... how hard is it to get a web server running it going?

    It's dead easy.
    @Onyx said:
    And is there a way to make it damned near impossible?

    Yep, take the approach Jeff's taken.



  • Ah, in that case, I understand your reluctance.



  • And I've built up a (little) bit of 'not a total fucktard' credit here and I'd sort of like to keep that... even if I persist in using a RWTF language! laughs



  • @Keith said:

    Is that you, @Nagesh?

    That would be stopping to another new level.


  • BINNED

    @Nagesh said:

    That would be stopping to another new level.

    +1
    Since this is a @Nagesh post that made me genuinely laugh, I feel it was necessary to indicate my true appreciation for this post.


  • Discourse touched me in a no-no place

    @Arantor said:

    autoloader

    Autoloaders are WTFy all by themselves.



  • Why?


  • Discourse touched me in a no-no place

    Because you're never quite clear on what the set of loaded commands actually is. This can cause all sorts of “interesting” problems if things that you thought would be present aren't there, or things that you thought weren't present actually are there. You get more reliable systems by using a separate loading phase that instantiates everything (or at least puts in proper proxies for everything, which is getting trickier). Defined, clearly versioned dependency graphs reduce the WTF level a lot (though sometimes can cause their own WTFs; I've got a doozy on this to write up sometime for the sidebar, but I'm still living through this bit of pain right now). Explicit runtime loading is OK too; you can predict when the loading failures will happen. In all sane cases, if something goes wrong, you can find out and fix it. This is just so incredibly important for long-term making shit work.

    NB: This is not a PHP-specific point. Autoloaders are just plain awful to debug in the first place across many languages.



  • I have to admit I've never come across the sort of problem that you're describing with autoloaders, not using either Zend Framework or Symfony.



  • Python is your best friend. Learn to love it!



  • @chubertdev said:

    Python is your best friend. Learn to love it!

    If Discourse had been made in python, Guido himself would have jumped up and down with joy to fix all the pain areas on the site.



  • Only if that was Python 3.



  • @wft said:

    Only if that was Python 3.

    Don't sellshort Guido!


Log in to reply