News for hackers. Stuff that matters.
Re:PHP: A fractal of bad design by obituary_latte on Tuesday April 10, 2012 @10:08AM (#3822215)
It seems that many people disregard the fact that PHP is a very accessible language to a programming newcomer. You can quickly and easily install LAMP or MAMP and in minutes have a working, dynamic web page (albeit local) along with a plethora of examples and tutorials. This is huge. This shows the newcomer that this mysterious code stuff is actually accessible; that they can create something that works. That's a nice intro to programming.

More programmers===better programs. How can this be a bad thing?

As far as the snobbery goes, to me it just seems like natural human behavior. People need to believe that their beliefs, their choices are the right ones. For some, the easiest way to do that--rather than being honestly objective or introspective--is to degrade what others do.

Re:PHP: A fractal of bad design by acdha on Tuesday April 10, 2012 @11:11AM (#3822517)
I agree with the general point but this seems more of an indictment of other languages than a plus for PHP: with PHP, it's easy to get started with the most simple features - and then it takes years to learn how to cope with the language quirks and inconsistencies, deal with outright bugs, and learn a number of non-obvious ways in which your “working” site might be hacked due to a hidden language feature.

There are two ways in which this could be dealt with: one would be for PHP to have a change of religion by the core developers and start a massive cleanup project fixing API warts, adding placeholders to or deprecating the default MySQL driver, etc. This wouldn't be easy but it wouldn't be especially difficult except that the core developers are usually hostile to suggestions that they fix, or even document, mistakes.

The other would be for other languages to start simplifying the learning process - Google AppEngine is probably the easiest intro of all, albeit with a severely non-standard architecture, Rails.app, etc.

I think a language like Python or Ruby is likely to gain a smooth dev server install before PHP becomes less treacherous.

(Pro-PHP flamers: I started using PHP back in 1999. Your arguments are not new.)

Re:PHP: A fractal of bad design by obituary_latte on Tuesday April 10, 2012 @11:52AM (#3822745)
Yes, that would be great. An alternative intro would be most welcome. It should, though:

- Be able to start and serve in minutes, across most platforms

- Allow for portable code e.g. the code you create locally should be able to be ported over to an actual webhost with only [S]FTP.

- Not require the command line to "work". At all.

I tried to learn django ~a year ago, and it was an experience wrought with frustration and pitfalls. The documentation was so-so, and limited in resources (or I couldn't find it). The main trouble was getting all the packages/dependencies correct. I am quite comfortable with linux and terminal (again thanks to PHP), and though I eventually got it working, I was turned off enough by the whole process that I didn't do anything with it. My accomplishment was that I got it to work, which for me was certainly still worthwhile as I was still learning, but a newcomer would likely have gone back to Facebooking long before that...

What is dangerous about the PHP bashing in my eyes (speaking with some current experience as a newb), is when someone decides to try and learn programming and they google some stuff about PHP and read endless diatribes on how horrible it is. So they go off and try django or RoR, are met with tough situations with little to no documentation; can't get anything to work, and give up all together.

Whether or not PHP is pretty, it is accessible. The divide that is created by language ideology only serves to hurt the community as a whole, IMO.

Re:PHP: A fractal of bad design by kijin on Tuesday April 10, 2012 @02:45PM (#3823735)
I would add low cost to that list.

HN's fascination with cloud computing and massive scalability is not representative of web dev in the rest of the boring world. The vast majority of web sites out there are powered by shared hosting, where the norm is to cram 1,000 sites on a cPanel server. Apache+PHP makes economic sense in this environment because when your site isn't getting any requests, it uses no resources. But if everybody started running a persistent Django or Rails process in the background, or if every customer had to be given a VPS, hardware and maintenance requirements would quickly exceed what the provider can profitably offer.

I can host a small website on NearlyFreeSpeech for $0.30 per month plus bandwidth, even less before they introduced a surcharge for dynamic websites. One of my old clients is hosted on another pay-as-you-go shared host, where she incurs all-inclusive charges of $0.07 per month on average. (The site is mostly static, with a PHP guestbook.) Like it or not, PHP makes this possible by folding the app server into the web server, and a lot of effort has gone into making such an environment reasonably secure without blowing up resource requirements. Even if you use a regular shared host that charges $8.95 per month, that's still cheaper than a medium-quality managed VPS.

The current state of shared hosting might not be anything to write home about, but the low cost (compared to a VPS) allows anybody, including dirt poor students, to run a web site without being held hostage to a less customizable service that might or might not exist tomorrow, e.g. Posterous. I think this contributes to technical literacy and independence in a small but unique way. Any realistic alternative to PHP had better meet the same requirements.

Re:PHP: A fractal of bad design by crag on Tuesday April 10, 2012 @02:15PM (#3823565)
"The main trouble was getting all the packages/dependencies correct. "

This is the one big problem python has; terrible package management. I can think of 3 different package management systems for python. All of them barley work and the various libraries all require different mangers and different python versions.

This package requires python 2.6. This other package requires 2.5. And now we have separate python 3.x packages. Ridiculous.

Re:PHP: A fractal of bad design by kijin on Tuesday April 10, 2012 @04:47PM (#3824340)
Well, to be fair, "package management" in PHP usually means bundling every single package you need with every single app that needs them. Then you upload the whole thing by FTP.
Re:PHP: A fractal of bad design by sedev on Tuesday April 10, 2012 @12:50PM (#3823098)
"(Pro-PHP flamers: I started using PHP back in 1999. Your arguments are not new.)"

See, that's part of the problem. PHP has been terrible for close to two decades. It used to be even worse than what Eevee describes.

Re:PHP: A fractal of bad design by Yen on Tuesday April 10, 2012 @05:09PM (#3824441)
Maybe I'm missing something in your comment here, but - Python and Ruby already have smooth dev server installs. In fact, much smoother than PHP, as you don't need apache or fancy permissions to just run something local.

Ruby, rails: "rails server" Ruby, sinatra: "ruby <sinatra script>" Python, django: "python manage.py runserver"

All of these spin up an app server on some port > 1024. I'm honestly not sure how it can get much easier than that.

Re:PHP: A fractal of bad design by acdha on Tuesday April 10, 2012 @08:41PM (#3825308)
Start as J. Random Noob: they need to install python, virtualenv, etc. before learning how to create a module, create multiple config files and so forth.

Technically PHP isn't much easier if you need to compile it, configure Apache, etc. but in practice they just pay $1/mo for a crappy hosted account where they simply upload a file and start fiddling.

This is a trivial distinction for a professional developer but there are quite a few PHP users who started with a personal homepage and grew from there – and despite the stereotype, they're not all designers, either. That's why I like the Rails.app idea: give today's bright 13-year-old a nice, easy path to getting something visible and let them get hooked before they need to learn all of this other stuff.

Re:PHP: A fractal of bad design by obituary_latte on Wednesday April 11, 2012 @07:44AM (#3827022)
Yeah, sorry I was unclear. In this case I was trying to get it working on a VPS.

The local stuff was indeed nice and simple.

Re:PHP: A fractal of bad design by pratyksp on Tuesday April 10, 2012 @02:12PM (#3823546)
Very low barrier to entry is also one of the reason why PHP ecosystem sucks. More than 95% of PHP programmers never grow up from beginner(at least what I've seen) even after more than few years of use. And those who grow up starts to use other language.

The PHP crowd is mostly filled with "Internet Programmers" [A person who copies code from the internet and pastes in one's codebase, without even reading it, and expects it to work.] And this also applies to all the javascript programmers who can download a jquery plugin and successfully use it in a website.

They even don't know that you can install PHP, apache and mysql separately and use it. For them XAMPP is all there it is, armed with dreamweaver and a ftp client. Most of them will be lost without cpanel.

I've tried teaching a few but all I get is :"go away don't try to be smart in front of me, I know what I'm doing."

Most of you here are smart people. But out there this is what you get from most of the PHP programmers.

Re:PHP: A fractal of bad design by jtc331 on Tuesday April 10, 2012 @03:36PM (#3823984)
Exactly. I don't actually agree that low barrier to entry is a good thing. Languages should be easy for people who've learned them, not necessarily easy for newbies.

That's the real idea with the principle of least surprise. It shouldn't surprise experts. But programming is hard. It's modeling real world processes in the abstract. That's hard. It isn't going to be simple for people who don't know how to program.

Re:PHP: A fractal of bad design by BCM43 on Tuesday April 10, 2012 @10:16AM (#3822240)
More programmers===better programs. How can this be a bad thing?

I'm not sure this is true. Going with the articles example, that's like saying "the more people who know how to use a hammer, the better houses we will have".

Re:PHP: A fractal of bad design by obituary_latte on Tuesday April 10, 2012 @10:19AM (#3822247)
OK, say there were only 2 people working on the (any open-source project). How do you think it would look today?

I think it pretty basic an assumption that the more eyes looking at something, the better the chances of finding (and fixing) mistakes as well as finding room for improvement.

Re:PHP: A fractal of bad design by TylerE on Tuesday April 10, 2012 @12:24PM (#3822949)
It's true in the sense that giving everyone desktop publishing software in the early 90s led to lots of beautiful typography and well thought-out layouts.
Re:PHP: A fractal of bad design by TorbjornLunde on Wednesday April 11, 2012 @07:27AM (#3826946)
I assume that you are being ironic, and you’re right: there was a lot of ugly graphic design in the 90s. This is partially due to the whole grunge-trend…

However: I think today we have more beautiful design that we would have had if the design tools had not become democratized, maybe not in percentage, but certainly in amount.

My speculation: programming --> more programs. Both crap and great ones.

Re:PHP: A fractal of bad design by smokinjoe on Tuesday April 10, 2012 @10:56AM (#3822416)
No, but the more kids who have exposure to an easy-to-get-started language will result in more kids that are actually really into it getting that early start they need.
Re:PHP: A fractal of bad design by smsm42 on Tuesday April 10, 2012 @12:29PM (#3822980)
Are you claiming less people should have access to programming? Should we have a guild with mandatory 10-year apprenticeship in Haskell?
Re:PHP: A fractal of bad design by prodigal_erik on Wednesday April 11, 2012 @04:45AM (#3826561)
That's kind of over the top, but I'd like to see everyone spend their first six months in any language that doesn't hide your mistakes from you by quietly guessing what you might have wanted and doing something random.
Re:PHP: A fractal of bad design by joesb on Wednesday April 11, 2012 @05:24PM (#3829726)
Less people should have access to computer, it will make those who does more competent at programming.