Live data from Hacker News

In many ways PHP is just now starting to come into its own

gist.github.com

101–110 of 133 posts

Re: In many ways PHP is just now starting to come into its own

#101
post #23

I wish people would stop trying to defend PHP against "the haters" - firstly because no amount of reasoned argument is going to change the views of fundamentalists, and secondly because they are a minority group whose opinions are unlikely to inhibit the rise of the PHP ecosystem.

I would argue that the "rise of the PHP ecosystem" has been massively damaged by the amount that has been written about PHP's flaws. An ecosystem needs talented programmers working on open source libraries for that ecosystem, or helping spread best practices.

You don't see much fresh innovation in the PHP community these days - instead, you see developers who work with PHP having to recreate libraries and techniques developed by other languages.

Meanwhile, the Node.js, Python, Rails etc communities are overflowing with talented developers who used to work with PHP and are now busily inventing the future on top of different languages.

Re: In many ways PHP is just now starting to come into its own

#102
post #3

"Jeff Atwood has stated publicly that one of his ulterior motives with the Discourse project is get people to stop using PHP and start using Ruby." This just won't ever happen. The people that wanted to drop PHP for something else (Ruby, etc) largely did so years ago. The hosting/running situation for PHP is just too basic and easy for people to get in to vs having to 'run a server' (Rails, etc). PHP is still the onl…

I prefer rails specifically because the "hosting/running situation" for Rails is so FAR superior to that of PHP. $ git push heroku master ...done.

Not to be overly pedantic, but Heroku does also support PHP.[1]

[1] https://github.com/heroku/heroku-buildpack-php

Re: In many ways PHP is just now starting to come into its own

#103
The thing that irritates me the most with Php, is not being able to quickly jump around the code from class to class without some hack. While magic autoloaders are great my IDE/text editor isn't smart enough to know how to do this. You could probably write some code to help in this respect for your editor or use some other tools. It ultimately ends up that I want to hold too much of the project in my head, which is a brain muck.

I personally recommend Python over Php to newcomers because I think it's an easier language to understand and get going with.

Re: In many ways PHP is just now starting to come into its own

#104
post #80
post #25

Earlier quoted context omitted.

> PHP is still the only language that assumes HTML output by default. For me, that's not a feature, it's an oddity that I have to work around. I guess it's a feature if you're using PHP as the HTML template language it was designed to be, but I suspect that's a minority use case these days.

