Live data from Hacker News

Taking PHP Seriously

slack.engineering

461–470 of 673 posts

Re: Taking PHP Seriously

#461
post #391

Earlier quoted context omitted.

Not nearly so much as customer happiness does.

Decent developers don't want to work on shit code bases all day long. The application will suffer in the long run.

Agreed.

I'm not going to make any customers happy working on a product if I hate the codebase and the language I'm working in so much I just DGAF.

Re: Taking PHP Seriously

#462
post #410
post #323

Earlier quoted context omitted.

> It's a garbage language, and you know it. But it allows you to get something up and running, so dang quick. PHP didn't succeed because of the "language" part. It succeeded because it was limited and focussed to just being a tool to write small web-apps in a short time. It did one thing and did it better than anything else of the same era (I built CGI apps in C, Perl and Python before discovering PHP). It was just f…

> It did one thing and did it better than anything else of the same era I would argue that it still does. It's not a great language, but to just get something working I still can't think of anything better that doesn't require lots of planning or infrastructure

Getting up and running with Python + Flask is trivially easy.

If you think it's not then there's something else going on you're not addressing...

Re: Taking PHP Seriously

#463
post #16

I work on PHP at my day job (in a public company), before this, I came from Ruby, and .NET before that. I'm convinced the reason so many successful projects use PHP, is not because of any inherent nature of the language. I think it's the people who use it. They just don't care. A successful project needs to be started by someone that cares just enough, but not too much. If you're programming in PHP, you're not runnin…

This is so true from my experience working for companies using PHP. You can advocate all you want to clean up code, but in the end, if it doesn't create a new feature its not going to happen.

Re: Taking PHP Seriously

#464
post #96

Earlier quoted context omitted.

This sounds like to me you are mistaking the popularity of PHP with the proficiency of the developers. PHP has been around a long time and is used by lots of people. Even if PHP projects only have a 1% success rate and haskell projects have a 20% success rate, guess which one will have more "successful projects".

I think the point is that for most "tech startups" they are marketing-first and tech-second. If PHP gets you to first base (MVP) in 10% of the time than NiceLangX then you get 10 X more chances to throw shit at the wall and see what sticks.

Right, but the point I was making is that it isn't necessarily true that PHP is any better at getting to MVP based on number of successful projects alone.

Re: Taking PHP Seriously

#465

Earlier quoted context omitted.

That's because many dislike prototypical inheritance. It's perfectly usable. As for misspelling field names, the same is true for variable names in both languages, and many things in many languages. Here it's more justified, as JS semantics mean that the language can't know your intent in this case: check your spelling.

> As for misspelling field names, the same is true for variable names in both languages, and many things in many languages. No. This code causes an error in PHP: $name = 'John'; echo $nmea; // error class A { public $name; } $a = new A; echo $a->nmea; // error This code doesn't raise an error in JS: var a = { name: 'John'; }; doSomething(a.nmea); // no error So with JS you learn about errors later and spend more time…

I would imagine your doSomething JS function will fail and produce an error in the logging console because doSomething is probably not expecting to receive an undefined. Unless you've written it to handle that scenario and fail gracefully which is probably a good thing to do anyway.

Your whole example is silly. Stuff like this is why you write your PHP/JS/Python/Ruby code in a tool like WebStorm/PyCharm/RubyMine which does enough code analysis to realise you've made a typo and flag it.

Re: Taking PHP Seriously

#466

Earlier quoted context omitted.

It would be an outlier company indeed who held an 'all hands on deck' meeting and said, "We're succeeding in spite of PHP everyone!" Only engineers care about programming languages. Seriously. That's it. No one else cares about them. I work in a large public university alongside a revolving door of student interns who are always 19. In 10+ years of work, I've still yet to meet the person who talked about their favour…

