News for hackers. Stuff that matters.
Re:PHP needs a vision by kjackson2012 on Wednesday January 09, 2013 @08:44PM (#5034784)
I come from a C++ background, and early last year tried my hand at web development.

After hearing about all the stuff about how PHP was an "old", kludgey language, I tried to learn python, and go the webpy. It was doable, but I kept running into issues all the time.

I gave up and switched to PHP, and I have to say that it was a much easier experience. For the most part, everything just worked. Regardless of how kludgey its history is, how inconsistent the syntax is, etc, it really does work well. I'm now doing PHP development at my current job and it's been fine.

One thing I learned from a previous job was the saying "Your customers don't care about your technology. They care about you solving their problems." If you are solving their problems, they will pay you, regardless of whether or not your back-end is CGI, perl, PHP, or whatever.

Re:PHP needs a vision by BenoitEssiambre on Wednesday January 09, 2013 @11:39PM (#5035454)
I don't do much PHP anymore but I can see the appeal coming from a c/c++ perspective. When I was doing PHP I felt closer to the metal than I feel with Python now.

A lot of the PHP libraries looked like thin wrapper over well known c libraries. Instead of shoehorning everything to make it PHPonic, the function calls were similar to their c counterpart. You could sometimes even read the man pages for the c libraries if you needed extra details on how the internals worked.

There was a simplicity to this that was appealing to me. The lesser amount of magic and abstraction meant I could more easily visualize what was happening under the hood and find bugs quickly.

Re:PHP needs a vision by pippy on Wednesday January 09, 2013 @08:58PM (#5034843)

    "PHP Should Be Implementation Neutral, and Support All Paradigms Equally".
This is what I like about PHP. When you want a 4 page site, you can use procedural and functional programming. When you're working on an enterprise level CMS you can whip out the OO paradigm and you're set. PHP is a messy soup but it does web better than most other languages.
Re:PHP needs a vision by taylorbuley on Wednesday January 09, 2013 @09:44PM (#5035037)
One nice side affect of this is that PHP can suit both novice and experienced programmers. Newbies don't have to learn OO before they write Hello World.
Re:PHP needs a vision by nnq on Thursday January 10, 2013 @04:12AM (#5036117)
Yeah, and thanks to this, you end up with a "beast" like Magento, written by "experienced" programmers, and then you have novices tasked with writing themes and components for it, but it doesn't work that way because the "beast" is not "black boxed" well enough for the novices to ignore it. (I keep quoting "experienced" here because the example Magento is just "Java written in PHP" and I'd fire anyone turning up this type of code.)
Re:PHP needs a vision by Corrado on Thursday January 10, 2013 @06:38AM (#5036450)
Having had the unfortunate experience to work with Magento recently, I completely agree with your evaluation. My reoccurring thoughts were exactly "this is Java written in PHP!".
Re:PHP needs a vision by nnq on Thursday January 10, 2013 @08:32AM (#5036728)
Then please spread the word and stop clients/managers from choosing it! Let's stop others from falling into the "look, it even has ebay integration!" trap!
Re:PHP needs a vision by a_macgregor on Sunday January 20, 2013 @11:54AM (#5087355)
Unless you can offer any real alternatives to Magento I have to call bullshit, yes the framework is far from perfect and PHP is not the prettiest language.

But calling Magento "Java written in PHP" without offering alternatives, specific criticism or any backing of the argument is just childish.

Re:PHP needs a vision by laurent123456 on Wednesday January 09, 2013 @10:17PM (#5035161)
That's also a problem because anyone with a day experience in PHP can claim to be PHP developer, and often companies can't really tell the difference between an experienced and non-experienced programmer. If they can do PHP, they can build our website and we end up with horrible unmaintainable code. I think that's why PHP has such a bad reputation.
Re:PHP needs a vision by nnq on Thursday January 10, 2013 @08:24AM (#5036692)
...naah, any kid can learn Brainfuck in a weekend ..."real" programmers don't even need a 100% Turing complete language to get the job done: choose Malbolge instead! (http://en.wikipedia.org/wiki/Malbolge)
Re:PHP needs a vision by drusenko on Wednesday January 09, 2013 @11:13PM (#5035358)
maybe we should all switch to brainfuck for web development then so we can weed out the stupids [/sarcasm]
Re:PHP needs a vision by rybosome on Thursday January 10, 2013 @02:44AM (#5035973)
I get your point, but being easy to pick up AND easy to make dangerous mistakes is a bad combination. The goal isn't necessarily to "weed out the stupids", but rather to prevent bad practices from propagating. "Too easy", in my view, means having a rotary saw with no guard and a hair trigger.
Re:PHP needs a vision by gbog on Thursday January 10, 2013 @02:26AM (#5035927)
PHP suit "experienced programmers"?

In a way this means nothing: experienced programmer can program in any language.

In another way it is wrong: experienced programmer know how so well that building a solid application on rotten grounds is a pain, and would prefer a more solid ground to build their application upon.

Do I need to list again all the mess in PHP?

Re:PHP needs a vision by zaphar on Wednesday January 09, 2013 @09:48PM (#5035055)
No. No it doesn't. It does it easier. That's not the same thing.
Re:PHP needs a vision by neumann_alfred on Thursday January 10, 2013 @04:56AM (#5036212)
When it comes to the web, lower barrier of entry is actually a value in itself.
Re:PHP needs a vision by fleitz on Wednesday January 09, 2013 @08:53PM (#5034824)
PHP works fine as long as you're never exposed to a better way.

In a year or two start using rails. You'll come back to PHP and wonder why anyone would ever make a hammer with two claws.

Re:PHP needs a vision by jtreminio on Wednesday January 09, 2013 @09:00PM (#5034858)
You're confusing a language with a framework.

A more apt comparison is rails with symfony2 or zend framework2.

Re:PHP needs a vision by LaRakel on Wednesday January 09, 2013 @09:23PM (#5034960)
You're right. Still I can compare doing web development using ruby on rails with doing it in php without a framework.

I've done both, rails was much more pleasurable. See? I just compared the overall experience of a language with that of a framework.

Re:PHP needs a vision by jtreminio on Wednesday January 09, 2013 @10:40PM (#5035234)
You just did it again. Why would you compare Ruby on Rails with PHP?

Do you realize what you're saying?

edit: replied to you as if you were fleitz. Point stands as you basically parroted what he said.

Re:PHP needs a vision by citricsquid on Thursday January 10, 2013 @12:51AM (#5035691)
Are the sort of people writing straight PHP the sort of people who would be using rails? Try a PHP framework like Laravel and then compare that to Rails.
Re:PHP needs a vision by fleitz on Thursday January 10, 2013 @01:21AM (#5035774)
I took a look at that, it appears that you unzip the framework and then start modifying it directly. After you "upload it to your webserver". Deployment? Source Control? No, not in PHP, you just modify shit right on the webserver.

I'm sure this process makes upgrading painless, just unzip the framework and... wait... all your changes just got overwritten.

This kind of crap is exactly why everyone with a clue laughs at PHP.

Re:PHP needs a vision by memla on Thursday January 10, 2013 @08:07AM (#5036647)
No. Everyone knows that you do not modify the framework files. Hell, everyone knew that you do not touch the framework system files years ago with older frameworks like CodeIgniter, so it makes me doubt that you have any experience with PHP frameworks at all.

You would upgrade your Laravel framework with composer, which runs on Git. And it'll most likely just work without any "Gem hell" that i've come to experience with some other languages.

Re:PHP needs a vision by fleitz on Thursday January 10, 2013 @03:21PM (#5039496)
Yet the framework docs say none of this. Look at rails, it tells you, put your gems in the gemfile.

Laravel says, hack shit directly on your webserver.

If you're supposed to use composer, why don't the docs say this? Instead the docs say, unzip and hack.

Re:PHP needs a vision by memla on Thursday January 10, 2013 @07:05PM (#5040555)
The docs don't say that you would update the framework via composer (though this may change when Laravel 4 is released) but they do say that you should just replace the "laravel" folder with a new version using whatever method suits you best, which can be even easier. It certainly seems easier than upgrading Rails, since then you can update your whole remote application code and framework in a single push.

The docs clearly explain that your bundles go to the "bundles" directory, controllers go to the "controllers" directory, views belong in "views" and so on. And your whole application resides in a directory called... "application". You'd actually have to be pretty advanced and amazingly stupid at the same time to make a functional app in the framework core folder and than destroy it by overwriting.

Rails docs don't tell me to unzip the framework and start hacking, but they do instruct me to run "gem install rails", wait a couple of hours till it's done, then run "rails new blog", "cd blog" and then start hacking. Neither set of docs tell me how to setup version control before i begin my work, and they shouldn't. That's not the job of the framework docs.

And of course you're gonna hack your application directly on the server, albeit a local one, as PHP applications are typically developed. This in no way prevents you from using version control and proper deployment techniques.

Re:PHP needs a vision by aw3c2 on Thursday January 10, 2013 @02:58AM (#5035999)
Nothing stops you from using source control with PHP. Nothing stops you from working locally and then pushing changes up to the server. You make no sense.
Re:PHP needs a vision by jtreminio on Thursday January 10, 2013 @03:40AM (#5036072)
Wow, you're the type of developer who would leave an absolute mess in his wake.

Everything you said I rail against daily. Stop bringing your bad habits into PHP, we have enough of them already.

Re:PHP needs a vision by tom_m on Thursday January 10, 2013 @12:59AM (#5035719)
You really have to be kidding...
Re:PHP needs a vision by venomsnake on Wednesday January 09, 2013 @08:49PM (#5034807)
The problem with php is that is scales terribly with the size of the codebase. Try to move away from the comfort zone of the language and the size of the project and it changes a lot.
Re:PHP needs a vision by Sander_Marechal on Thursday January 10, 2013 @12:50AM (#5035687)
The opposite, actually. PHP's shared-nothing architecture makes scaling a breeze. Just add more hardware.
Re:PHP needs a vision by mercurial on Thursday January 10, 2013 @09:28AM (#5036981)
I believe you misread parent. The size of the codebase has little to do with the resources needed by the software.
Re:PHP needs a vision by michael_miller on Wednesday January 09, 2013 @08:51PM (#5034818)
If this is the case, then maybe PHP's role is a rapid prototyping language which is replaced when the codebase gets to a certain size.
Re:PHP needs a vision by fleitz on Wednesday January 09, 2013 @08:54PM (#5034830)
Generally that size is not more than about 5 files.
Re:PHP needs a vision by icelancer on Wednesday January 09, 2013 @08:58PM (#5034845)
Yeah good one. Wordpress is a great example of a huge failure written in PHP over 5 files, right?
Re:PHP needs a vision by flyosity on Wednesday January 09, 2013 @09:13PM (#5034922)
The codebase of Wordpress is an utterly terrible, offensive, kludgy, hacked-together mess of spaghetti code. The last time I looked at the internals it still lacked a coherent MVC structure. There are big, good things built with PHP, written the right way with solid software engineering principles, but Wordpress is not one of them.
Re:PHP needs a vision by icelancer on Thursday January 10, 2013 @01:21AM (#5035775)
Yeah, it's very evident in the fact that no one uses it, too. PHP sucks.
Re:PHP needs a vision by krichman on Thursday January 10, 2013 @05:22AM (#5036267)
If number of users was equivalent to quality you would be correct. But it isn't. Under your argument, Wal-Mart is a purveyor of family heirlooms.
Re:PHP needs a vision by jasonlotito on Thursday January 10, 2013 @09:08AM (#5036885)
The number of users is not equivalent to quality. It's an indication of quality.

As for quality...

No, Wal-Mart isn't a purveyor of items with the qualities of being expensive, extremely limited, and old.

Quality is a subjective word, defined by different aspects. Just as I can, with justification, define Apple as a purveyor of low-quality hardware, I can say equally it sells high-quality software.

Re:PHP needs a vision by mercurial on Thursday January 10, 2013 @09:49AM (#5037083)
As you say, quality is defined by a number of factors. I'd say that a good, high-level general purpose programming language should be:

- coherent

- non-verbose

- provide solid high-level abstractions

- safe

- have a solid standard library

- optionally, easy to get started with

Of all these qualities, PHP is geared toward "ease of access" with a sprinkling of non-verbosity, and fails mostly or totally in the other categories. Just like the popularity of the Millenium trilogy does not mean Stieg Larsson can write, the popularity of PHP is more an indication of its low barrier to entry (especially combined with widespread hosting support) than anything else.

Re:PHP needs a vision by jasonlotito on Thursday January 10, 2013 @03:50PM (#5039652)
> Just like the popularity of the Millenium trilogy does not mean Stieg Larsson can write

Technically, it does. =)

I'm surprised you wouldn't consider the license a language is released under as one of the factors. Or maybe you do, and you forgot to list it. And therein lies the issue: the number of people are indicative of certain qualities, qualities you might not consider important, or might not weigh as highly as other people.

I love erlang, but I'd be hard pressed to use erlang for as many projects as I would like. Not because of failings of the language itself, but because certain qualities it does not possess (ubiquity for one, which affects so many other areas).

Re:PHP needs a vision by krichman on Thursday January 10, 2013 @09:29PM (#5041024)
It's not even an indication of quality, it's an indication that many people use it.

I guess you can quibble about definitions all day if you like, and you can take "family heirlooms" literally instead of metaphorically as it was intended, but that won't make Wal-Mart a seller of quality items nor will it make PHP a well-designed language under any sort of definition that is relevant to reality.

And, honestly, if the only thing we're going to argue about is whether or not quantity equals/implies quality and the definition of "quality", the argument against PHP has already won.

Re:PHP needs a vision by jessedhillon on Wednesday January 09, 2013 @09:05PM (#5034878)
Yes, it is a "good one." Wordpress' source looks like spaghetti with shit sauce. The fact that it runs is a testament to something, but not the readability, maintainability, or usability of the code base. Those people wouldn't know a well-designed API if, well, fill in the rest here.
Re:PHP needs a vision by icelancer on Thursday January 10, 2013 @01:22AM (#5035776)
Good point. Must be why no one uses it.
Re:PHP needs a vision by jessedhillon on Thursday January 10, 2013 @01:47AM (#5035843)
Whatever else you are, you're not too stupid to see what's wrong with this argument. So the fact that you're forwarding it anyway means you can't make a real point, or you are trolling.
Re:PHP needs a vision by twodayslate on Wednesday January 09, 2013 @10:34PM (#5035216)
Re:PHP needs a vision by davidlumley on Thursday January 10, 2013 @01:45AM (#5035832)
Facebook _doesn't_ run PHP. A large portion of it is coded in PHP, but it runs C++ through HipHop[1]. Facebook may as well be written in anything that compiles down to C++.

1: http://en.wikipedia.org/wiki/HipHop_for_PHP

Re:PHP needs a vision by memla on Thursday January 10, 2013 @08:25AM (#5036696)
Actually, the difference between compiled C++ code, and the newest version of PHP with APC/Xcache is not that drastic, but facebook needs to squeeze out every bit of performance so they can to cut down on the number of servers.

For what it's worth, PHP 5.4(without APC) performed better than both Python and Ruby on that language shootout page: http://benchmarksgame.alioth.debian.org/u64/which-programs-a...

Re:PHP needs a vision by anu_gupta on Thursday January 10, 2013 @08:17AM (#5036672)
By that standard, anything may as well be written in a language that eventually results in machine code being executed.
Re:PHP needs a vision by Joeri on Thursday January 10, 2013 @02:48AM (#5035983)
Actually, facebook is moving to a JIT model and getting better performance out of it than the crosscompiled code.

http://arstechnica.com/business/2011/12/facebook-looks-to-fi...

Re:PHP needs a vision by shawn-butler on Thursday January 10, 2013 @06:50AM (#5036476)
If you have experience in c++, I have used Wt [0] previously for webdev and found it pretty straightforward (it's like Qt for the web) and extremely performant. Dual license GPL/commerical.

[0]: http://www.webtoolkit.eu/wt#/features

Re:PHP needs a vision by rplnt on Thursday January 10, 2013 @07:11AM (#5036516)
> everything just worked.

That's the scariest thing about the language. The php will run whatever you write in the script; assuming things, hiding errors, etc..

Re:PHP needs a vision by jtreminio on Thursday January 10, 2013 @09:05AM (#5036870)
It sounds like you've never properly programmed in php a day in your life. Stop spouting nonsense. If you're going to develop in php, you do so in strict mode with all errors turned on. Doing otherwise makes you part of the problem.
Re:PHP needs a vision by TylerE on Thursday January 10, 2013 @09:29AM (#5036986)
I'll accept this argument when PHP starts shipping with sane defaults. It's only quite recently that register globals got turned off in the default config.
Re:PHP needs a vision by jtreminio on Thursday January 10, 2013 @09:42AM (#5037046)
Global registers were deprecated in 5.3.0, and completely removed in 5.4.0

http://php.net/manual/en/security.globals.php

5.3.0 is 2 and a half years old.

Re:PHP needs a vision by TylerE on Thursday January 10, 2013 @09:55AM (#5037125)
and many shared hosting providers are still on 5.2, and many crappy old scripts require register_globals on.
Re:PHP needs a vision by shakesbeard on Thursday January 10, 2013 @10:55AM (#5037566)
And that's PHP's fault? It won't affect you if you start writing a PHP 5.3 (or even 5.4) app today.
Re:PHP needs a vision by TylerE on Thursday January 10, 2013 @11:20AM (#5037762)
Yes, it is PHP's fault. It's endemic to the general attitude of the PHP team.

"Now just marginally less braindead than every other language" isn't exactly a selling point.

Sure, it used to be worse, but I see zero commitment from PHP to actually make real steps to fixing the situation. A real first step would be to start working on a 6.x release that actually removes the gazillion deprecated-but-still-present-and-thus-used things in the language.