I would actually argue that using PHP as the templating language in a PHP MVC application has become the majority use case. Why layer an additional templating language (Smarty, etc) on top of PHP - incurring extra processing and parsing - when PHP is a perfectly capable templating language itself? There are cases where you may need to do this (if you can't "trust" the templates for example and you need to enforce som…

> Why layer an additional templating language (Smarty, etc) on top of PHP - incurring extra processing and parsing - when PHP is a perfectly capable templating language itself?

From past experience: to stop shittier developers at your company putting controller logic in the templates. Using something that does nothing but templating ensures that your templates do nothing but present data.

Re: In many ways PHP is just now starting to come into its own

#105
post #100
post #54

Earlier quoted context omitted.

That really depends on what you're writing and how you are doing it. How is this php[1] code uglier than this python[2] code? [1]: https://github.com/laravel/framework/blob/master/src/Illumin... [2]: https://github.com/reddit/reddit/blob/master/r2/r2/controlle...

I'm afraid you picked a pretty terrible example. That PHP code is 414 lines of getters and setters - the code does nothing of actual value. It's a mess of design patterns and OOP verboseness, which mainly suggests that the PHP community are determined to copy the worst aspects of the Java ecosystem. The Python code, while a little heavy on decorators for my personal taste, spends the same number of lines of code impl…

I already answered this below. Anywhere you look in the framework you'll find that it is written in the same manner, so i couldn't possibly find any code that is comparable in style to the python codebase. Yet, it is a full-stack framework, so you can't say it doesn't have any "useful application functionality".

Since the point was to show what kind of code you'll be looking at depending on the choice of your language/framework i think that the examples are appropriate. Which application implements better design patterns is a discussion that goes a little beyond the point of this thread.

Re: In many ways PHP is just now starting to come into its own

#106

Earlier quoted context omitted.

What is the nature of functional programming? HoF.

Support for higher-order functions is obviously a minimal requirement of a "functional programming language". But functional programming extends far, far beyond that. It also embodies a philosophy emphasizing the purity of such functions. It encourages the use of recursion for iteration. It encourages the use of robust type systems. It encourages the use of pattern matching. It discourages the use of many imperative…

According to you, is Common Lisp functional?

Re: In many ways PHP is just now starting to come into its own

#107
post #94

Earlier quoted context omitted.

You don't really understand why things are done a certain way until you've experienced first hand at how horrible it is to maintain a 6,500 line php file that's mixed with sql, php, html and a ton of inline css in a project that has about 500kb of mixed php/html/css files and like 30 different dynamic pages. It's quite possible to write PHP applications which aren't that terrible, tightly coupled or unmaintainable. P…

Yes I know but if you want to pickup "web development" as a beginner then chances are you're going to start with PHP unless you are getting trained by someone who happens to be using a different technology. At least that's how it was back in 2006ish when I started. Its low barrier of entry is exactly why it's easy to make mistakes. You are given 5000 functions and no guidelines other than the ones you make yourself.

It's still bad, and there's a lot of bad legacy PHP code out there, but I don't believe it's as bad as it was. Although most new developers working with PHP will probably be hacking wordpress themes and plugins (which don't really have much in the way of best practices other than WP's sometimes infuriating API and mixins as a feature) but others will still end up using a framework like Symfony or Laravel, or Composer to manage dependencies and autoloading.

I don't know if it's even as common as it was to start in PHP without at least touching some kind of framework... although that's just an assumption on my part. At the very least there's a lot more good PHP code out there and better practices to be found, even if education seems like a dauntless task.

Re: In many ways PHP is just now starting to come into its own

#108
post #80
post #25

Earlier quoted context omitted.

> PHP is still the only language that assumes HTML output by default. For me, that's not a feature, it's an oddity that I have to work around. I guess it's a feature if you're using PHP as the HTML template language it was designed to be, but I suspect that's a minority use case these days.

I would actually argue that using PHP as the templating language in a PHP MVC application has become the majority use case. Why layer an additional templating language (Smarty, etc) on top of PHP - incurring extra processing and parsing - when PHP is a perfectly capable templating language itself? There are cases where you may need to do this (if you can't "trust" the templates for example and you need to enforce som…

With templating systems which 'compile' templates down to php anyway, that might be a distinction without a difference.

Re: In many ways PHP is just now starting to come into its own

#109
post #106

Earlier quoted context omitted.

Support for higher-order functions is obviously a minimal requirement of a "functional programming language". But functional programming extends far, far beyond that. It also embodies a philosophy emphasizing the purity of such functions. It encourages the use of recursion for iteration. It encourages the use of robust type systems. It encourages the use of pattern matching. It discourages the use of many imperative…

According to you, is Common Lisp functional?

I wouldn't say so. It's far, far closer to a functional programming language than JavaScript is, for instance. But it's clearly nowhere near what Haskell or Standard ML are, either.

Maybe "semi-functional" would be a good term for it and Scheme. It has some of the important elements of functional programming, but not all of them.

Re: In many ways PHP is just now starting to come into its own

#110
post #38

Earlier quoted context omitted.

I prefer rails specifically because the "hosting/running situation" for Rails is so FAR superior to that of PHP. $ git push heroku master ...done.

Not really. That only works with one host, whereas PHP works with just about any 5 dollar/month host in the world.

For loose definitions of 'works'
Post reply on HN