Live data from Hacker News

PHP: A fractal of bad design

me.veekun.com

481–490 of 514 posts

Re: PHP: A fractal of bad design

#481

Earlier quoted context omitted.

>>The amount of waste that goes on in most PHP shops is what irks me - use the right tool, spend at least 50% less time working around stupid quirks. Yeah, but why would you care unless you're begrudgingly participating in the PHP industry? It's not your problem unless you make it your problem - i.e., if you're so against it, don't work in a PHP shop, don't take PHP contracts. Problem solved - if other people want to…

Even those of us entirely outside the PHP economy (mobile, desktop, big-iron server) occasionally stumble into a monster of a mess that some PHP idiot left behind, and have to clean it up (usually by just replacing it outright, because PHP isn't worth maintaining). The money is nice, but after watching the ridiculous waste of PHP idiocy for the Nth time, you can't help but want to get people to stop.

And that's not counting all of the messes that are inflicted on you as a user of PHP - security holes and password breaches or having to interface with some crappy API to get stuff done.

At least with PHP it's likely to be some vaguely HTTP/POST-ish interface, not some XML/WSDL monstrosity...

Re: PHP: A fractal of bad design

#482
post #373
post #348

Earlier quoted context omitted.

Ok, let me fix that: "The article tries to be a comprehensive list of problems with PHP and @ is an error suppression tool that is notorious for being misused throughout the community". > I refactor all external PHP code before I place it inside of mine > You don't like a feature of PHP? Don't use that feature. Simple as that. I don't know anything about you, but judging from that attitude you haven't worked in many…

> I don't know anything about you, but judging from that attitude you haven't worked in many teams. I haven't worked on any teams. I've always written software solo. What of it? > You may have the luxury of refactoring all over the place, but the reality out there is that horrible code like this is left to fester until it causes real business damage. Refactoring is not a luxury, but a necessity. Not only do I refacto…

Isn't the fact that you have to refactor so much of other peoples code an indication that something might be wrong? I'm not familiar with the PHP ecosystem but I don't know of many people having to refactor Ruby gems.

Re: PHP: A fractal of bad design

#483
post #480

Earlier quoted context omitted.

Actually, you just need this: Hello world If all you want to do is print some text, just put some text outside the <?php delimiter. If you want to do nothing else, you don't even need the <?php delimiter.

True, but he/she mentioned specifically a "Hello World" in PHP.

    Hello World
is valid PHP

Re: PHP: A fractal of bad design

#484

Earlier quoted context omitted.

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,…

> You can get really excellent, easy $10/mo Python hosting...

Any recommendations? I need one for a small biz (in the US), so this is a serious question. I would pay 2-3x that much for a "really excellent" platform I could build a business site on without having to be the entire sys admin.)

Re: PHP: A fractal of bad design

#485
post #484

Earlier quoted context omitted.

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,…

> You can get really excellent, easy $10/mo Python hosting... Any recommendations? I need one for a small biz (in the US), so this is a serious question. I would pay 2-3x that much for a "really excellent" platform I could build a business site on without having to be the entire sys admin.)

Webfaction[1] is really quite good, and well inside your budget. It's shared hosting, but it's good shared hosting, and they're very Python friendly. One click to create a Django app, and you can easily install your own frameworks and stuff. Depending on what your neighbors are doing you may get varying performance, but what can you do?

If you need more reliability than shared hosting can give you, then you either head into the VPS/IaaS/dedicated space (and need to do your own sys admin stuff), or you head into the GAE/Heroku/PaaS space (and need to pay a lot more).

There are always tradeoffs. :) (And no, I have no reason to recommend them other than being a happy customer. ...unless you want to use my affiliate link[2] to sign up, of course.)

[1]: http://www.webfaction.com

[2]: http://www.webfaction.com?affiliate=chaos

Re: PHP: A fractal of bad design

#486

Earlier quoted context omitted.

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 com…

Sorry but that is quite hard to swallow. How are any of these not fit for building an MVP in 2012? http://silex.sensiolabs.org/ http://twig.sensiolabs.org https://github.com/nrk/predis There are also modern libraries for a plethora of other RDBMS and NoSQL systems (I think PHP is even going to support mongodb natively soon i.e. no third party client library required).

