Live data from Hacker News

Coding Horror: The PHP Singularity

codinghorror.com

261–270 of 341 posts

Re: Coding Horror: The PHP Singularity

#261
post #256

Earlier quoted context omitted.

What other languages besides PHP have you used? I think a lot of us dislike PHP because we're putting it in the context of better designed languages.

Sorry to respond twice to your post, but I realized this was a great opportunity to learn something. Given my basic example in my post, what language would you recommend I try to accomplish this task? I like to stay away from frameworks so basically I'm asking you to not suggest Rails, however don't be afraid to suggest ruby. If you feel like typing something out, let me know why you suggest it and what advantages it…

Ruby. It's the cleanest language with the most sensible standard library I've come across to date. Ruby doesn't necessarily mean Rails, and in fact I'm not a fan of Rails' overly prescriptive paradigm. (As an aside, any time you hear Rails is an MVC framework, discount it because it's really an MVA framework.) One of the things you'll find coming from the world of PHP is Ruby has consistent method signatures. For this and a lot of other reasons you'll almost certainly be happier with Ruby.

Aside from happiness, there are things that make Ruby more powerful. For example, you can cleanly implement the reactor pattern (think: NodeJS) with EventMachine and with EM-Synchrony you can avoid the callback hell that comes with NodeJS.

If you want, you can look at Sinatra to provide the common functionality that the PHP framework provides. With Sinatra you're not all-but-forced to use an ORM like you are with Rails, as Sinatra doesn't include one. If you really want, you can go closer to the metal and look directly at Rack, which is middleware between web servers (Apache, Nginx, etc) and the actual application.

There's really no right way to do it, but the best thing is to learn and explore. Some people will recommend Python, and while it's a decent language, it's got some things I consider to be rough edges -- lack of useful language features, such as switch/case statements, and badly implemented parts of its standard library that handle network requests.

The next language on my learning list is Go. I've heard nothing but good things about it, but I'll reserve my judgment until I have some experience with it.

Re: Coding Horror: The PHP Singularity

#262

Earlier quoted context omitted.

What other popular language is as bad? COBOL? I don't know about impeding the development of good software. Warts can always be worked around as long as you know about them and how to handle them. But that doesn't mean they don't matter, and PHP has so many that it's difficult to enumerate them. What other popular languages silently convert strings to floats and then do math or floating-point comparisons on them? Wha…

> What other popular languages silently convert strings to floats and then do math or floating-point comparisons on them? JavaScript. Most of the "issues" around comparisons/conversions/etc equally applies to JavaScript as it does to PHP. But PHP does some very stupid casts but it's really just one problem. In the lists of "failures" tend to show that same problem 15 different ways to show how screwed up things are.…

Yes, JavaScript has the same string comparison problems as PHP. And it gets a ton of criticism for it. JS doesn't have all these other problems, though.

For the unit tests, it looks like there are still 100 unexpected failures in the latest release:

http://gcov.php.net/viewer.php?version=PHP_5_4&func=test...

Am I misinterpreting that?

Yes, no platform is free of security problems. But the way a security problem happens is as important as what the problem is. That PHP's unit tests are so noisy that important regressions can't even be noticed even when a test exists to catch them speaks extremely poorly of PHP compared to other languages.

Re: Coding Horror: The PHP Singularity

#263
> code that runs on virtually every server in the world with zero friction or configuration hassles,

Quit being so fucking lazy, entitled, and expectfull of silver bullet.

Good tools require maint, they require good environment, they require a modicum of skill and/or effort.

The problem with PHP is not PHP. It is the PHP community. Which is filled (not all) with ignorant, don't wanna learn/understand, minimal effort expending schlubs.

The attitude "I'm a dev shouldn't have to know about sysadim", is fail, is fucked. No, you create a product. Should be aware, if not knowledgeable, of every aspect of that product and the team that creates it.

Re: Coding Horror: The PHP Singularity

#265
post #168

Earlier quoted context omitted.

Write a multi-threaded program in PHP, I will write one in ... well pretty much anything else.

That's not a problem though, is it.

Actually I see PHPs lack of multithreading as one of it's few good features

Re: Coding Horror: The PHP Singularity

