Live data from Hacker News

PHP: A fractal of bad design

me.veekun.com

191–200 of 514 posts

Re: PHP: A fractal of bad design

#191
post #42

I'm going to be unfair and quote just two words from the article: > empowered amateur PHP is a gateway drug to web development. And that's awesome. With almost every other popular web development language I've heard of[1], there's this grey area between "my app works on my local machine" and "my app works on the server" that is really hard to grok as a beginner. There's a reason entire businesses are built on the ide…

I find it odd how many people keep saying it's that simple to push PHP code to a box and get it working. Sure, if you've got crazy simple requirements it's generally a cinch. Once you do anything remotely non-trivial (want to read from a file? use some third party library, handle errors in a consistent manner) then you start hitting into issues with file permissions, PHP version differences, modules not compiled in b…

And what "EXACTLY" is the problem with having a devlopment system that mirrors the live production one?

I worked at one place where our hardware guy who wanted the dev test and live systems to come from the same production batch from SUN just to make sure there where no strange MB rev problems.

Ok having identical hardware is high end but seting up a system where your running the same linux distribution an the same version of mysql php etc is not exactly rocket science.

Re: PHP: A fractal of bad design

#192

All those words, and yet the word template only appears once. And that's to assert that PHP has: …no template system. There’s PHP itself, but nothing that acts as a big interpolator rather than a program. As if that was a bug and not a feature. PHP succeeds because there is one PHP templating syntax and it is called "PHP" . PHP started life as a templating language, and that's where its soul lies. Which is important,…

PHP is not a good tool for quickly getting a minimum viable product. Despite its flaws it is a good weapon for fighting 'the last war' - that is to say, it makes it quick and easy to make what are essentially the CGI pages of 1996 - but if you're doing anything more complex than that (for instance interacting in any way with a database), and I would suggest that even relatively non-technical people looking to use computing technology for a business are in Anno 2012, there are many better systems available which do not expose the novice or intermediate programmer to nearly so many pitfalls.

Re: PHP: A fractal of bad design

#193
post #42

I'm going to be unfair and quote just two words from the article: > empowered amateur PHP is a gateway drug to web development. And that's awesome. With almost every other popular web development language I've heard of[1], there's this grey area between "my app works on my local machine" and "my app works on the server" that is really hard to grok as a beginner. There's a reason entire businesses are built on the ide…

I agree with you and I'm really surprised in 15 years, or how over old PHP is, THERE IS NOT ONE SINGLE ALTERNATIVE!! Why? For PHP I sign up for one of the million LAMP ISPs, I upload a .php file with .php embedded in HTML and I'm done. Where's the Ruby version of this? The Python version? The JavaScript version? The Perl version? THEY DON'T EXIST. You wanna use Perl or Python. You either have to use slow slow cgi or…

mod_python was notoriously unstable and is now disgustingly obsolete, it has been replaced by mod_wsgi for some years now (with the additional advantage that apps which work on mod_wsgi will work on many other servers).

The reason you have trouble deploying Python is purely that the hosts you are trying to use CHOOSE not to support it.

You can get really excellent, easy $10/mo Python hosting but if you ask for 'free,' beggars can't be choosers, so you will get whatever they feel like giving you. This is not a function of the underlying technology.

Don't blame other languages if you have not ever figured out how to do anything other than PHP

Re: PHP: A fractal of bad design

#194
post #183

All those words, and yet the word template only appears once. And that's to assert that PHP has: …no template system. There’s PHP itself, but nothing that acts as a big interpolator rather than a program. As if that was a bug and not a feature. PHP succeeds because there is one PHP templating syntax and it is called "PHP" . PHP started life as a templating language, and that's where its soul lies. Which is important,…

You're right. This is a supply-and-demand problem : which choices does non-programmers or casual programmers have when they want to create an app ? How can someone who's working or studying 40+ hours a week find the time to learn the basics of MVC, inheritance etc ... There is a demand for easy to create template-based websites and PHP is the only kid in town for this kind of things.

This is no excuse. If you want to learn how to do something, effort is required. How much time will that person waste in the long run battling all of the problems and traps PHP brings with it?

