Live data from Hacker News

PHP Addiction

marco.org

31–40 of 320 posts

Re: PHP Addiction

#31
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 are far from perfect.

Re: PHP Addiction

#32
The reason you describe your relationship with PHP as an "addiction" instead of using a word that described a more healthy relationship is probably because there is something about it that doesn't resonate well with your core values. At least that's the problem that I had with it.

If you want a nice introduction into the world of developing web apps with Python, I suggest you read the Flask user manual (see http://flask.pocoo.org/docs/). It not only covers the basics of the framework, but also seems to assume that you're a first-time Python user as well. It covers topics such as using virtualenv and pip to setup your environment which I found very helpful when getting started with the language.

Re: PHP Addiction

#33
Here is another point that highlights the problem:

If I want to write a hello world application in PHP, it's neither as long as nor as short as

Rather it's simply: hello world. Just type in those 11 characters in a text file and save it as hello.php. Now load it on your browser [or run it from command line] and it will print hello world. I don't think it can get any more simpler than that in other languages. PHP was developed from the ground up as a templateting language for serving HTML pages. These other languages are more of a general type.

Therefore the replacement for PHP should come through a new language targeted as a replacement for PHP as Jeff said. Otherwise there always be extra web/template stacks for the developers to take care of. And that will be the first hurdle to learn and overcome for novice developers looking for switching to something easier.

Re: PHP Addiction

#34
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…

  echo "hello world" > index.html && python -m SimpleHTTPServer
:)

Re: PHP Addiction

#35
post #14

Disclaimer: I'm a Rails programmer for work and hobby. Interested in learning something that isn't PHP to code your web applications in? Ok. You have a ton of options and this is a very exciting time to be a web developer. Do you want to lean towards stability and proven concepts and work within a full application structure? Look at Django and Rails. Do you want to serve up responses from a simple script without a lo…

> Interested in learning something that isn't PHP to code your web applications in?

That's the problem. I'm in the same boat as Marco with pretty much the same reasoning. I'm not interesting in learning something -- I'm interesting in starting and completing my next project as quickly, cheaply, and well designed as possible. I'm willing to accept that, all things being equal, a better design is possible in Python or Ruby. But for that to be true, I need to know Python or Ruby. I need to know the framework I'm working on.

I can certainly put the time into learning, the time into heading down the wrong path in both design and technology for a project (and that will happen), perhaps rewrite a few times. But with only so many hours in the day (less than I really need), it's not much of an option.

Re: PHP Addiction

#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.

Re: PHP Addiction

#38
post #13

That's one of the problems with the now-famous Fractal blog, I think: It was a joy to read in the sense that being a Python programmer, it only heightened my appreciation of the achievement that languages like Python and Ruby represent. It's what conscious, determined design gets you and what mistakes they managed to avoid. But it's preaching to the choir. If you've never seen anything other than PHP, you won't under…

> If you've never seen anything other than PHP, you won't understand two thirds of the list or why they're problems.

Two thirds of that list are actually incorrect.

But I programmed in Java, C++, C, VB, and so on before I started coding in PHP many years ago. So many years ago, in fact, that PHP was easily the best choice.

The problem with lists like that is they obscure the truth -- and that is -- that solving a programming problem in modern PHP isn't really that different from solving it in Python and Ruby. It's just not that much of a leap.

Re: PHP Addiction

#39
post #21
post #13

That's one of the problems with the now-famous Fractal blog, I think: It was a joy to read in the sense that being a Python programmer, it only heightened my appreciation of the achievement that languages like Python and Ruby represent. It's what conscious, determined design gets you and what mistakes they managed to avoid. But it's preaching to the choir. If you've never seen anything other than PHP, you won't under…

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 eventually decided on nginx / flask, but haven't had the time to set it up. Maybe I should have just used Heroku. shrugs

Re: PHP Addiction

#40
post #7

I'll sound like a broken record, but I'm convinced Flask is the perfect transition. It's built for smaller web apps, and rapid prototyping. The system of mapping endpoints to functions is incredibly intuitive -- if you've used Python before, learning Flask is incredibly easy.

i'm on PHP now as well. I would probably choose Bottle simply because it runs on Python 3 while Flask does not. I would go with Flask otherwise.

Bottle is very cool, but Flask has far more plug-ins ("extensions") than Bottle does. Flask has nearly all the features that Django does, only they are in the form of dozens of separate extensions. In my opinion, this is a good thing. It's easier to understand the framework when you start with the basics and learn more as you add on extensions.

I believe that Flask will move to Python 3 eventually, but at the moment I agree with the decision of Flask's creator (Armin Ronacher) to stick with Python 2.7. In the end, Python 2.7 is probably better for someone new to the language. There's more documentation, and it's still the default Python on most systems(although a few are starting to pre-bundle Python 3).

Post reply on HN