Live data from Hacker News

PHP 5.5.8 Released

php.net

61–66 of 66 posts

Re: PHP 5.5.8 Released

#61
post #45
post #13

PHP has a reputation as a language that makes dead easy to write very ugly sphagetti code. As far as I learned a lot has chaned since last time I was using PHP - something like 5 years ago. Is there any good book or other resource which describes modern PHP with best practices, parts to avoid, etc?

If I were you, and I wanted to see how elegant and great PHP can be, I would just go check out and learn Laravel 4. I recently moved from CodeIgniter 2.x over to Laravel, and it was like breathing fresh new air at the top of a mountain. Everything is cutting edge, organized, and fun to code again. Sounds like hyperbole, but for real it reinvigorated my programming efforts. Check it out here: http://laravel.com/

My\Full\Classname

Namespace convention sucks. That is all.

Re: PHP 5.5.8 Released

#62
post #48
post #13

PHP has a reputation as a language that makes dead easy to write very ugly sphagetti code. As far as I learned a lot has chaned since last time I was using PHP - something like 5 years ago. Is there any good book or other resource which describes modern PHP with best practices, parts to avoid, etc?

Learn how to use the Symfony Framework: http://symfony.com/ That is modern PHP done right.

I'm not sure that PHP done like Java is "right."

Re: PHP 5.5.8 Released

#63
post #62
post #48

Earlier quoted context omitted.

Learn how to use the Symfony Framework: http://symfony.com/ That is modern PHP done right.

I'm not sure that PHP done like Java is "right."

I think the best answer, probably, is that modern PHP done right uses some kind of framework, or at least a PSR-0 autoloader, url routing, proper data security and some kind of templating to separate the logic from the view.

It can (and has been) argued that PHP is itself a templating language and that the added abstraction of something like Twig is unnecessary... while that's technically true, scaling that gets you trainwrecks like Wordpress' API, where it's all but impossible to write plugins without mixing html in with the code. You also get nice things like macros, auto-escaping, and caching with a template engine, and you would probably end up having to reimplement a lot of that at some point anyway.

Although what Laravel uses (blade) for templating looks pretty close to bare PHP, so there's plenty of room for minimal abstraction.

But all of it is light-years ahead of the nightmare that is typical legacy PHP.

Re: PHP 5.5.8 Released

#64

Aaaaaaand cue 250+ comments complaining about PHP, mostly centered around issues that were much bigger in 2009 than they are in 2014...

PHP may not be the shit that it used to be, but why use it over anything else? I'd rather use Python or Ruby with their respective MVC frameworks.

Re: PHP 5.5.8 Released

#66
post #48
post #13

PHP has a reputation as a language that makes dead easy to write very ugly sphagetti code. As far as I learned a lot has chaned since last time I was using PHP - something like 5 years ago. Is there any good book or other resource which describes modern PHP with best practices, parts to avoid, etc?

Learn how to use the Symfony Framework: http://symfony.com/ That is modern PHP done right.

Actually, Symfony seems like some kids went to basic OO design courses and took everything there seriously. It also causes the end product to be measurably the slowest in the world. http://www.techempower.com/benchmarks/

I think this is the worst symptom: Sure, you can write snappy code that performs fast but when you try to reach a higher abstraction level, all those fundamental design failures catch up and make everything awkward and just bad.

Post reply on HN