I contend that learning a proper language will be of greater benefit to a person just starting web-development, and putting in just a few extra hours at the beginning to get a solid foundation will in fact save them time in the long-run.

Also, giving complete amateurs this loaded, rusty .44 magnum and pointing them at the battlefield is bad for web security and the web in general, they will inevitably lose all the plaintext usernames and passwords they have in their database.

PHP is a blight on the web.

Re: PHP: A fractal of bad design

#195
post #105

I regularly, (all over this thread), see people swear that PHP is great for beginners. Everything in this article seems to indicate the opposite. You have to trip over PHP's poor design while trying to learn to program. Outside of the wide availability of PHP servers for cheap, what makes PHP so great for beginners? With Ruby, Python, Go, hell, even JSP for the "instant", in-HTML effect, I just don't see PHP as some…

With PHP, creating a new "app" is a matter of sticking a .php file in a directory. There is no config file, directory structure, or server to babysit, and nothing to restart after modifications. Instead of using a complicated templating system, you just include HTML inline. This is a horrible design for a large webapp, but even as an experienced programmer, sometimes I just want a quick hacky self-contained script, l…

"Sticking a php file in a directory" is just a matter of server config, not languages. There is no reason why you can't put a quick Python web app in a single file which exposes just one WSGI application object named 'application' - so if the server complied, you could indeed just stick the .py file in a certain magical directory.

Re: PHP: A fractal of bad design

#196

If PHP really is so shitty, can you please in any other language or framework of your choice finish the following project in 10 minutes, Be able to put a . inside any folder where your apache/nginx serves fiels from, then make your file give a much nicer file listing than the default of nginx/apache with possibility to comment on the file (using a __comments/directory and text file for each comment and sequence numbe…

Having Apache automagically serve a WSGI app object found in foo.py when you dump it in /opt/magicpath has nothing to do with the language and everything to do with Apache.

Re: PHP: A fractal of bad design

#197
post #99

A client's system has PHP scripts in its crontab. Just imagine the wonders those files have inside.

I work for a very large ISP. When I get there I found that a lot of tools are done with PHP, and I'm not talking fancy PHP. mysql_, no APC, no framework, almost no objects, no web services etc. The other day I was asked to do a cron task and I was able to do it with Zend Framework very quickly and quite elegantly. It was surely not the perfect tool but since it integrates with the culture of devs and sysadmin there i…

"If all you have is a hammer, everything looks like a nail."

Re: PHP: A fractal of bad design

#198
post #5
post #2

This is just another example of someone beating a dead horse (which has already been beaten) for page views. Next week we'll have another "bash php" post, and the week after that another. I wish people spent as much time creating new things as they did bitching. As well written as this article is, it contains absolutely nothing that hasn't been said ten thousand times already- in fact, most of this seems to be regurg…

Make your mind up—should I have spent less time on this or more? :) Like I said, I wrote it to get this /out/ of my system; I am now impervious to PHP arguments. Either this will convince someone or it will not. Done.

Even if it's a dried up subject, the blog is comprehensive and concise enough to almost be reference material. Everyone knows PHP sucks but this is a damn good illustration of why.

What I'm saying is disregard that guy.

Re: PHP: A fractal of bad design

#199
A little off topic, but can we please stop using lines like this in articles:

because computers suck

They do not. Barring only the wonders of the realm of nature, computers are in my opinion one of the most wondrous things, it is a testament to Humans as to how creative, industrious and sheer genius we can be. They allow us to do computations beyond our wildest possibility, allow us to control, consume, produce and every other verb you care to mention.

Computers do not suck.

Re: PHP: A fractal of bad design

#200

All those words, and yet the word template only appears once. And that's to assert that PHP has: …no template system. There’s PHP itself, but nothing that acts as a big interpolator rather than a program. As if that was a bug and not a feature. PHP succeeds because there is one PHP templating syntax and it is called "PHP" . PHP started life as a templating language, and that's where its soul lies. Which is important,…

Thing is, if we were to consider PHP a templating language in comparison with a DSL like Jinja2 or Twig, we would reject PHP because it is overly verbose, does not have inheritance, is inconsistent, and has no caching by default.
Post reply on HN