Please, the PHP industry is stuck on Wordpress and CodeIgniter which are amateur software.

Yes, you can enjoy these wonderful modern tools for PHP at home meanwhile you suffer with old-tier libraries at work because everyone refuses to move forward.

Re: PHP: A fractal of bad design

#487

Earlier quoted context omitted.

But actually, then you're back to the deployment model that ruby apps used before switching to dedicated app servers and everybody said "oh, that's sooo complicated."

I'm not a ruby user so I might be missing your point but... There's nothing stopping you running php on a separate dedicated machine from the web server. You'd just use mod_fastcgi and php-fpm. You can run it in a webserver thread (mod_php), run it in its own process alongside the webserver (mod_fcgid), run it on a dedicated machine (mod_fastcgi) or run it from the command line. That's the beauty of PHP, it lets you…

Right, you can do what you want, I know that. The point is: If you do it, then you're at the deployment model that rails has been using all the time and that the php people said to be way too complicated. The simplest way nowadays to deploy rails is mod_passenger. It's about as simple as it gets - dump files, reload app. Done.

Actually, I don't get what's so simple about deploying PHP files individually via ftp. All I do is enter 'cap deploy' on a terminal. And I get free rollback. (there's web interfaces as well)

Re: PHP: A fractal of bad design

#488
post #456
post #386

Earlier quoted context omitted.

> Other languages have some sort of warning suppression as well But there is a huge difference here. PHP directly encourages it, making it so easy to do "just prefix it with @" and dedicating a part of the core language syntax to it (thus spending such a nice character for such a triviality). I believe (correct me if I'm wrong) that in Java, it is just another annotation, and in C# just another preprocessor directive…

In Java annotations can be used to ignore compiler warnings, not runtime errors. To get the same effect as @ you'd have to use try {} catch {} blocks all over the place and leave the catch blocks empty, as with any other language with runtime exceptions. Sadly this is done more that one would think...

But that was exactly my point. When you do it in Java, you are obviously doing something wrong (or at least not intended to be done). It just looks wrong at the first glance, with empty blocks and all. In PHP, it's just a single character prefix, no bother at all to add, and looks just like any other sigil. Its usage is definitely not discouraged by design, quite the contrary.

Re: PHP: A fractal of bad design

#489
post #394

Earlier quoted context omitted.

> If you're not going to use it, why complain about it? I can tell you my reasons: the market. Not all of us can roll a globe, close our eyes, pinpoint a place and tomorrow have a job there. Here where I live, about 80% of webdev jobs are PHP. Even when I do manage to get a Ruby or a Python job, chances are that I will be doing lots of PHP code maintenance and migration anyway. I would like to change it, and I don't…

>> Here where I live, about 80% of webdev jobs are PHP. I'm getting the impression that this is why a lot of people hate PHP - Money. People don't like that the market is full of money wasted on an inferior language. Perhaps there's a bit of envy in that, perhaps not. The winners in the marketplace aren't always the best, and it's not easy to change minds. People get religious about the things that make their living,…

No, it's not the money. It's comfort, and the opportunity for less compromises when picking jobs. I want to be able to choose between three Ruby/Python/whatever shops and pick one with the coolest people and coolest projects, rather than having one Ruby/Python and two PHP shops to choose from.

And, unlike you, I don't think these articles are pointless. I hope they help PHP get more bad reputation among coders, and peer pressure will do the rest.

Re: PHP: A fractal of bad design

#490
post #335
post #280

Earlier quoted context omitted.

More programmers===better programs. How can this be a bad thing? I'm not sure this is true. Going with the articles example, that's like saying "the more people who know how to use a hammer, the better houses we will have".

Are you claiming less people should have access to programming? Should we have a guild with mandatory 10-year apprenticeship in Haskell?

That's kind of over the top, but I'd like to see everyone spend their first six months in any language that doesn't hide your mistakes from you by quietly guessing what you might have wanted and doing something random.
Post reply on HN