Developers care about cognitive load, and people care about security. Sure, they'll be some guy who's memorised all of PHPs quirks, but for most of us the inconsistencies make it hell to program, because you're always looking up stuff. As a result, writing secure PHP is possible, but far harder than it should be. IMO the laughable security track record of e.g. Wordpress have damaged PHP's reputation more than anythin…

As a counterpoint, Facebook, one of the most secure companies in the world, is also the largest single PHP deployment in the world.

C is also a language with a frankly horrific security track record; at least an order of magnitude more so than PHP. But C continues to be used because it is a useful and relatively simple language despite its warts and pitfalls.[1]

Security is just as much a business process as it is a technical feature.

______________________

1. Granted, one of the major design goals of Rust is replacing C, but you get the point.

Re: Taking PHP Seriously

#467

Earlier quoted context omitted.

> A prototype isn't a class: it's another object. When a method is called, or a variable is looked up on a JS object, JS scans up the prototype chain, all the way to Object.protype. A type in Python is also just another object. When a method is called, or a variable is looked up on an object, Python scans the MRO (effectively the same thing as the prototype chain, except it supports multiple inheritance too) all the…

That looks the same, but conceptually (and actually, code-wise), that's not what JS is doing. Here's what's actually happening, in psudo-python: class Person({name:"bill", addr:"foo"}): #there's no syntax for object literals in Python #such a thing doesn't even make sense: so I'm improvising. pass charlie = Person() charlie.name = "charlie" charlie.addr = "baz" class NewPerson(charlie): #note charlie is an object, no…

I notice you conveniently ignored the meta-programming capabilities of Python which would allow your "nonsensical" improvisation to work just fine.

Brush up on your Python skills before talking rubbish.

Re: Taking PHP Seriously

#468
post #415

Earlier quoted context omitted.

>php's performance was an order-to-two or magnitude better than rails Again PHP (the language) vs. Rails (the framework). What framework was that `big php app` using?

> What framework was that `big php app` using? PHP is a framework. True it's not a particularly nice one, and some people build even more layers on top, but it comes with all manner of HTTP/url/DB/etc. stuff out of the box. It's also a templating language (that's what the "<?php" tags are for); although, again, not particularly great, and some people layer more abstractions on top.

Very true. It's basically an interface to a C framework.

Re: Taking PHP Seriously

#469
post #415

Earlier quoted context omitted.

>php's performance was an order-to-two or magnitude better than rails Again PHP (the language) vs. Rails (the framework). What framework was that `big php app` using?

> What framework was that `big php app` using? PHP is a framework. True it's not a particularly nice one, and some people build even more layers on top, but it comes with all manner of HTTP/url/DB/etc. stuff out of the box. It's also a templating language (that's what the "<?php" tags are for); although, again, not particularly great, and some people layer more abstractions on top.

In the sense of comparing PHP and Rails, then no PHP is not a framework. Codeignitor, Laraval, Cake, Yii; those are PHP frameworks and fair comparisons to Rails.

I can (and have) just grabbed Rack and rolled most everything myself in Ruby and it has way less overhead and is much more performant than Rails. Ruby also has it's own templating language; ERB is part of Ruby core.

So comparing PHP to Rails is a bit apples and oranges.

Re: Taking PHP Seriously

#470
post #4

Earlier quoted context omitted.

The language is not beautiful, it is full of signature and func naming inconsistencies [1] it inherited from C. The devs are ultra-conservative and stubborn to cause BC even at major version bumps (like the forever-incorrect ternary associativity [2][3]). But PHP7 is both fast and productive with many modern first-class features. You can in fact write excellent code without much effort that will handily outperform Py…

> The language is not beautiful, it is full of signature and func naming inconsistencies [1] it inherited from C. It was consistent with the thing it inherited most of it's syntax from so that makes it inconsistent? > The devs are ultra-conservative and stubborn to cause BC even at major version bumps (like the forever-incorrect ternary associativity [2][3]) You shouldn't be judging the way operators work in one lang…

If what it inherited from was inconsistent, why wouldn't it be too?
Post reply on HN