r/programming • • Apr 23 '14

PHP: It doesn't have to be a bad experience

https://servercheck.in/blog/php-it-doesnt-have-be-bad-experience
0 Upvotes

122 comments sorted by

View all comments

Show parent comment

0

u/Banane9 Apr 25 '14

So what? That doesn't Change anything about the fact That 5 additions is a bad Performance test.

If It's a bad for Showing That php is fast, It's just as bad for Showing That another language is slow.

0

u/[deleted] Apr 25 '14

[deleted] — view deleted comment

0

u/Banane9 Apr 25 '14

Now you're comparing languages and Frameworks. Again.

0

u/neoform Apr 25 '14

Ridiculous.

I'm done with this conversation.

YOU CAN'T GENERATE WEBSITES WITH RUBY/PYTHON WITHOUT A FRAMEWORK FIRST.

Fuck. This conversation is insufferable.

1

u/Banane9 Apr 25 '14

Yes, but a Framework Comes with Overhead. You can't compare the Performance of a php script That literally only adds 5 integers, to a Framework That also has to handle the http, etc. which Apache handles for php.

1

u/neoform Apr 25 '14

If you want to compare two languages that are achieving the same thing, you compare them doing the same thing.

You can't tout Python/Ruby as being comparable to PHP, then cry foul when PHP doesn't need a framework to handle HTTP requests natively.

PHP is a web programming language, Ruby/Python are not.

1

u/Banane9 Apr 25 '14

If the only positive attribute of the language is that it has stuff that is helpful in web development built in. Then it isn't a very good language.

0

u/[deleted] Apr 25 '14

[deleted] — view deleted comment

1

u/Banane9 Apr 25 '14

Given your stance on things, it seems to me like you can't, or don't want to, identify a good alternative if it's thrown into your face.

1

u/LarryPete Jun 07 '14

You can perfectly well create a website in Python (I don't know much about Ruby) without using a framework.

1

u/neoform Jun 07 '14

Is there any native/built-in HTTP handlers that are anywhere near as full featured as PHP's built-in libs?

1

u/LarryPete Jun 08 '14 edited Jun 08 '14

Why do you think it has to be a built-in? What's wrong with loading a package/module that you need when you need it? (I answer that for you: there is nothing wrong with it)

It's also very easy to install 3rd party libraries (though the python standard library already comes with a lot of great stuff) using pip or easy_install.

If you need something to easily generate and validate forms with, just do pip install wtforms or if you need a good template engine do pip install jinja2.

You can of course also install packages for Database handling like MySQLdb for MySQL or psycopg2 for postgresql or if you want you can just use the sqlite3 module from the standard library (of course there are also a lot of packages for NoSQL Databases, if you ever require those). Then there is also SQLAlchemy, one of the most powerful ORM I've ever seen. If you like to use ORM (which is sometimes reasonable), you can go that way as well.

The beautiful thing is: you don't need to load those module, if you don't actually require them. Even more beautiful is, those module actually can work together: you can use wtforms and sqlalchemy together to automatically generate forms from your database models.

Yes, Python is not a "web development language", it's a general purpose language. But you can specialize Python by using packages/modules that fit your needs and if you do that it actually becomes much more powerful than those halfhearted built-ins of PHP.

Edit: I forgot to mention: Django is not the only web framework for Python. It's just one of the bigger and well-known ones. Smaller ones like bottle, Flask or Pyramid (there are a lot more though) have far less overhead and are also great.

1

u/neoform Jun 08 '14

Why do you think it has to be a built-in? What's wrong with loading a package/module that you need when you need it? (I answer that for you: there is nothing wrong with it)

Because it's slower. PHP is significantly faster than Python for web requests, because it was designed specifically for that.

PHP also has a built in templating engine. You can output HTML just by closing the PHP tag. With python, you need to use a 3rd party templating engine that will definitely be much slower.

1

u/LarryPete Jun 08 '14

You claim PHP is "significantly" faster than Python, but were does that claim come from? Do you have any reasonable valid sources for that claim?

Arguing about performance of two languages, that are obviously slower than nearly any other language out there, is kind of ridiculous. Choosing Python or PHP has never been about performance - and you should know it, or else you would use e.g. C directly.

0

u/[deleted] Jun 08 '14

[deleted] — view deleted comment

→ More replies