Live data from Hacker News

Taking PHP Seriously [pdf]

raw.github.com

101–110 of 155 posts

Re: Taking PHP Seriously [pdf]

#101

Most of the criticism of php seems to contrast it with a language plus a framework. If you really want to compare, compare php with ruby or python, not Django or RoR. As for php encouraging shitty programming, a good bit of that is that so many more people program in php because its easier to get started with. This does not mean that just because php attracts shitty programmers that it doesn't have more or many aweso…

> Most of the criticism of php seems to contrast it with a language plus a framework. If you really want to compare, compare php with ruby or python, not Django or RoR.

Why? What difference does that make as a programmer using it? If another language is more modular, and lets libraries handle things that are baked into php, isn't that a good thing?

> As for php encouraging shitty programming, a good bit of that is that so many more people program in php because its easier to get started with. This does not mean that just because php attracts shitty programmers that it doesn't have more or many awesome programmers than languages such as python.

Maybe not, but it makes it harder to hire the good ones.

Re: Taking PHP Seriously [pdf]

#102

Most of the criticism of php seems to contrast it with a language plus a framework. If you really want to compare, compare php with ruby or python, not Django or RoR. As for php encouraging shitty programming, a good bit of that is that so many more people program in php because its easier to get started with. This does not mean that just because php attracts shitty programmers that it doesn't have more or many aweso…

I think it is fair to contrast PHP with RoR or Django, because it was built specifically for generating HTML. Ruby and Python are general purpose languages that do many more things than generate web pages. No one writes iOS apps in PHP but they do in RubyMotion. No one writes high performance Math routines in PHP but they do in Python.

Re: Taking PHP Seriously [pdf]

#103

Can anyone please point me in the direction of an open source project on Github that can showcase to me the 'elegance' of all these other programming languages that have the scale and adoption of some of the more well-known PHP community pieces? I feel like so much of the bias towards PHP is either an unfair comparison (language to 'rails') or a bad taste left in the mouth because the person worked with a nasty domai…

> Can anyone please point me in the direction of an open source project on Github that can showcase to me the 'elegance' of all these other programming languages that have the scale and adoption of some of the more well-known PHP community pieces?

Just look at MoinMoin's source and see how much more elegant it is than MediaWiki.

> either an unfair comparison (language to 'rails')

Why is that unfair?

> a bad taste left in the mouth because the person worked with a nasty domain specific language like Wordpress, Drupal, Magento, etc.

If that's how PHP is used in practice then it's fair to complain about PHP.

Re: Taking PHP Seriously [pdf]

#104

Earlier quoted context omitted.

That's because you're stuck writing crap code in crap libraries. Really, you judge PHP off of Wordpress and Joomla?

Exactly. He's comparing php to a framework. PHP isn't a framework. If he tried to write code in python or ruby without a framework or template engine, he'd have the same complaint. If he tried php with a framework or template system, he'd realize its not all that different. I just rewrote a Django app in php with very tiny modifications to the templates thanks to codeigniter and smarty.

>CodeIgniter Abandon ship immediately.

Re: Taking PHP Seriously [pdf]

#105
post #83

Earlier quoted context omitted.

$productid = "0x4zz5"; print $productid + 4; If printing "8" is your idea of a working interpretation of that code, then PHP is the language for you. If not, then PHP doesn't work. End of story.

Any programmer in almost any language who mixes types like that without understanding the implicit type conversion semantics is asking for trouble. Implicit type conversion is evil, and I don't see how PHP's sin of favouring string -> number over number -> string is any worse than, say: // Javascript console.log(+(+!![]+(+[]+[]))); // outputs the number 10 Or: // C, Java float celsius, fahrenheit1, fahrenheit2; celsi…

Javascript, C and Java suck, yes. Show me something as bad as the OP in python3 and then maybe you'll have a point.

Re: Taking PHP Seriously [pdf]

#106

Can anyone please point me in the direction of an open source project on Github that can showcase to me the 'elegance' of all these other programming languages that have the scale and adoption of some of the more well-known PHP community pieces? I feel like so much of the bias towards PHP is either an unfair comparison (language to 'rails') or a bad taste left in the mouth because the person worked with a nasty domai…

My personal bias against PHP has been born out of every single PHP project that I've encountered has been horrible. Everything from simple one page apps to complex projects has just been an unmaintainable mess.

Several years ago I was told to use Magento on a project. Great, Magento is a mature PHP app and I'll get to see some great PHP code. Nope, I was horrified by what I saw and dreaded coming to work everyday and having to deal with that mess of a system.

I have a hard time getting behind a language that everyone uses but no one uses well.

Re: Taking PHP Seriously [pdf]

#107
post #88

Earlier quoted context omitted.

Why can't you use getMockBuilder() for static methods? (I don't know PHPUnit so maybe it's a stupid question.)

These tools only work when: 1) You've implemented dependency injection, or 2) You're using a container For example, in PHP you can't mock something like "$foo = new Bar();". The code is right there, it's saying exactly what it wants, you can't return a fake class (unless you do some ugly magic). However, you can pass in an object that is_a Bar, either injecting it via DI or storing it and then retrieving it from a co…

You can still mock the Foo class... by using class_alias.

Don't tell anyone else, though :p

Re: Taking PHP Seriously [pdf]

#108

    > Facebook’s PHP Codebase
    >  x * 105 files
    > y*107 LoC
    >  10 releases per week
    >  Anecdotally, good engineers are astonishingly productive in PHP
Erm... are you kidding me? LoC != productivity, not even close. And it goes downhill from there :( I really, really don't want to rail on PHP (people do that enough, it gets old, yada yada), but you're kinda asking for it here. The only useful point made is about state, although that's a double edged sword.

...Fuck it, I'll rail. It's 2013. Do yourself a favor. Use something better than a horribly inconsistent glorified cgi script.

Re: Taking PHP Seriously [pdf]

#109

Earlier quoted context omitted.

Exactly. He's comparing php to a framework. PHP isn't a framework. If he tried to write code in python or ruby without a framework or template engine, he'd have the same complaint. If he tried php with a framework or template system, he'd realize its not all that different. I just rewrote a Django app in php with very tiny modifications to the templates thanks to codeigniter and smarty.

>CodeIgniter Abandon ship immediately.

CodeIgniter is still okay. Smarty, on the other hand...

Re: Taking PHP Seriously [pdf]

#110

Before this turns into a recanting of the points in the "PHP is a double-clawed hammer" post again, I would like to remind people that PHP still has a place in the business world that nno other language has stepped up to fill. http://blog.samuellevy.com/post/41-php-is-the-right-tool-for... Please stop complaining about how horrible PHP is if you don't use it or have. intentions to replace it.

I couldn't agree more. Having worked with clients that publish thousands of articles of content per month the best solution for the job at the end of the day is still WordPress. Have a client that needs an online store? Magento (both of which are built in PHP). Development shops don't have time to custom build CMS's and eCommerce solution because their clients don't give a shit what language or framework their site i…

Also, as easy as PHP to deploy. That's a big matter. The "save and reload" workflow, as said in the slides, is really a big point.
Post reply on HN