Live data from Hacker News

Stack Overflow: Defend PHP - convince me it isn't horrible

stackoverflow.com

21–30 of 74 posts

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#21
To answer to the topic of the post - why should I (or anyone else for that matter) bother trying to convince the author that PHP isn't horrible.

If the author does not think that PHP is suited for his/her needs then he/she should not use it. There is a plethora of programming languages out there - pick and choose.

The post has a disconnect between the title and the content. The author does not want to use PHP and tries to outline the flaws in the language from his/her own view. Sorry to disappoint, but I disagree with those points. I use PHP amongst other programming languages and I use it only when it suits my needs and the needs of my project. It is not perfect but then again nothing is.

Final thought for the article would be a paraphrase of its title as a reply:

Defend 'behaviour'. Convince me it isn't spelled horribly - correct spelling 'behavior'.

I think you get the point :)

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#22
post #4

PHP is great if you need to get some small thing up and running yesterday. PHP is also great if an out of the box solution will almost fit the bill due to the fact that there are so many. Just take a box and do some small modifications, voila, done!

Like someone else already said, "small thing"... like Facebook? Like Flickr? Like Wikipedia? Like Digg? :)

Somewhere I read a quote that went "if you take the top 100 most popular websites on the internet... 90 of them use PHP". I don't have the source and I don't know if it's still true.. but you can add Yahoo, WordPress, PhotoBucket, SourceForge, etc...

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#23
post #20
post #19

From a programming language perspective, PHP is somewhat horrible (PHP 5.3 less so, but still). I guess nobody will deny that. But from practical perspective, PHP is very suitable tool for many tasks and has huge ecosystem behind it. Complex real-world websites and applications have been successfully built with PHP. Isn't that proof enough? Do you consider yourself a purist or pragmatic? In the latter case, PHP may b…

"Complex real-world websites and applications have been successfully built with PHP." Thanks to PHP or in spite of PHP?

:-)

Seriously, I like the photographing analogy: "Wow, what a photo you have taken! You must have really good camera?"

A programming language is rarely the limiting factor. Skillful programmer may benefit from advanced language, but mostly it's about knowing your tools and the bigger concepts, regardless of the language. Try yourself and learn to master something you like most. (My current choice being Python.)

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#24

To answer to the topic of the post - why should I (or anyone else for that matter) bother trying to convince the author that PHP isn't horrible. If the author does not think that PHP is suited for his/her needs then he/she should not use it. There is a plethora of programming languages out there - pick and choose. The post has a disconnect between the title and the content. The author does not want to use PHP and tri…

My friend Anthony Lewin and I were Macintosh salespeople back in the Dark Times when Jedi Master Jobs was in exile. People would walk in to the store and ask the same question:

    Convince me: Why should I buy a Mac instead of a PC?
Anthony quickly learned not to feed the trolls. He would say "I don't know. Why would you buy a Mac instead of a PC? Most people buy PCs. What's so special about you that you need what a Mac has to offer?"

The genuinely curious would explain about their graphics needs or what-not, and Anthony would go from there.

I think of Anthony when I see questions like this. My response back to the OP is to ask Why should you use PHP? What's so special about your situation that you need it?

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#28

To answer to the topic of the post - why should I (or anyone else for that matter) bother trying to convince the author that PHP isn't horrible. If the author does not think that PHP is suited for his/her needs then he/she should not use it. There is a plethora of programming languages out there - pick and choose. The post has a disconnect between the title and the content. The author does not want to use PHP and tri…

My friend Anthony Lewin and I were Macintosh salespeople back in the Dark Times when Jedi Master Jobs was in exile. People would walk in to the store and ask the same question: Convince me: Why should I buy a Mac instead of a PC? Anthony quickly learned not to feed the trolls. He would say "I don't know. Why would you buy a Mac instead of a PC? Most people buy PCs. What's so special about you that you need what a Mac…

/bow to the last sentence :)

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#29
post #6
post #3

