Live data from Hacker News

Taking PHP Seriously [pdf]

raw.github.com

21–30 of 155 posts

Re: Taking PHP Seriously [pdf]

#21
post #6

Adams actually makes some very valid arguments in this PDF. People like to argue the superiority of languages, but at the end of the day if the result in PHP is the same as it is in Ruby & Rails, Java, .NET or whatever, does it really make what the language is? Another good point is the efficiency of a developer working in PHP. The language is easy, it's so easy to be a PHP master after a few years working in the lan…

Are the complaints about PHP even controversial? The built in library functions are a mess, and mostly terrible. The syntax and basic language are overly verbose and have layers upon layers of cruft. The type and object systems are grafted on, and have so many gotchas and inconsistencies that it takes many months to understand enough of them to be very productive in the language. The aspects of PHP that were intended…

I code in Python, BASH, C, and PHP on a regular basis and still strongly prefer PHP for everyday coding and hobby tasks. I even prefer to create command-line scripts in PHP (though will switch to Python if it's large to begin with). For me getting Flask to work properly under NGINX + uwsgi was such a hassle. Having to tell it what module, and hooking things up to touch versus just passing to PHP under fast cgi.

To be honest, PHP is really just simpler, less hassle, and if you know what you're doing things come out structured well. Just stick to classes (Including statics! There shouldn't be a define() anywhere.), use namespaces, use composer (I've come to really like it), and use a coding standard.

Re: Taking PHP Seriously [pdf]

#22

I've used php since v3, in its non-OO days. Coming from perl , that fit nicely. Today, I still avoid OOPHP and continue to write procedurally. The convenience of web-oriented functionality, broad deployment, and soft typing is basically unparalleled, although writing this way requires a bit of discipline. It's also a surprisingly good fit for a lot of server side code if you scale beyond a merely web-based execution…

Agreed. There are a few things which are stateful and are therefore made easier/better by OO, mainly DB connections. For everything else, we mostly use classes as namespace (pre-5.3) with lots of static methods. In general for backend web it's pretty silly to spend a bunch of time building up stateful objects when your real goal is usually to load up the subset of information the user needs right now, return that and die as quickly as possible.

Re: Taking PHP Seriously [pdf]

#23
post #21
post #6

Earlier quoted context omitted.

Are the complaints about PHP even controversial? The built in library functions are a mess, and mostly terrible. The syntax and basic language are overly verbose and have layers upon layers of cruft. The type and object systems are grafted on, and have so many gotchas and inconsistencies that it takes many months to understand enough of them to be very productive in the language. The aspects of PHP that were intended…

I code in Python, BASH, C, and PHP on a regular basis and still strongly prefer PHP for everyday coding and hobby tasks. I even prefer to create command-line scripts in PHP (though will switch to Python if it's large to begin with). For me getting Flask to work properly under NGINX + uwsgi was such a hassle. Having to tell it what module, and hooking things up to touch versus just passing to PHP under fast cgi. To be…

In what ways is PHP less hassle than Python? I don't understand this argument.

Re: Taking PHP Seriously [pdf]

#24
post #12
post #7

Earlier quoted context omitted.

PHP just works... if you're willing to spend more time on it, find more bugs in production, have a less readable, extensible, and maintainable codebase, and have no taste. PHP is the dream of a one-man team that gets paid by the hour. Get contract, slap something together that makes the client willing to pay, throw it all away and do it again when the client wants a change.

Just checking: do you have any experience with it? When was the last time you tried working with PHP in a team?

I've done more projects in PHP than I would care to admit. I ported the University of Chicago's "Uncommon Application" from Cold Fusion to PHP using an OO data access model, MVC, and explicit templates. (This was a long time ago before people realized that MVC was a bad idea.)

I've also hacked up a bunch of open source projects (wordpress, joomla). No tests, so you never know what you've fucked up, and you spend more time checking for regressions than actually adding that one feature you want. That's not how you do large scale software development, that's how you add pack on billable hours by charging your client for the same work 100 times.

Really, it's boils down to taste more than anything else. I've yet to see a tasteful application written in PHP.

If I were to summarize it with one anti-pattern, it's that PHP encourages people to mix unrelated parts of the program into one place, making testing, maintenance, and understanding nearly impossible. I should be able to test your app's interface without having a database. I should be able to write a database query without reading any code that touches HTML. And it's something I never see in PHP code.

Re: Taking PHP Seriously [pdf]

#26

Adams actually makes some very valid arguments in this PDF. People like to argue the superiority of languages, but at the end of the day if the result in PHP is the same as it is in Ruby & Rails, Java, .NET or whatever, does it really make what the language is? Another good point is the efficiency of a developer working in PHP. The language is easy, it's so easy to be a PHP master after a few years working in the lan…

> People like to argue the superiority of languages, but at the end of the day if the result in PHP is the same as it is in Ruby & Rails, Java, .NET or whatever, does it really make what the language is?

At the end of the day, every program is a stream of bits too. That doesn't diminish the importance of programming languages as a tool for reasoning, managing complexity and avoiding common mistakes.

As the industry shifts from deliver something that sort of works to deliver something with these assured characteristics, programming languages designed around enforcing desired qualities will be of immense value.

> Another good point is the efficiency of a developer working in PHP.

Compared to what? Depends on the developer and problem domain.

> The language is easy, it's so easy to be a PHP master after a few years working in the language.

You can master any language after a few years.

> It's easy to find super-talented PHP developers compared to any other language.

Data?

Re: Taking PHP Seriously [pdf]

#27
post #23
post #21

Earlier quoted context omitted.

I code in Python, BASH, C, and PHP on a regular basis and still strongly prefer PHP for everyday coding and hobby tasks. I even prefer to create command-line scripts in PHP (though will switch to Python if it's large to begin with). For me getting Flask to work properly under NGINX + uwsgi was such a hassle. Having to tell it what module, and hooking things up to touch versus just passing to PHP under fast cgi. To be…

In what ways is PHP less hassle than Python? I don't understand this argument.

Deployment, for one. sudo apt-get install Apache and PHP, then edit the Apache config to say, "use this directory." I love Django and Flask to pieces, but deploying a Python app is like building a hovercraft compared to PHP.

Re: Taking PHP Seriously [pdf]

#28
post #12

Earlier quoted context omitted.

Just checking: do you have any experience with it? When was the last time you tried working with PHP in a team?

I've done more projects in PHP than I would care to admit. I ported the University of Chicago's "Uncommon Application" from Cold Fusion to PHP using an OO data access model, MVC, and explicit templates. (This was a long time ago before people realized that MVC was a bad idea.) I've also hacked up a bunch of open source projects (wordpress, joomla). No tests, so you never know what you've fucked up, and you spend more…

Anecdata: I just wrote a PHP application where the HTML never touched the database at all. And I'm right now working on a Java application where the database is mixed into the HTML just like the worst of the worst PHP, except because it's Java all the code is two times longer.

Re: Taking PHP Seriously [pdf]

#29
post #12

Earlier quoted context omitted.

Just checking: do you have any experience with it? When was the last time you tried working with PHP in a team?

I've done more projects in PHP than I would care to admit. I ported the University of Chicago's "Uncommon Application" from Cold Fusion to PHP using an OO data access model, MVC, and explicit templates. (This was a long time ago before people realized that MVC was a bad idea.) I've also hacked up a bunch of open source projects (wordpress, joomla). No tests, so you never know what you've fucked up, and you spend more…

That's because you're stuck writing crap code in crap libraries.

Really, you judge PHP off of Wordpress and Joomla?

Re: Taking PHP Seriously [pdf]

#30
post #23
post #21

Earlier quoted context omitted.

I code in Python, BASH, C, and PHP on a regular basis and still strongly prefer PHP for everyday coding and hobby tasks. I even prefer to create command-line scripts in PHP (though will switch to Python if it's large to begin with). For me getting Flask to work properly under NGINX + uwsgi was such a hassle. Having to tell it what module, and hooking things up to touch versus just passing to PHP under fast cgi. To be…

In what ways is PHP less hassle than Python? I don't understand this argument.

[deleted]
Post reply on HN