#266

PHP got Facebook up and running, so it has that to its credit. And that's a huge credit. As a result, Facebook engineers developed things like this: http://en.wikipedia.org/wiki/HipHop_for_PHP Which is an impressive piece of technology, but makes you wonder if Facebook engineers wish their website wasn't written in PHP.

It surprised me, considering the original developers of facebook (Zuckerberg, Moskovitz) were doing Computer Science degrees why they chose PHP to build it in initially. Did they consider other languages, or frameworks. I'd be surprised if they chose PHP because of future hireability / scaling up. I'd guess they didn't give it much thought and PHP was just there.

In the early part of this century, PHP was basically still the free language for writing dynamic web content.

The second place choice was probably perl (via cgi or mod_perl).

I guess Tomcat was around too.

Both Django and Rails were released after facebook.

Re: Coding Horror: The PHP Singularity

#267

Earlier quoted context omitted.

I'm not talking down to anybody. Based on experience I asserted that many programmers feel that PHP is an inferior language because they've experienced "cleaner" languages such as Ruby. It's not wholly unreasonable that chez17 had only programmed using PHP, as PHP is commonly a programmer's first language. I therefore wanted to find out if chez17 had used other languages and to see what their thoughts are on PHP vs t…

Good, just the way it read. As for constantly mocking other languages, that was not directly pointed at you, but at the constant swarm of people always going about php sucks, php this, php that... We got it, you people don't like PHP, try to see if I care.

Why shouldn't engineers "mock" the things that they think are badly designed? But by "mock" I mean criticize. In fact, as an engineer, it's one's professional duty to criticize bad design, as good design is essential to the endeavor of engineering progress.

Good engineering design vs bad engineering design is what prevents bridges from collapsing or Mars landers from crashing.

But I hear you: sure it's quite possible to do arithmetic using Roman numerals, and if that's what you're used to, you probably don't want to hear that you've been doing it suboptimally. And all these people clamoring for a change to decimal are just an unbearable nuisance.

Re: Coding Horror: The PHP Singularity

#268

Here we go again... Maybe it does suck. You can certainly tell it was not designed by computer scientists. In many ways, it throws away years for programming language best practices. This being said, what are the practical alternatives? JSP? Servlets? ASP? Python/Django? Ruby/Rails? What? I am sorry but JSP, Servlets, ASP, Python/Django, Ruby/Rails are just shit of a different kind. But they do not deserve that holie…

Python's Flask is a good, lightweight web framework that works fine. It was a breath of fresh air compared to PHP, and I can understand it, unlike Django.

I am open minded. I will give Flask a try.

I doubt it'll be easier to deploy than a LAMP server, though. I already recoil at the idea of having to figure out why Passenger is not working as it should, or why I should run a terrible HTTP front just to try this out.

Re: Coding Horror: The PHP Singularity

#269

Earlier quoted context omitted.

Pulling nails all day long with one side will quickly wear off that side - it won't be as sharp and you'll have to throw away the tool. Double claws will allow you to use the SAME tool twice as long (that's 99% of what you do, remember?), will avoid rotating the hammer 180 degrees in certain situations (constrained space, two nails - one on the left, one on the right) and you get to hammer an occasional (1%) nail wit…

As someone who has been hammering nails and pulling out nails for the past 8 weeks, I can assure you that hitting them with the side of the hammer is a very, very bad idea. Also, you never find yourself in a situation where you're just pulling out nails. A large number are too difficult to pull out, or will damage the structure you're pulling them from, so you hammer them down.

[deleted]

Re: Coding Horror: The PHP Singularity

#270

Earlier quoted context omitted.

Python's Flask is a good, lightweight web framework that works fine. It was a breath of fresh air compared to PHP, and I can understand it, unlike Django.

I am open minded. I will give Flask a try. I doubt it'll be easier to deploy than a LAMP server, though. I already recoil at the idea of having to figure out why Passenger is not working as it should, or why I should run a terrible HTTP front just to try this out.

It's a little bit more difficult (especially since if you want to use Apache you'd have to configure it manually), however there are plenty of Python WSGI hosts out there that should make it simpler.
Post reply on HN