14 ms·
PHP needs a vision
- cies 14y agoToo late if you ask me, let me explain: Programming languages are hard to change, very hard, because it will certainly break programs written in it in many places. So if you want a programming language with a vision you should start with it, or simply accept it has no vision and it merely goes with the whim of its maintainers. The latter is what I believe happened to PHP. No biggy, there are plenty of languages that do have strong visions and are very suitable for web-development; just move on. If PHP was to implement a vision, it would soon not be PHP anymore, whether that is a good thing is up to the users of that language. In that case I foretell a hack of a lot of porting effort and a fork (facebook?)... :)
- nikic 14y agoPHP has changed a lot over time. It moved from a C-style procedural language to very Java-esque object oriented language. "PHP" hasn't been "PHP" for a long time already. It's always hard to do large language changes, but it's not impossible. E.g. consider the change that PHP did from version 4 to 5. That was a pretty major paradigm shift, with lots of broken code, but it worked out well in the end :)
- 10098 14y ago> It moved from a C-style procedural language to very Java-esque object oriented language The funny part is, it did not make things better.
- cies 14y agoTo me the OO features of PHP have always felt 'bolted on', yet Java is OO from-head-to-toes. It only emphasizes my point: unlike a startup, a programming language cannot pick/change vision when it is a grown-up.
- objectified 14y agoProbably because they were in fact "bolted on". Saying that Java is OO from head to toes, I can't agree with. Java has primitive types as well, and not everything is a first class object (like methods). Python is more OO in that sense, for example. In a sense, Java is having trouble incorporating modern features in the language too. Just take a look at how generics are implemented, and the endless closure debate.
- cies 14y agoPython? Try to subclass an int in Python, and see that it is not as OO as you think. Ruby is more OO then Java for the reason you give, still there are primitives but they have a thick OO-coating so you are less likely to notice they are 'different'. Try subclassing a Fixnum -- it works! But Fixnums have no 'new'.
- VMG 14y ago> PHP has changed a lot over time. Mostly in the way that stuff was added.
- Tichy 14y agoPHP needs to die Sorry...
- jtreminio 14y agoEmpty, non-contributing comments like yours that appear in every single thread about PHP on HN need to stop being posted. Not sorry, I mean it. Stop.
- benatkin 14y agoYour comment made me curious about it and I see that Tichy has about 15K in karma. If he and a hundred people like him quit HN it would probably fix a lot of what's wrong with it.
- josh2600 14y agoThis is irrelevant and does not add to the discussion. Just like Reddit, Karma is not intended to say "my voice has more weight than yours". Karma is a way of letting people know you agree with them, but, just as in a court of law, if you can find one person willing to speak the truth they can stand strong in a house of lies. Long and short, PHP is going to continue for some time, (just like COBOL, just like assembly) and wishing it was dead is about as effective as a life-savings program subsidized by the Tooth Fairy.
- Tichy 14y agoI got curious, too. The last comment you made before this one was this: https://news.ycombinator.com/item?id=5008026 https://news.ycombinator.com/item?id=5008026 Very constructive :-)
- justizin 14y agoQuestioning the value of a technology which inhabits the technology industry much like a cancer is not empty. PHP needed a vision 15 years ago. It was originally called "Personal Home Page" and intended to only slightly extend the functionality of Server-Side Includes. People tend to forget that.
- saraid216 14y agoStas responded here: http://news.php.net/php.internals/64775 http://news.php.net/php.internals/64775 "PHP's vision is being simple and practical and focused on the web. PHP is what people use to get their first site off the ground. PHP is what a web designer learns when he/she wants to go into programming. PHP is what a random Joe uses when he needs to whip up a page and he's in "do it yourself" mind. PHP is what you expect everybody to be able to handle, and everything to be able to run. It is not to serve everybody, every use case and every possible need." Frankly, I don't understand this vision at all. Is PHP supposed to be a beginner's language that a webdev eventually moves on from? I mean, don't get me wrong: I used PHP for exactly that when I graduated from high school. But is the directive really, "Real programmers don't use our language"?
- herge 14y agoPython has often been called an easy to learn language and a good first start because it tries to be easy to read. Does that mean that it is also a beginner's language that people eventually are supposed to move on from?
- TylerE 14y agoThe difference is that Python is actually a designed language, rather than an unholy congealed mass.
- spdy 14y agoPeople who pickup Python will always stay and never move on completely. My programming carear startet with perl -> php -> python and i found one holy grail to solve most of my problems. Python had an easy entry point the same as PHP but when you jumped over the first learning curve and discovered the complete ecosystem it`s mindblowing. I never had that feeling with PHP you could do websites and thats it. And most of the time it gets a mess real quick. PHP will slowly phase out over the next decade.
- jspthrowaway2 14y ago> People who pickup Python will always stay and never move on completely. To be blunt, that's not universally true. I've moved on to Go, with an eye for more functional languages this year. Python is great, but it's not the last language.
- h2s 14y agoThat closing appeal to deal with the abusiveness of the php.internals list fell a little flat given the opening statement of "shut up". I loved Rasmus' answer to this though. http://news.php.net/php.internals/64771 http://news.php.net/php.internals/64771 > The vision has been the same for years. A general purpose scripting > language with a focus on web development. You are simply saying you want > the vision to be more specific than that because everyone has a > different view of what web development means. But even if we narrow the > vision, it will still be open to a lot interpretation. We try to strike > a balance between the different and changing views of web development > the same way we strike a balance between appealing to weekend warriors > and top-100 trafficed sites. No vision statement is going to answer the > question of whether annotations should be in docblocks or in the core > language. That's simply not what vision statements do. > > -Rasmus Maintaining clarity of purpose in a project can be difficult sometimes. Kudos to Rasmus for managing to do so in the midst of what looks like it's gearing up to be another php.internals shitstorm.
- cies 14y agoPersonally I find nothing much 'general purpose' about PHP. The language has configuration files! That alone prohibits me from doing anything generic with it. So all that's left for me is 'focus on web development'. And to be honest: I think today it is not even so good at that. We have server side JS (Node), Ruby, Python and Java -- all freely available with huge communities. Does PHP stack up against these today? I sure see that back in the days, when cgi scripts in Perl were the norm, PHP had huge advantages over its direct competition in open source web dev land. To me Rasmus merely underlines the lack of vision, or ability to act on one.
- cies 14y agoOn a more positive note: I think the Symfony team actually has the vision: provided it has to be with PHP, let's make a full stack web development framework (like Rails) that does not suck, and create heaps of interesting components/libraries that can be used perfectly on their own in the process! These guys and girls are showing to what extend PHP can be pushed, they also build a fair share of general purpose libs that the PHP community badly needed (e.g.: composer). It you are looking for PHP with a vision, line yourself up with Symfony: they seem to have it. Jokingly: If web development is what PHP is useful for, then Symfony simply needs to be shipped with it :) Plenty of vision is communicated from their site, and it all makes sense: http://symfony.com/symfony-at-a-glance http://symfony.com/symfony-at-a-glance http://symfony.com/elevator-pitches http://symfony.com/elevator-pitches
- TazeTSchnitzel 14y agophp's internals mailing list is chaos. It's a pantomime of "YES-NO-YES-NO-YES-NO" ad nauseum. And that is why PHP is such a horrible, inconsistent language. It has never had any consistent direction. JS was bad at first, but its mistakes are slowly being corrected and it is become more consistent and coherent. PHP was bad at first, and they keep breaking things as well as improving it.
- deleted 14y ago[deleted]
- jfaucett 14y agoI couldn't agree more, and I'm a fan of PHP. It's a swiss army knife of a language, allowing you to program however you want. C programmers can code procedurally and java guys can jump in and basically go all out with the OOP constructs provided. I've watched PHP get better over the years, and it continually does so, but after having switched recently to Ruby, I have to say a solid "Benevolent Dictator" would probably not be such a bad thing for the language. Ruby has its paradigms, its own way of doing things, and you frankly can't develop software in many ways PHP allows you to, but for me Ruby is still a much more succint and beautiful lang, one I enjoy programming in more, I think partially because it has this, a set way of thinking about software design. I mean unit tests are in the stdlib for example, and you can't program long in the language without using utils, gems, etc, that all are chalk full of test suits that pass. IMHO, a programming language should not just focus on itself or whether it has such and such feature, but on how it can be used in the entire software development cycle. This is something Go and Ruby are doing exceptionally well, and is why I like using them so much to build software, whether its web or otherwise. Probably because of its history as a template language embedded into HTML (way back when :), PHP has still got some growing pains in order to build up its software development paradigms, but I'm still hopefull, it has gone amazingly far and continues to improve.
- fleitz 14y agoIt has lots of vision, what it needs is a janitor.
- verelo 14y agoSome of the statements there such as this really disappoint me. "PHP is what people use to get their first site off the ground. PHP is what a web designer learns when he/she wants to go into programming. PHP is what a random Joe uses when he needs to whip up a page and he's in "do it yourself" mind." PHP is a great language in that its very flexible and quick to get going with, the sad thing is people don't want it to grow up...after all, so many massive companies (FB?) use PHP for core components. Why can't those internally have a slightly larger vision...
- lucasmullens 14y agoFacebook hates PHP, but it would be too expensive to convert their 3 million lines of code. They just use HipHop to compile it to C++.
- verelo 14y agoA totally reasonable reply (kind of expected someone to say it!) but the fact that they use php (despite the use of HipHop, which is a wonderful innovation) does say something about the language. It just makes me sad that rather than saying "look what php can do with some work!" and doing something to head in a direction that could make some of its power uses (like FB) love/like the language, the people in charge simply seem to not care. A better positioning would be saying something like "php is a great tool to start a web project in, and over time it'll continue to be the best tool to start a project in by helping people innovate even faster." Building it into boxes and decouple it from the rest of the code down the road, like FB have, is likely what most people will do, but at least saying PHP strives to fit this need would be a better vision than saying its for "Joe's weekend website", when clearly that's just shortsighted. Saying what you're going to do in a public place does increase your chances of following through with it. PHP should document something that says what they want to be, even if its not what some people want them to be!
- fizz_and_buzz 14y agoThey are actually phasing out the HPHPc translator and are now developing, as far as I can see, a more conventional one, which translates php into bytecode and can perform JIT on the bytecode into native code without going through C++.
- programminggeek 14y agoPHP is for webdev. That's it. Go outside the bounds of that and it loses its magic. On its own it's great for spitting out a webpage. It's a scripting and templating language in one, which is kind of cool. That said, outside of that to make PHP work on bigger projects you end up with a lot of structure and ceremony that make PHP suck, not quite as much as Java, but it's not amazing. Thiings like testing and testability aren't much fun in PHP. For a long time package management was a joke. PHP is for webdev. That's it.
- dave1010uk 14y agoI'm curious: how is testing/testability in PHP different to make it less fun than other languages?
- jtreminio 14y agoIt's not. PHPUnit and dependency injection make it dead easy to mock objects and make testing stupid easy.
- objectified 14y agoI can't agree with that. Personally I happen to use PHP not for web development, but almost exclusively for system administration and monitoring (I'm not a web developer). It's very comfortable using PHP in these areas, as: - PHP and many of the PHP extensions are packaged for about every major OS and architecture - a lot of functionality is already shipped with the interpreter (so no additional stuff necessary) - it's very easy to deploy We've tried a number of options, especially in the monitoring area, but PHP eventually seemed to be the most suitable for the job.
- lmm 14y agoDeployment is "easy" because you just copy a bunch of files, right? Reproducible deployment takes a little more effort, but it's well worth it when the time comes to upgrade a server, or a pipe bursts on top of your existing one. Python has your other advantages, quite a lot of existing monitoring software, and is a far more pleasant language to program in.
- blantonl 14y agoI think PHP (5.x/6x) is still applicable to any developer, new or old, experienced or not. Many of us cut our teeth on PHP's simple scripting concepts, and that shouldn't change. And from what I've seen from past history, it won't. There is a tremendous amount of backwards compatibility in current versions of PHP that allows one to follow the same approach to Web development that those did back 10-15 years ago with PHP 4. No, it is not "Enterprise", and yes there are security considerations to account for. But the process of adoption is key, and PHP continues to be adopted by a lot of startups/projects. Those that choose to adopt the PHP language as their advanced vernacular moving forward still continue to have a number of more advanced programming language concepts to utilize in PHP with each new release, with barely any breakage with other approaches to using PHP.
- kysol 14y ago"Many of us cut our teeth on PHP's simple scripting concepts" -- The Gateway Drug :D I went Perl -> PHP and have been there ever since. Not because I'm too lazy to learn another language, but because it has done everything that I have needed it to do, and when I found something that it couldn't, I looked elsewhere for that one aspect of the project. Isn't it our role as developers to push the boundaries of our chosen language? I'm pretty sure back when Javascript was being thrown around, they wouldn't have imagined what it is today. Trying not to sing praises, and throwing fuel on a fire that should have died a long time ago... To each their own.
- polemic 14y agoWorthwhile reading the email that preceded it: http://news.php.net/php.internals/64763 http://news.php.net/php.internals/64763 The response hardly seems warranted. The vision is pretty stated there.
- ircmaxell 14y agoThe response would seem warranted if you had been a participating member of the PHP internals list for any significant length of time. Stas is pretty well known for jumping into threads and completely derailing, and shooting things down with BS like "PHP is not Java, stop trying to make it into Java". The response is a culmination of a long time of watching him respond in such a fashion. Stuff like this: http://marc.info/?l=php-internals&m=135083835232016&w=2 http://marc.info/?l=php-internals&m=135083835232016&... Sometimes he contributes to discussions in a very positive manner. But too often he degrades the discussion into BS rhetoric and greatly demoralizes contributors (I know I am not the only one to voice disdain, I may just be the first publicly)... I guess you can say I just had enough...
- olleicua 14y agoI think this may be too optimistic. It seems to me that PHP's lack of vision has already made it a horrifically bad language. The problem is not that it tries to do OO while also not really trying to do OO (don't get me wrong though, that is a problem). The problem is that it tries to do OO like Java. Get with the times and learn Ruby already.
- jaequery 14y agoit's true, php core devs have some kind of a Java OOP/DP fetish. maybe because they think Java is enterprise so they should replicate what works for them.
- kjackson2012 14y agoI 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.
- venomsnake 14y agoThe 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.
- michael_miller 14y agoIf 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.
- fleitz 14y agoGenerally that size is not more than about 5 files.
- icelancer 14y agoYeah good one. Wordpress is a great example of a huge failure written in PHP over 5 files, right?
- jessedhillon 14y ago
- venomsnake 14y agoYou want a vision? Here is one - make the mess we have at the moment work. I write in php for the better part of 4 years now and hate it every day. And I have written in c++ before that. Ask 20000 developers what are their main pain grievances sort them by "popularity" and just remove them one by one. For me it is the hard debugging, the include mess and the "extremely" creative ways parsing and runtime errors are communicated to the developers.
- jtreminio 14y agoYou seriously find PHP hard to debug? I wrote something that may help you : http://jtreminio.com/2012/07/xdebug-and-you-why-you-should-be-using-a-real-debugger http://jtreminio.com/2012/07/xdebug-and-you-why-you-should-b... Thanks to namespaces, PSR-0 and Composer, I no longer have to worry about "include mess". Use an autoloader, that's what it's for. If you're finding you have to include a file to access information in it, that tells me you're not testing your code. The only error I've run across that gave me pause, for a second, was the T PAAMAYIM NEKUDOTAYIM. A quick, 5 second Google search gave me the information I needed.
- deleted 14y ago[deleted]
- deleted 14y ago[deleted]
- phatbyte 14y agoIt's not hard at all, I even created an Xdebug client for OSX to simplify this, www.codebugapp.com
- bunwich 14y agoI have $20. $10 to two PHP BDFL's kickstarters that are willing to take on the responsibilty of improving the language and removing the inconsistencies. 1) No one from Zend or Rasmus can apply. 2) facebook - would love if you guys forked it, but you don't need my money.
- jahitr 14y agoSwitched PHP for JS. Never looked back. Seriously, It needs to die.
- nunbot 14y agoit needs a relapse. dont do shit because its popular, do it because its useful!
- towski 14y agoSo does Perl
- rmoriz 14y agoThey should hire DHH for 10.000$/day. I'm sure he can help.
- dexcs 14y agoGlad i searched before posting exact the same. Don't forget matz in this context...
- nnq 14y agoPHP has never been about the "language" as far as I see (hell, it was a templating system "evolved into a language"!), but about the platform (language + libraries + server + tools and what this meant for deployment and scaling). PHP (the LAMP "web development platform" that happens to include the PHP language) got so popular because: 1. ease of deployment 2. ease of scaling 3! KISS by keeping the layers of abstraction few and thin (at first it was just a thin "templating" layer to reach the functions in C libs) Only (3) has anything to do with the language itself, and is the only one the could translate to a language "vision". If PHP were to remain true to itself and its advantages that made it what it is today, their vision can only be to keep the layer of abstractions few and thin and this can only mean 2 and 3 from the OPs rant: procedural, functional and multi-paradigm enough to support OO (I know, people don't write functional code in PHP but I think they should - it really helps with KISS once you go over the "procedural brain rot"). P.S. As a developer I hate PHP (viscerally, passionately, religiously and in all other ways imaginable)! As a manager I absolutely love the "fail cheap, fail fast" philosophy and PHP is one of the few languages that enables this "flow".
- deleted 14y ago[deleted]
- kamme 14y agoWhenever this issue pops up I always imagine Fabien Potencier (while he's no dictator, he has a very clear path) taking over the php source and change it according to his vision. Then I imagine going back to the first php script I ever wrote and how if I would have been able to create it with the changes. I can honestly say I can imagine it would have been a lot harder to do and there is a big chance that I would have given up because I can imagine him going into full OO mode. Don't think I don't like Fabien, for me personally his php version would probably be a lot better, but also a lot harder for new users. This is one of the best things of php: it's easy enough for new developers and you can grow into the OO aspects of it. While I must admit I would also like a big cleanup to make the function names and arguments more uniform, I don't hope they change anything that makes it harder to begin with php or limit the possibilities to grow.
- dirktheman 14y agoWow. I must say I'm surprised (not in a good way!) by the lack of quality of a number of the comments here. I already knew that PHP isn't the language of choice of cool programmers, but at least they make some sort of informed decision. Some of the comments here ("PHP must die!" and "I use Rails" or "I switched to JavaScipt") really show a lack of understanding about even the most basic concepts of PHP, or programming in general. I'm the first one to admit that PHP has its flaws, but that's not to say that other languages are perfect, or 'better'. PHP is a Frankenstein's monster, and no matter the quality of body parts you schlep onto it, it will probably still work. Ruby on the other hand is stricter, more consistent. If you're new to programming you can hit the ground running with Ruby (especially with the Rails framework, but if you're new to programming, would you even know how a framework relates to a programming language?). But if you want to go beyond a simple CRUD-app, Ruby poses a lot of challenges that can be hard to solve whereas PHP, well, just works. My point is: you pick the right tool for the right job. For a lot of people, the right tool is PHP because it's the only thing they know. That's not PHP's fault, now is it? This kind of thinking reminds me of the clash between Apple fanboys and Fandroids: to each their merits, but you can't seriously state the one's perfect and the other one is utter rubbish. Wether you like PHP or not, it's still: a) the most popular programming language b) the programming language with the most job openings (Source: http://www.udemy.com/blog/modern-language-wars/ http://www.udemy.com/blog/modern-language-wars/) This has to count for something, right? So please, for the sake of keeping HN a decent place, refrain from using non-argumented statements like 'PHP must die'. You're not adding anything to the discussion and you make yourself look like a fool. As for the 'vision of PHP': I'm glad there is none. It's the gateway drug to a lot of programmers, and I'm sure that I would have given up on programming if it weren't for PHP. When I look back on some of the stuff I wrote some 10 years ago I just want to cry, but that does show that I've grown as a programmer. It's perfectly possible for people to start out with PHP and evolve to good programmers, regardless of language used. A stricter defined PHP would just kill that.
- tsewlliw 14y ago> But if you want to go beyond a simple CRUD-app, Ruby poses a lot of challenges that can be hard to solve whereas PHP, well, just works. I write PHP professionally. I like PHP programmers. I'm starting to have a soft spot for PHP. PHP and its standard library are a minefield.
- phatbyte 14y agoPersonally I think PHP has a bad rap for two reasons: First: Community like HN and such, have lot of good and smart people, however, lots of us are what I like to call "tech hipster", they like to always brag about how they prefer some new-shiny language/framework whatever, as if that means they know more than the average developer. Like an hipster when it comes to some underground-indie-band. It's pretty fun to see this, I laugh quite a lot TBH. And because of this PHP is looked upon as a mainstream language, like POP music, always number one on the charts, always on the frontpages, but like POP it lacks quality, good taste and so on (what some people think at least). So, many of us, just hate PHP cause it's POP and using a POP language is cheesy and lame...whatever...and they just hate PHP because they read someone else's saying it sucks. eg: "PHP sucks, because I use X" Second reason: Other people on the other hand, have really fundamental reasons to dislike PHP, however, I noticed that a lot of these people haven't used PHP since version 4, and they are completely out of the current state of PHP. I don't mean everyone, but most of them do. I'm not a PHP fan or anything, in my work I have to use it, although I really wish I could use Python, but I can't. So, instead I try my best to use it in the best way I can. I'm currently using Symfony2 framework, which brings a lot of good web dev practices into PHP world. I'm looking at Laravel as well. To be, most people still think PHP developers use a PHP as a single file where they put PHP function on the top tof the file and html at the bottom and such...and if you a good developer you can really make PHP shine these days, because there a good tools and frameworks out there.
- dirktheman 14y agoNice analogy with the indie/mainstream pop, and I couldn't agree more with the techno-hipster with their 'cool' underground languages. PHP is still the bread and butter of the web, wether you like it or not. I can really recommend the Laravel framework, it's quite elegant!
- TheEmpath 14y agoPHP would do well getting proper weak references in play, regardless of vision. No easy task at this point, sadly :( More specifically: Put in proper weak refs -> get lexical scoping -> get first class functions.
- deleted 14y ago[deleted]