Live data from Hacker News

PHP Addiction

marco.org

51–60 of 320 posts

Re: PHP Addiction

#51
post #9

The problem is pretty much what the article he discusses mentions: I can copy up a PHP file to any old random web host, and it will Just Work. I would love to be able to not write PHP. But the language that replaces it has to be that easy to deploy.

The importance of mod_php, it's robustness, stability and speed is completely underappreciated. It's not just the language with all it's quirks that people should be focusing on. The php stack is easier to use and configure than any of the other language/framework stacks making the time to publish faster. Passenger (mod_rack/mod_rails) looks like an attempt to imitate that stack to some degree but so far the results…

Robustness and stability are not properties of mod_php.

Re: PHP Addiction

#52
post #41

"...next language choice was clear: Python, which seems to fit my style better than Ruby" Just out of curiosity, why would someone believe this? The syntax of python and ruby are nearly identical, but ruby has more tools and support for web-based projects. For someone looking to develop for the web, ruby is pretty clearly a better choice. And this is not knocking python at all, I really enjoy them both and there are…

For someone looking to develop for the web, ruby is pretty clearly a better choice.

For someone looking to troll while looking smart and insightful, this comment is pretty clearly a better choice. Python has a ton of web tools and lots of companies build web services in Python. Ruby is simply another choice, not a better or worse one.

Re: PHP Addiction

#53
post #41

"...next language choice was clear: Python, which seems to fit my style better than Ruby" Just out of curiosity, why would someone believe this? The syntax of python and ruby are nearly identical, but ruby has more tools and support for web-based projects. For someone looking to develop for the web, ruby is pretty clearly a better choice. And this is not knocking python at all, I really enjoy them both and there are…

Ruby and Python are nearly identical in syntax and basic functionality. But I like Python's community and philosophy better.

If you agree there is a difference, then for some set of people, those differences will be the determining factor.

Also, while fairly comparing the amount of "web stuff" that Ruby and Python have would be an effectively impossible task, the simple truth is that both ecosystems are abundantly full of stuff, to the point that which has "more" doesn't matter. You're not going to miss out on anything by going with Python, unless you drill down to a hyper-specific particular package you may need which only exists on one.

Re: PHP Addiction

#54
post #21

Earlier quoted context omitted.

Most PHP developers don't start their first programming project from scratch using PHP to write their first web app. It's far more common to start because you are running a blog on WordPress and you want to make some small change. Then you make another and another, then you're writing plugins and suddenly you're a programmer and PHP is your language. So to encourage developers to start with something other than PHP y…

I did a lot of PHP over the years, trying to migrate over to a Python web stack. A big hurdle is ops dev. All hosting services support PHP out of the box. Now I'm faced with the "distro choice". Which server do I use (lighthttpd / nginx / tornado)? Which framework (django / flask / web2py / cherrypy / pylons / pyramid)? Like the original author, I've had a VPS sitting unused for 2 months paralyzed by choices. I event…

The same choices exist for PHP, although you may not be aware of them. PHP runs on all the servers you mentioned, and there are many, many frameworks in PHP (although admittedly not quite as many as in Python).

Just choose one and learn it. They're all excellent web servers. I'd recommend going with Flask or Django in the beginning, simply because they have the best documentation. web2py also has pretty good documentation. The only problem with Django and web2py is that they are monolithic. If you don't like their ORM, or templating engine, or authentication/authorization, it's generally hard or impossible to switch, and if you do switch you lose all the benefits of the integrated system. With Flask and Bottle, on the other hand, you are free to pick and choose components. I think the same modular design approach is used by Pylons and Pyramid, but I'm not sure since I've never used them. But as you learn more, there's a lot to be said for being able to switch out components of your framework, or even writing your own in a pinch.

Re: PHP Addiction

#55
The only thing actually wrong with PHP, is that it's popular but not cool. And that's a terrible place to sit for any product.

It runs half the Internet quite well, but if you went by the posting on HN, you'd think it was Windows Vista.

I've probably read every article critical of PHP that has hit the front page of HN in the last few years, and the one thing they all have in common is the vague refrain that PHP is a broken language. And yet the gap between tangible proof of that being the case in real world use and the gossip of it supposedly being true, couldn't be wider.

Re: PHP Addiction

#57

>the first question that comes up is what to use instead, and they’re met with a barrage of difficult choices and wildly different opinions and recommendations. The real answer is "it doesn't matter". Of course python people will try to convince you to use python, and ruby people will try to convince you to use ruby. But both groups will agree that either language is far better than PHP. And as someone who likes neit…

The choice does matter. A lot. When I started with ruby, I had to decide between 1.8, or 1.9, or jruby, or several other choices. Then I had to pick sinatra or rails or merb or whatever. mongrel or passenger or thin or unicorn. It didn't really seem like the choice would matter, but then you run into some tiny annoyance, do a bit of research and find out that some other framework doesn't have that problem. So you switch, only to find a new problem. This goes on for a little while until you realize that you could write the whole damn thing from the ground up in lua.

The time spent just researching whether it's a bug in my code or their code starts to eclipse the total project time if done in another language.

Re: PHP Addiction

#58
post #29

How do PHP people handle templating simply? Edit: Perhaps I worded my question wrong. How do PHP programmers try and keep to DRY (ala layouts and view templates)?

Since PHP is a template language at heart, they go ahead and use PHP. For PHP folk, I guess the question is: how do people handle templating simply in other languages, since they can't use the host language itself for that?

EDIT: Disclaimer: I'm a PHP guy trying to make a break for it, and the question was both rethorical and tongue-in-cheek.

Re: PHP Addiction

#59
post #36

I don't understand why someone does not just fork PHP and create something that's syntactically similar but fixes a lot of the problems people complain about.

PHP is an incredibly complex project which is being actively developed [1] and improved. If there were very simple ways to update PHP that were universally agreed upon, they probably would be added (Like short array syntax, built-in HTTP server or many other new features added in PHP 5.4). It just isn't a syntax issue, there are underlying principles about the way features are considered in PHP that are just different from other "similar" scripting languages like Python or Ruby.

If somebody had profound disagreements with the way PHP was being developed, they would be much better off switching or contributing to another language then they would be trying to re-invent PHP.

[1]: https://github.com/php/php-src/graphs/code-frequency

Re: PHP Addiction

#60
post #4

Earlier quoted context omitted.

x3 - it's far simpler to learn due to consistency, more powerful to do both low & high level programming and a pleasure to work with. Just as simple to setup for web as php. Not real reason to be in knee deep php mess.

As easy as PHP in what sense? That Python is basically part of all OS' now or as easy as putting in in a .php file and uploading it to your server? I severely doubt it's as easy as the latter. I'd like to see an article that explains in less than 140 chars how to deploy a simple app as Hello World to the web in Python without the use of a framework like Django or Flask. Edit: In the amount of chars Twitter accepts, h…

   gem install sinatra && echo "require 'sinatra';get '/' do 'Hello, world!';end" > hi.rb && ruby hi.rb
100 characters.
Post reply on HN