5
devJs
4y

Genuinely asking some rare pokemon php developers that are up to date with the tech (all php devs I know stopped learning when my grandpa was like 5 years old) to show me php code that is not spaghetti bolognese. I am asking this as I am yet to witness such code for the first time in my life (and I am coding since 94')!

Comments
  • 5
    Everything looks like spaghet when you only learned to code with JS.
  • 4
    really? never cared to look internally at most major composer projects? Laravel? Symphony? no?
  • 4
    https://github.com/symfony/demo

    I see you're best practice enthusiast, you can't get better example of best practice in PHP then Symfony.
  • 1
    @HiFiWiFiSciFi extending extended class that was extended by another extended class. well I guess we do have different opinions on software architecture in general.

    The favorite one I stumbled upon is making php API endpoint return HTML file with embedded HTML table instead of plain JSON which enforces me to write Satan summoning ritual in JS on the client-side to get the values out!

    This is some custom php backend I am talking about, there's no Zend, Symfony or Laravel included in the project.

    JS is nor my first nor last language, but I completely understand your resentment.
  • 1
    @AleCx04 not really, but will, thanks on suggestions
  • 2
    @myss exactly, thanks for the suggestion.

    the thing is that I always worked with folks who did some custom php development and there always was that elephant-in-the-room-feature (no pun intended) nobody wanted to touch because of code smells, hacks and spaghetti code.
  • 5
    Ask @linuxxx he is PHP pro, no spaghet I presume.

    In all honesty, because PHP allows spaghetti, most write spaghetti.
    But as soon as you use Composer and some tood old namespacing and braincells, you can write beautiful code.
  • 2
    @PonySlaystation Hi!
    @devJs I mostly write object oriented :)
  • 2
    @devJs ah, I see. You might like what you see inside of those frameworks :D lots of good OOP techniques, docs and practices man :D
  • 4
    @devJs the composer project is nicely written aswell.

    Double inheritance is not a bad thing and used in almost all OO Frameworks.
    As long as it realy makes sense in doing so. This means that composition is generally preferred as are traits and interfaces. Sometimes traits can become more spaghetti than inheritance though.
  • 2
    @hjk101 "Double inheritance?" *laughs in Yii framework* 🤣
  • 2
    @PonySlaystation omg I finally know what Yii is now. Always misread it as the Yui JS framework 😱
  • 1
    @HiFiWiFiSciFi I’m not sure if that is bashing the other languages or complimenting JavaScript.
Add Comment