Live data from Hacker News

Taking PHP Seriously [pdf]

raw.github.com

31–40 of 155 posts

Re: Taking PHP Seriously [pdf]

#31
post #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…

The problem with static methods is that they make testing nearly impossible.

Re: Taking PHP Seriously [pdf]

#32
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…

To me it boils down to the developer doing the job. Stating the obvious: you can do a great job in any language, just like you can do a crappy job in any language. I have seen tasteful applications written in PHP (hardly ever an open source application, unfortunately), what I have yet to see is a language with 100% tasteful applications.

Re: Taking PHP Seriously [pdf]

#33
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…

You say MVC is a bad idea and yet you complain that php encourages mixing of things? I follow MVC and just ported a fairly large django app to php. Using smarty, I barely had to touch the Django templates. They worked almost out of the box. So if you think Django templates and structure is fine, let me tell you you can get a very similar set up using codeigniter and php.

Re: Taking PHP Seriously [pdf]

#34
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.

I'm going to say it, better documentation. I don't know, maybe it's just me, but I find it takes me significantly less time do find out how to do something in PHP, or a PHP library than in the corresponding Python. Though, there are obviously exceptions to this.

Re: Taking PHP Seriously [pdf]

#35
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 awesome programmers than languages such as python.

Re: Taking PHP Seriously [pdf]

#36
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…

> I've also hacked up a bunch of open source projects (wordpress, joomla) … > 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. … > I should be able to test your app's interface without having a database.

So the answer is No, you don't have any experience with professional PHP, and you haven't used it in more than half a decade. Could have just said that.

Re: Taking PHP Seriously [pdf]

#37

Earlier quoted context omitted.

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?

Ever notice how everyone who complains about PHP are usually complaining about WordPress, Joomla, or other such apps?

Re: Taking PHP Seriously [pdf]

#38
post #17

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.

Things like this and some interesting developments from Facebook concerning them are mentioned in the presentation, so it would be nice if people would actually discuss that. Just a suggestion.

Second this -- it's not only mentioned, they talk about a path to addressing this and other problems.

Re: Taking PHP Seriously [pdf]

#39
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.

I don't think it's less of a hassle than PHP, but in the context of web development, it is. In PHP, your development environment is often very similar to your production environment.

I think the primary difference is PHP is web first: it was designed to be a language for the web above all. Everything else is tacked on. On the other hand, Python is useful for a whole array of problems and a website is just one problem you can solve with it.

Re: Taking PHP Seriously [pdf]

#40

Earlier quoted context omitted.

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?

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.
Post reply on HN