I'm not a PHP advocate, but I'll take this one: PHP encourages (practically requires) a coupling of processing with presentation. Yes, you can write PHP that doesn't do so, but it's actually easier to write code in the incorrect (from a sound design perspective) manner. The ideal web application is the one that best fits the unique characteristics of the data being manipulated. When exploring how a web app should wor…

> When exploring how a web app should work, you should be thinking at all levels: view, controller, model. And separating those aspects programmatically makes it easier to think about them, not to mention program the ideas that occur to you when thinking about them separately. > If those generic tools are the best ones for the data model being manipulated, why involve a programmer at all? If intertwining essentially…

The explosion you speak of is sites making better use of JavaScript, a movement that took off with the launch of gmail in 2004. Paul Buchheit talks about the thinking and communication that created gmail. He doesn't mention MVC; he talks a lot about rapid prototyping. He shares some of his then-current thinking in the form of a single 600-line source file. Read the post: http://paulbuchheit.blogspot.com/2009/01/communicating-with-...

EDIT: HN discussion: http://news.ycombinator.com/item?id=444615

Re: Stack Overflow: Defend PHP - convince me it isn't horrible

#30
post #3

I'm not a PHP advocate, but I'll take this one: PHP encourages (practically requires) a coupling of processing with presentation. Yes, you can write PHP that doesn't do so, but it's actually easier to write code in the incorrect (from a sound design perspective) manner. The ideal web application is the one that best fits the unique characteristics of the data being manipulated. When exploring how a web app should wor…

Let me take this in a slightly different direction.

The problem with paradigms (such as MVC, ORM, and OOP) is that no one paradigm is perfectly suited for all problems, but people tend to forget that.

(Why do they forget? Because there are advantages to picking one set of paradigms and focusing on them to the exclusion of all others: It focuses your toolkit development and your documentation and makes the story of your platform easier to tell. Thus, we have systems like Rails, where everything from Hello, World on up requires at least passing knowledge of MVC and objects, and the whole system is designed around the assumption that you are building an MVC web app, using an ORM with a certain standard layout, placing files in standard locations, et cetera.)

Unfortunately, there is one very important class of problem that most frameworks are ill-suited for: Very, very simple programs. Programs like the ones you write when you're new. Like a one-field "sign up for my mailing list" application, or a "guess the number between 1 and 100" application like the one I rewrote dozens of times in my Applesoft-BASIC-tinged youth.

PHP offers the new programmer the simplest thing that could possibly work. You edit your HTML file, sprinkle a line of PHP into it, and save it with a .php extension, and (assuming your $5/month web host set up Apache correctly) lo, you have a web application!

But you won't get any distance into (e.g.) Rails before the books and the docs insist on sending you to school, instead of straightforwardly doing what you want. "We know you want to write a one-page app", say the docs, "but first we'd like to give you a miniature degree in software development. We want to teach you about installing software on a Unix system, and using the command line, and what objects are, and what an ORM is, and what MVC is and why you should care".

Or, perhaps, you will use a walkthrough to generate your Hello, World. You will either use the scaffolding -- e.g. type some mystical incantations that seem to have nothing to do with HTML, or Ruby, or the web, and that have to be done on the command line and preferably not in Windows -- or you will edit multiple files in multiple places to set up your tiny view, and your tiny controller. Then you have Hello, World. To go any farther will require some more training. Budget a day or two to read the book. Maybe buy another book.

Heroku has gone to heroic efforts to remove some of these stumbling blocks, but there's only so much they can do. Rails is a professional tool for professionals. Like emacs, it takes time and determination to learn. And, like emacs, you're not likely to be motivated to learn it until you have cut your teeth on the equivalent of Notepad. But, in web development, the equivalent of Notepad is PHP. None of the other frameworks bother with such silly stuff.

I'm convinced that the big strength of PHP is that new people can pick it up fast. And this strength just builds on itself, all the way up to systems like Drupal. Not only because new PHP programmers gradually become experienced PHP programmers via a steady ramp, but because even an extremely advanced and complex PHP program has many edges -- like the templates -- which inexperienced programmers will want to be able to edit. And they can, because PHP is evolved to be simple and straightforward.

Post reply on HN