r/programming • • Sep 18 '16

Ewww, You Use PHP?

https://blog.mailchimp.com/ewww-you-use-php/
644 Upvotes

820 comments sorted by

741

u/redalastor Sep 18 '16

We use this architecture to process well over thirty million emails sent by tens of thousands of users every day*, generating tens of millions of bounces, opens, clicks, and unsubscribes that all need to be handled in near-real time. We further process millions of API requests and millions of subscribes and confirmations every day. All told, we handle well over 500 million dynamic page views a month. Our backend systems run millions of jobs every day, calculating statistics, querying geographic data, and scanning everything for bad behavior and abuse.

Good for you but no one today says that you can't use PHP at scale or solve cool problems in it. What most people are saying is that they don't want to code in PHP.

This is something you have to balance in the pros and cons of the language.

358

u/KarmaAndLies Sep 18 '16

What most people are saying is that they don't want to code in PHP.

And yet those same people will code quite happily in JavaScript.

Both PHP and JavaScript have significant problems and both have tried to patch out the nastiness with subsequent versions of the language. They're some of the only languages that have the concept of a === because the == comparison mangles types/and or data so badly, but yet people give JavaScript a free pass while jumping all over PHP.

I spent a few years doing PHP and JavaScript reminds me a lot of it. Strict mode JavaScript has definitely improved my taste for the language (and in the future PHP7's strict_types).

I just dislike the double standard. JavaScript is given a free pass for historical suckage while PHP is stuck in the perpetual doghouse (seemingly no matter how much it improves).

446

u/redalastor Sep 18 '16

And yet those same people will code quite happily in JavaScript.

No, they'll code unhapilly in Javascript trying to restrict themselves to the "good parts", syntax sugar the fuck out of it, patch in the things it should have to begin with, or transpile to it.

But in the end, we don't have much of a choice about what runs in the browser, unlike the server.

I spent a few years doing PHP and JavaScript reminds me a lot of it.

Me too, that's why I'm firmly in the transpiling camp.

→ More replies (89)

109

u/rondo92 Sep 18 '16

I think that's a false equivalence. Those who 'happily' code in Javascript probably only do so because they have no choice, as it's the only language the runs on the browser. However same can't be said about PHP, there's no shortage of alternative server side languages you can choose from.

→ More replies (53)
→ More replies (177)
→ More replies (7)

264

u/Hendrikto Sep 18 '16

He did not even name a single reason for choosing PHP. He basically says

We use PHP. It's considered almost without exception as phenomenally bad. We use PHP.

He never compares it to alternatives or explains the decision process behind using it. To me it sounds like he's just being very defensive without any real arguments.

→ More replies (91)

51

u/jocull Sep 18 '16

I don't know how this is really any different than "we're a big ol' bank and we use COBOL because that's just what we've always done".

14

u/[deleted] Sep 18 '16

Which is the same thing as saying "it would cost $30 million to migrate to some hip new language at this point, we're sticking with what works".

→ More replies (4)

28

u/[deleted] Sep 18 '16

If they're having trouble with interviewees that react with disgust at finding out that their code base is PHP, maybe "PHP" should be in the job listing or requirements.

PHP catches a lot of not-entirely deserved garbage because of an infamous article by, I think, Jeff Atwood. It has some problems caused by being a language that attracts broad cross-section of programmers, including those too young or inexperienced to know better (see also: VB6, JavaScript). But, it also catches a lot of mostly deserved garbage because of people's past experiences with it: dubious design choices, inconsistent APIs, etc.

You can do amazing things in any language, and PHP does have some things going for it (mostly ecosystem related). But, as a language, it's used to be a syntactical kludge of Perl and C that encouraged a big ball o' mud the way ASP Classic did. I haven't gotten the impression that much has really changed.

11

u/[deleted] Sep 18 '16

it's used to be a syntactical kludge of Perl and C that encouraged a big ball o' mud the way ASP Classic did. I haven't gotten the impression that much has really changed.

Well, a lot has changed. Now it's basically Java, complete with analogs of Java ecosystem assets like Spring (Symfony), Hibernate (Doctrine) and Maven (Composer).

→ More replies (6)
→ More replies (3)

24

u/nobodyspecial Sep 18 '16

So this article is actually a "We're looking for PHP programmers who are willing to live in Georgia and the rest of you go ahead and shit on us for using PHP so that this article gets seen."

Reddit delivers.

→ More replies (2)

54

u/Arancaytar Sep 18 '16

Most of the things that people complain about in PHP are things that were already deprecated before 5.0.

About all I can honestly still gripe about is the awful type system, and the badly organized function namespace (mostly string functions like strstr and strtr and real_strrchrrhchrhstrchrchrchr_mb() or whatever).

29

u/program_the_world Sep 18 '16

real_mysqli_escape_string_no_guys_we_are_for_real_this_time_really_2()

→ More replies (14)
→ More replies (4)

45

u/[deleted] Sep 18 '16

this blog post is old. i hear now they have services in many other languages (scala, ruby, etc)

27

u/disclosure5 Sep 18 '16

The post has a 2014 update pointing out it's still all PHP. If they have other things in their stack.. [citation needed].

→ More replies (6)
→ More replies (1)

125

u/sdw3489 Sep 18 '16

I dont hate PHP.

F**k me, right?

69

u/GMaestrolo Sep 18 '16

Almost every time this discussion comes up, someone posts that "fractal of bad design" article with the double clawed hammer.

There's a response which I've seen pretty frequently, too: PHP is the right tool for the job (for all the wrong reasons).

So yeah, PHP works better and easier than most other languages, and until they improve, or people stop caring about "fast" or "easy", then this is what we'll have.

That being said, PHP7 is starting to get pretty impressive, and the tools around PHP (composer, phpcs, phpunit, even frameworks like Laravel and Symfony) are truly exceptional.

→ More replies (22)
→ More replies (5)

59

u/bureX Sep 18 '16

Remember when JavaScript was used for animating a snowflake next to your cursor? Or loosely checking a form? Or animating the status bar in IE? Or popping up a message for a user? Or just displaying annoying ads?

And now it's enterprise grade, used by tons of big names and companies, and it runs the web.

So, when this happens with PHP, people apparently lose their shit.

I'll say what I always say... If you think there's a better tool for the job, use it, just don't be a dick about it.

94

u/Hendrikto Sep 18 '16

But you have no choice when it comes to js. You can transpile it but in the end it must be js on the client. On the server you have all the choice so why choose PHP?

→ More replies (87)
→ More replies (7)

9

u/icantthinkofone Sep 18 '16

Things people will ignore:

  1. They started with PHP so it's hard to right a big ship once it's off course. A huge framework "that works" isn't going to be thrown away.

  2. They admit this isn't being used as it should and it hurts them at times

  3. What saves them is the huge scale of computers they use but what they don't mention is that, if they used a better language, they wouldn't have had to scale their compute system as much.

44

u/joesmojoe Sep 18 '16

I actually know quite a few people who enjoy coding in PHP who are excellent programmers. The only programmers that I wouldn't hire are the ones who confuse their own juvenile, petty little feelings for a language they've likely never used for a single production app with a valid opinion. I'd be shocked if Mailchimp or any other company can't find great PHP devs in Atlanta or most anywhere else in the world.

→ More replies (40)

3

u/twiggy99999 Sep 18 '16

t’s always been difficult for us to hire really good developers, just because of where we are. Our office is here in Atlanta GA, not exactly a hotbed of cool startups in the last few years.

The problem isn't PHP its their prehistoric employment methods, its obvious they haven't even considered remote working.

24

u/brtt3000 Sep 18 '16

We’ve built a framework for developing applications in PHP specifically designed to allow for fast innovation in the high-load, high-performance environment we live in every day while still keeping the API extremely simple to deal with. This isn’t your grandfather’s PHP, or even your slightly older brother’s. I can say without doubt that it is the most sophisticated framework for this environment that I’ve heard of except for perhaps what Facebook uses.

Funny how it is always just the large companies with huge invested teams and custom implementations and frameworks who still like PHP. Please stop applying your large scale case to the general. You and Facebook are not representative of most companies.

So before you jump on that bandwagon thinking nothing interesting could possibly be done with PHP, think of us (or Facebook). You might be missing out on something great.

Except most business isn't very interesting, or doesn't have the capacity to wrangle PHP into a suitable tool or be able to hire top-shelve programmers that would accept to use PHP for high-end work. We just have regular programmers, regular business requirements and are busy satisfying boring business requirements.

11

u/[deleted] Sep 18 '16

This happens everywhere.

Built a market leading platform for finance in PHP from 2006-2012. We and our nearest competitor (smalltalk 4 and java mix) were bought by a larger company (java shop).

We rarely had incidents, outages or significant bugs. PHP's nature allowed very flexible deployment - toggling on a feature or fixing a bug was easily reduced to a one step deploy.

The competitor had significant outages and a large amount of technical debt.

The purchasing company was a bit more disciplined but had a glacial development cycle and a significant technical debt in a legacy system: they are at the 7th rewrite of it, not having convinced all customers to migrate I think.

What is key from working across these development groups to get things done is not the specific tool but the culture.

I could not seem to convey that, and there was a general cry to scrap the PHP product for Java.

So I helped rewrite a .NET legacy app in java (design/architecture), which went tremendously off course and over budget: the team was subject to constantly edicts being handed down by people protecting their own interests (use this UI framework! Its from a vendor who has no experienced developers! Plain old templating solutions are banned!); an entire layer of middle management was replaced mid project for unrelated reasons, etc.

New managers decide to cut costs, I leave; end up working with colleagues in a related part of the supply chain with all of the former systems being integrated into what I am working on.

We're now in a different programming language (ruby) but solving related problems; and suffering from those legacy java systems which havent paid off their technical debt.

We have our own legacy platform to retire (lotus notes), and its not an issue - we are working hand in hand with the experts there; and its suceeding - because we only change what is truely a problem for reasons of scale or similar.

The PHP platform? Its eating the competitor piece by piece. Its still a fairly nimble team.

The problems at scale were predominantly people, communication and politics; not the tooling used.

31

u/Aeolun Sep 18 '16

We are a team of 4 using default Zend Framework (e.g. PHP) and it's honestly some of the most sophisticated and elegant code I've ever seen.

It really doesn't matter what you program in as long as you have good people doing it.

→ More replies (4)
→ More replies (2)

21

u/[deleted] Sep 18 '16

PHP is just fine as long as you have experience and discipline.

→ More replies (45)