7 ms·
It is really easy to talk smack about PHP because as a language it is not the prettiest, best designed, or cleanest language out there. It often leads to some v
by programminggeek 13y ago
It is really easy to talk smack about PHP because as a language it is not the prettiest, best designed, or cleanest language out there. It often leads to some very gross code.
However, programmers write ugly code in every language and even in a much more beautiful language like Ruby, there are so many projects that end up with ugly codebases, poor performance, etc. that PHP by no means holds an exclusive ownership of terrible coding practices.
Writing high quality code in any language takes significant effort on an ongoing basis. Practices like TDD, code review, pairing, etc. can help, but only if they are applied with significant effort.
- evilduck 13y agoThis argument makes no sense. You're conflating people and behavior with tools. Bad tools make it easier to do a bad job in any field of work. Novices with good tools will still do a bad job. This is a weak justification for promoting bad tools.
- ThomPete 13y agoBad tools? In what alternative universe is PHP a bad tool? It is one of the easiest to get started with, most documented, best supported and flexible tools out there for 90% of the things you see on the internet today.
- spellboots 13y agoObligatory http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de... I spent many years doing PHP. I am very glad that those years are behind me. Even if you allow for it being easy to setup - which is debatable - setup only happens once and is not very hard in any language. If you find it hard to install a programming language by following instructions, you are an amateur pretty much by definition.
- ThomPete 13y agoAnd how do you think most people get started? As pros? Again php is great for 90% of the things that is done on the internet today and its popular exactly because it's not claiming to be more than it is and easy to get started with. No other language not even python especially not ruby does that as well. And then we haven't even talked about how easy it is to use php with javasrcipt, html and css.
- PavlovsCat 13y agoAre there blog posts about how someone tried to solve an actual problem in PHP, but couldn't because the language sucked too much? You know, instead of pointing and laughing at things they saw in the manual or newsgroups that hardly matter in practice.
- eropple 13y agoThat's not the problem with PHP. The problem with PHP is that its design flaws cause friction that scales at least linearly and probably more like geometrically with application complexity--and it doesn't hit you until a project is of sufficient size that every change comes with more and more pain. "It's easy to start with" is only a virtue if that doesn't come with "it turns into a tire fire a year later".
- PavlovsCat 13y agoFair enough, but not every application has to be ready for huge growth. E.g. for a guestbook the fact it wouldn't turn into a tire fire should you decide to turn it into facebickr or googipedia is a rather small benefit, and if it comes with higher setup costs it's actually a drawback. Some people just scratch the itches they have, right now, not the itches their expertise makes them think they should have, or the likes of Google or Facebook make them think they might have in the future. And that is fine. Nobody is telling anyone to use PHP for their huge project, right? So why tell people they shouldn't use PHP for their mortal ones? Because at some point, down the road... can't we cross that bridge when we come to it?
- sixthloginorso 13y agoIn a Universe where consistency, soundness, orthogonal API design, modularity and evidence that the developers gave some thought to their language is expected. I would like to believe that this is such a Universe. I mean, many of the endless list of functions imported into the default namespace were named so that their hashing distribution worked well with strlen for a hash. How much work went into working around the fact that just about the worst hashing function that you can come up with in three seconds was used? And we can enumerate such blunders all day here. There are many better languages with good tooling, and guess what, they're free. I wouldn't use PHP if I can avoid it, and there's ample chance to avoid it nowadays.
- ThomPete 13y agoYou are in the wrong universe mate. And you are missing the point. It's not just about the language it's about all the other things around the language. How easy it is to find a webhotel and get started, how easy it integrates with HTML, JavaScript, CSS. Of course it's ugly, but who besides a bunch of snobs and people who actually can't use it really cares? Who should care?
- sixthloginorso 13y ago> how easy it integrates with HTML, JavaScript, CSS No more than any other language or product written in such. > Of course it's ugly, but who besides a bunch of snobs and people who actually can't use it really cares? Who should care? You see, this is a big part of what's wrong with the PHP community, the apathy and immaturity. How on Earth is dismissing the reasoned criticism from professional peers and academics as "bashing" from "haters" or "snobs" an appropriate response?
- ThomPete 13y agoCritique is fine but it just need to be based on other things than taste. Point to a thing you cant do with PHP and you have valid criticism. Critiquing PHP because you you think it's ugly or not elegant enough is only valid if you care about such things and then you are by definition a snob.
- ytdtty 13y ago> In what alternative universe is PHP a bad tool? In the same universe where munging together logic and display code, or model and view code, is a bad idea. It's the same problem as using classic .ASP, except people are smart enough to not get all indignant when people point out how bad .asp was. > It is one of the easiest to get started with That's nothing special. It's trivial to get started with dozens of web frameworks. > most documented Most frameworks and languages are well documented. It's like you're bragging that you have the most well-vacuumed car seats, at a car rally. > best supported Again, this is nothing special. Most frameworks have IRC channels and mailing lists. > for 90% of the things you see on the internet today. 90% of the things on the internet are so simple that you could easily use PHP for them, like blogs, simple forums, mostly static sites, etc. That doesn't necessarily make PHP a good tool. It just shows how you can easily do trivial tasks with mediocre tools.
- maw 13y agoYou can trot out the trope about how you can write good code or bad code in any language as many times as you wish but it will not change the fact that php makes it unnecessarily difficult to write good code and, through both the language's and its standard library's misfeatures as well as the surrounding culture of sloppiness, encourages writing bad code.
- programminggeek 13y agoI don't disagree with you at all.
- blindhippo 13y agoPHP does not make it necessarily difficult to write good code. It's actually quite easy to write good code. The annoying part is that there is a metric CRAP ton of awful legacy code out there that constitutes the majority of PHP work. But you can say the same thing about any language - reality != trope. I won't argue that there are large pockets of PHP developers who do fit the bill of encouraging a culture of sloppiness, but to paint the entire userbase this way is just ignorant.
- cookiecaper 13y agoblindhippo: you are hellbanned. Most readers cannot see your comments.
- nobleach 13y agoAs a casual HN reader and as one who doesn't post comments that often, I have to say, that shit exists here??? my god, so we're basically reddit? So do we have a hivemind too? This isn't directed at you. I just didn't realize HN was part of that nerd subculture. I thought HN was for adults.
- semerda 13y agoNailed it. The sea of bad habits has bred an ocean of bad code.
- UK-AL 13y agoThat's true. But why make it worse by choosing a bad language. Surely you have good practice and a language that makes it easier.
- ThomPete 13y agoYou wanna know why PHP is so popular and why many people chooses it? Because it's so easy to get started using. Compare that to almost any other language out there that is a nightmare to set up. At the end of the day the code if it works it works and PHP just simply works. Not for everything but for most things.
- shekmalhen 13y agoThe same thing could have been said about visual basic... one of the worse language ever made.
- mekoka 13y agoYes PHP is deceptive in that it saves you about 2 hours of your life right at the setup, compared to other languages. You end up paying them in spades over the next 5 years you'll be using it. I should know.
- usamec 13y agoI think that setting up apache+php is much harder than copy&pasting few basic lines of flask code a running simple python program.
- cookiecaper 13y agoBeauty is subjective. I don't think Ruby is beautiful, I much prefer Python. The difference is that PHP was not really designed for the type of use it gets. It began as one guy's hobby project and somehow snowballed to power some of the biggest sites on the internet without really having the backing necessary to support that position. PHP maintainers have been desperately attempting to backport the type of functionality that Serious Business people need, but it's never going to be as organized or clean as something that was conceived to serve that purpose. If you care about code quality, choosing PHP already puts you at a disadvantage. It's not that people can't write adequate PHP code, or that people can't write ugly code in other languages. It's just that most other languages give you a pretty healthy head start over PHP when it comes to cohesion of organization, presence of important language features, etc.