TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ewww, You Use PHP?

276 点作者 moozeek超过 14 年前
http://www.mailchimp.com/blog/ewww-you-use-php/

50 条评论

hackoder超过 14 年前
What you need to understand (and most of us hackers too) is that there is a difference between the 'hacker' and 'get shit done' mentality.<p>Programming is something I've done for the last 10 or so years (in various forms). It is essentially the only activity (in terms of 'work' or career) that I enjoy. The engineer in me just enjoys making things 'perfect' (where perfect is a definition perhaps only I understand, but generally its something built on solid engineering principles. Well-tested, reliable, modular, efficient, etc). When code looks 'just right', I enjoy the code regardless of whether it is bringing me any $$$. In that sense, for me, engineering is a fun activity, and not 'work'.<p>The hacker in me will enjoy a well built piece of software for its engineering brilliance regardless of whether the software got anything done at all.<p>In the last year or so I've been able to isolate these personalities and perhaps merge them. I do not scold the hacker just because he wants to try out new languages every month and is opinionated about his favorite ones. I get pissed off when this stops him from getting shit done.<p>I'm glad for the hacker in me who cares deeply about the tools (languages, IDEs etc) that he uses. Its this hacker that makes my job 'fun'. It is this hacker that has helped improve the quality of my code and my thought process for building good software. The 'getting shit done' would never have been enjoyment enough if it were not for the hacker.
Raphael_Amiard超过 14 年前
I think you can write good software in any language. Moreover, PHP is a powerful language, in its last versions at least, it's just that the way it has been developped would make anyone serious about programming language developpment vomit.<p>But that's not really a problem.<p>I guess the problem is not that good devs can't code in PHP. And when they focus on the task at hand, they might not even notice. Because PHP has everything you need. I'd prefer coding a website in PHP than in Java, C, or C++, because PHP is dynamic, has first class functions and the kind of stuff you need to be expressive.<p>One of the problems is that if you think too hard about the fact that the language you use is suboptimal, it will affect the pleasure you take from doing your job.<p>The other problem is that a lot of PHP code is really horrible, so people have grown to associate PHP with bad code.
pornel超过 14 年前
PHP's warts are shallow — syntactical quirks, disorganized standard library, idiotic config options.<p>In practice you disable stupid options, don't use quirky parts of the language, set up your IDE to autocomplete functions, and PHP stops getting in the way.<p>What you're left with is a decent OO language, which recently got namespaces and closures.<p>It's OK speed-wise (with APC) and has got stable implementation.
评论 #1819241 未加载
评论 #1820619 未加载
评论 #1819304 未加载
评论 #1819108 未加载
评论 #1819118 未加载
nir超过 14 年前
"Despite its popularity, PHP is considered by the programming elite, almost without exception, as one of the worst languages currently in use today"<p>I would say, the blogging-about-programming elite, rather than the actual <i>programming</i> elite. I haven't coded PHP in years, but some of the most brilliant devs I know use it when it fits the task.
评论 #1819123 未加载
评论 #1819053 未加载
评论 #1819215 未加载
mgkimsal超过 14 年前
Someone else may have mentioned something like this, but I can't find it, so I'll chime in.<p>Transitioning to Ruby or Python or Scala or anything else will not make anything magically better. I recently converted a Rails project to Grails (actually, I'm in the middle of the conversion). I'd thought "it's Rails - we'll just go in and fix the current issues". It was a horrid nightmare of undocumented crap. It was started in 2006 - Rails 1, and had been added on to for nearly 4 years, and was still Rails 1 (1.2). No useful inline comments, no unit tests, undocumented magic method overrides for basic stuff that wasn't compatible with future Rails versions, and so on. It was horrid. But hey, it's Rails, right? Must be magically better than PHP!<p>I went back and forth on whether to rewrite in PHP or Grails, and either would have been fine. Why? Because part of the rewrite process is to use modern techniques - with a big helping of TDD tempering the process. Oh, and version control. Yeah - 4 years of a project with 0 version control is not fun to deal with.<p>So... I'll take PHP with a team of people using sane schedules, TDD/testing, version control, internal and external documentation, and other niceties, over Ruby for the sake of Ruby. Now, modern Ruby/Rails with all those niceties vs PHP with same niceties? Probably a more even draw, with no clear cut choice. But that doesn't seem to be brought up in these discussions.<p>Frankly, most of the stuff people point to as awesome about Ruby (or Groovy, in my case) in isolation can be detriment - metaprogramming in general can be confusing to someone new to the code without proper documentation as to what's being done. Whether those docs are in tests, inline or external is beside the point. Typically when I come in to a new code base in any language the documentation just doesn't exist (or, better yet, it's "self-documenting"... right...).<p>End of rant - PHP really is fine when used with proper development techniques. Most languages are. In my experience problems start (and get worse over time) when people rely exclusively on the <i>language</i> alone, rather than language + commonly accepted dev techniques.
评论 #1819703 未加载
评论 #1819589 未加载
cosmok超过 14 年前
I use PHP at work for creating not only web applications but, also to do a lot of non-user facing backend stuff. It's great to know that someone out there is using PHP at a much bigger scale for backend stuff.I hope he shares more technical details. If you don't like PHP, fine, but, don't think all PHP programmers are stupid.<p>I once had a Python programmer looking at the kind of stuff that I was doing with PHP and he was surprised that such things could be done in PHP.<p>This is an actual conversation that I had in a meetup:<p><i>Guy1: If PHP were to disappear, it would bring down a lot of the web with it, wouldn't it?<p>Guy2: Nah, but, that would be the case if Java or .net were to disappear.<p>Me: (to myself)Wtf!<p>Guy1: But, most of the links that I click on the web end with .php.<p>Guy2: um.....<p>Me: (to myself)pwn3d!</i>
评论 #1819103 未加载
csomar超过 14 年前
I really don't understand why a language is so important. Since you have your own VPS or dedicated server, you can use C or any other programming language, create executables that do complex and targeted work and send the result to PHP, rails, python... You can use all of the languages at the same time. It really doesn't matter what main language you are using for routing your websites.<p>PHP is cool. I have found (<a href="http://fatfree.sourceforge.net/" rel="nofollow">http://fatfree.sourceforge.net/</a>) and I couldn't be happier. It's similar to Sinatra and has everything a small app needs. It's simple and make separation easier. But if I need that complicated data structure processing that can be done with python or perl, I'll just write down that script and run it through php and get the results.<p>Between, this statement makes no sense for me<p>&#62;&#62; This is just going to get bigger and bigger as we grow by 500% or more _every year_
评论 #1819229 未加载
pirko超过 14 年前
Link to the actual blog entry: <a href="http://www.mailchimp.com/blog/ewww-you-use-php/" rel="nofollow">http://www.mailchimp.com/blog/ewww-you-use-php/</a>
评论 #1819033 未加载
dunk010超过 14 年前
The web stack at Last.fm is PHP, for better or worse. It's certainly not a pretty language. Or consistent. Or advanced. I've got a theory on why so many large websites use PHP though - from Facebook, through Flickr, Yahoo and Last.fm. I think it's a combination of PHP being the best option available at the time many of these large websites were set up, and it being a very simple language. Yes, I actually think that can be an advantage. In PHP you don't spend any time beautifying things. You don't bother writing "clever" code because you can't, really. Writing in PHP pushes you towards making "the simplest thing that could possibly work" - which is so in sync with the most fruitful startup mentality.<p>It doesn't mean I like it though. It's still as ugly as sin. After all these years programming it I still get thrown by ($needle, $haystack) ($haystack, $needle) and have to look up which variant this particular function uses. I'd much rather be doing it all in Ruby. Or Lisp.
评论 #1821186 未加载
staunch超过 14 年前
Why not transition to a different language over time? One that more great programmers want to use?<p>There's no reason they couldn't (over the course of years) move to another language. I'm not suggesting a total rewrite, but they could start writing entirely new subsystems in a new language. It's very rare to have 100% of your code in one language anyway.<p>Recruiting great programmers is one of the most important things in a software startup. Why stick with PHP if it makes that far more difficult?
评论 #1819065 未加载
评论 #1819081 未加载
ucheokeke超过 14 年前
What's so bad about PHP? I’d assume the goal in web development is the end product or service and not the means to it. It seems easy to miss the forest for trees, and delve into cult-like arguments of whatever software stack is hip.
评论 #1819320 未加载
评论 #1819049 未加载
thenbrent超过 14 年前
I used to be in the "eww, PHP" crowd, but only until I <i>really</i> started using it.<p>It doesn't have to be the security blackhole or spaghetti monster it's made out to be.
评论 #1820042 未加载
pilif超过 14 年前
I'm maintaining a huge web application mostly written in PHP. We (well. back then it was just me) began doing this back in 2004.<p>Back in 2004, PHP was a very sensible solution: It was the language I knew best (we had little time for the project, so going with a language I knew felt sensible), it was easy to deploy and back then, there weren't that many alternatives anyways:<p>Ruby was in its infancy, for Python you had thread safety issues with mod_python or you went CGI, Java was and continues to be just ugly. JavaScript back then was still just a toy language. No Node.js or anything.<p>That would have left me with mod_perl, but looking at where we are today, that would have been an even worse decision it seems.<p>Fast forward 6 years.<p>The application consists of over 100'000 lines of PHP code alone now. It's in production use for many customers which serve tens of thousands of end users. It's not only a traditional web application, it also serves as an API for custom-made tablet pc applications (before we had the iPad), for GPRS-connected barcode scanners and last, but not least, for native Windows Clients (all developed by our company, using various languages).<p>While I really hate some aspects of PHP by now and I would love to have a Ruby or Python codebase to work with instead, rewriting all of this is out of the question.<p>Customers depend on this to work exactly the way it works now (they panic even if a link is two pixels off - welcome to the enterprise).<p>While I might be able to exchange some components with something else, I don't see the benefit it would provide - it would do nothing but make maintenance harder because I'd add another dependency to keep track of.<p>The only thing I could do is rewrite the thing. But by now, there's more than 30 man-years of work that went into this.<p>Sure. Redoing it wouldn't take the same amount of time, but considering it would have to look exactly the same (probably I couldn't even get customers to accept different URLs), where's the point in that?<p>OTOH, despite being done in PHP and tailored to sometimes crazy customer requirements, the code base is sufficiently clean to work with and it's constantly improving. Bad parts get factored out, good parts arrive, so it's not all-bad.<p>We are embracing new technologies as they become available and fit our product. Our CSS is now written in SASS, we moved from pure DOM scripting to Prototype to jQuery, we make use of the latest features of PHP (now Closures and anonymous functions from 5.3) and of our database (constantly running latest Postgres).<p>Even though it's PHP, it can still be fun.<p>Considering recruitment: Granted. It might be harder to convince a good programmer to work on this "ugly" PHP project. But a) we are not just doing PHP (just mainly), b) the code base is, as I said, quite clean and c) even though the code base might be in a language you don't like, the basic concepts of our profession still apply.<p>You can still discuss and solve interesting problems and you can still create great solutions to these problems.<p>If you don't want to take part in this adventure just because you don't like the language this is done in, then, frankly, you are not the person I want to hire.<p>Even though programming is the coolest thing you can do on this world, it's <i>still</i> a job and not everything can always be unicorns and rainbows. If you can't see this, then I don't need you.
评论 #1819235 未加载
评论 #1819207 未加载
评论 #1819172 未加载
评论 #1819593 未加载
评论 #1819558 未加载
评论 #1820505 未加载
评论 #1831994 未加载
评论 #1819332 未加载
评论 #1821237 未加载
评论 #1819333 未加载
nadam超过 14 年前
"So before you jump on that bandwagon thinking nothing interesting could possibly be done with PHP"<p>The problem is not that nothing interesting can be done in PHP. Lots of interesting can be done in any Turing complete language. It would be just 'plus points' if you would use for example Scala for the kind of task you described. I just cannot see why to use a dynamic language in a task where performance is important when there is a statically typed fast language which is as good and as concise as Scala. It is not that it is impossible that I would join a company developing in PHP. We have to make compromises all the time. It is just that developers evaluate companies, and join the one with the most 'plus points'.
Revisor超过 14 年前
In this context I'd like to quote Peter Norvig talking directly here on HN just a few days ago (in this case about Lisp vs Python):<p><i>In terms of programming-in-the-large, at Google and elsewhere, I think that language choice is not as important as all the other choices: if you have the right overall architecture, the right team of programmers, the right development process that allows for rapid development with continuous improvement, then many languages will work for you; if you don't have those things you're in trouble regardless of your language choice.</i><p><a href="http://news.ycombinator.com/item?id=1803815" rel="nofollow">http://news.ycombinator.com/item?id=1803815</a>
billpg超过 14 年前
Is it good software thanks to PHP, or in spite of PHP?
评论 #1819043 未加载
评论 #1819055 未加载
评论 #1820429 未加载
Tichy超过 14 年前
I have no doubts that complicated things can be done in PHP. Complicated things can and were being done in Assembler, too.<p>It just is a red flag and makes me wonder about the sense of taste the developers at a PHP company have. Therefore it would take a lot to convince me that working for them is "alright". If they have bad taste, how are they supposed to write nice code?<p>Having to learn their proprietary solution to scaling issues only is not as tempting as it sounds. Yes, I am interested in working with scaling problems. But learning a proprietary PHP hack is not going to help my CV that much.
joelmichael超过 14 年前
I am a Ruby on Rails programmer from the early days. It is my platform of choice. And yet, I still have massive respect for PHP. For me, it's the next best option.<p>I worked in PHP for five years before I worked in Rails, and I think PHP is a great language for web development.
评论 #1819130 未加载
sp4rki超过 14 年前
In this day and age the only real reasons to use php is because you're either stuck with it and changing the code base makes no sense since you already have a product built, because you're new and don't know any better, or because you've been doing it for such a long time that you're so used to it you don't see the languages faults anymore.<p>One of the applications I maintain is a convoluted machine made of half java half php on top of Quercus, and if freaking drives me crazy. I think the only thing I hate more than that is working in ASP.
wildmXranat超过 14 年前
Well, I experienced a reverse ewww when I was interviewing at Amazon for an Imdb job. As soon as I mentioned that my previous employer used PHP, I had a very short and quite frank answer: Oh, what for? PHP is such a bad language. So bad, that nobody should use it.<p>I was kind of floored since I didn't exude a fan-boy mentality, I was simply answering the questions. That was more of an inner chuckle, but I wasn't surprised by his answer at the end of the day. By the time the interviews ended, I realized that PHP might be the last thing these guys will look at.<p>Coincidentally, I took another offer where the core is PHP + Symfony + Doctrine. I was very impressed at how well behaved, structured and developer friendly a good source base can be, no matter the language.
robryan超过 14 年前
The trend I've noticed n recent years is that the PHP developer has to defend himself when talking about language choice, much like someone who decides to use .NET.<p>People never see the same need when starting a project in rails, even if it isn't that great a fit. One advantage PHP has for me is that nothing is abstracted away in a way that I don't understand the underlying components because I'm writing my own framework. Sure certain aspects I'll grab some cade as necessary but in general everything I'm doing I've either written it or parts of it myself.<p>I get all the semantic language arguments against PHP and largely agree, this has become less of a problem for me though with experience.
pbiggar超过 14 年前
My bank supports billions of dollars of transactions per day. But they use COBOL, so I will never work there.
petsos超过 14 年前
These quotes from PHP's creator are very enlightening:<p><a href="http://en.wikiquote.org/wiki/Rasmus_Lerdorf" rel="nofollow">http://en.wikiquote.org/wiki/Rasmus_Lerdorf</a>
mustpax超过 14 年前
Can someone fix the link? It's pointing to the front page for the blog, the blog post is here: <a href="http://www.mailchimp.com/blog/ewww-you-use-php/" rel="nofollow">http://www.mailchimp.com/blog/ewww-you-use-php/</a>
code_duck超过 14 年前
We always hear about Facebook using PHP as a justification for it.<p>Unfortunately for this line of thought, Facebook wanted to move away from PHP 3-4 years back, specifically to Python I believe, and realized it would be too much work to rewrite their entire front end. So, they're trapped in PHP, not using PHP because they think it's the best choice.<p>This was mentioned in the article announcing HipHop.
jarin超过 14 年前
I used to be a PHP programmer, and now I'm a Ruby programmer. A lot of great things have been built on PHP, I just don't like coding with it. To the folks who build great things on PHP, more power to them.
评论 #1822690 未加载
juice13超过 14 年前
I work as a developer at a stock exchange. My department wrote and maintains several business apps in PHP, including a report generation framework and several realtime clinet/server apps.<p>I find it reliable, reasonably powerful and easy to use. It's major strength is brilliant documentation on the official web site (this is a major downside to Python in my experience).
yoyar超过 14 年前
As someone who's written tons of Java/J2EE etc... and who's been writing PHP for several years, I don't get all the PHP bashing. I've seen tons of garbage code in Java, and in PHP. And I've seen amazing things done with both. It's a poor carpenter that blames his tools. And yes, for many tasks I opt for PHP, because it is fast for both implementation and performance. It's fun and it works really well, as long as you know what you are doing. How's that different from Java, Python, Ruby etc...? One more thing, if you want to judge a language based on how much trouble you can into, what about C? Or what about the threading and memory leak issues you can run into in Java? I mean, all of these languages have massive pitfalls and none of them can effectively stop a bad programmer from doing bad things.
corin_超过 14 年前
"So before you jump on that bandwagon thinking nothing interesting could possibly be done with PHP, think of us (or Facebook)."<p>Before I jump on this bandwagon I think I'll forget all about mailchimp, and think about all the many, many, <i>many</i> great companies (such as Facebook) that use PHP.
nervechannel超过 14 年前
"Email marketing" + "I thought you were cool" = cognitive dissonance
poink超过 14 年前
PHP is fast and just about everybody "knows" it (which is a curse as much as a gift). But as someone who made a living writing PHP and made the jump to another language:<p>a) I find it more enjoyable to program in other languages.<p>b) I can generally get things done more quickly in other languages (feel free to ignore this point if you're the opposite :P).<p>c) Aside from speed, ubiquity, and the docs on php.net (which are <i>awesome</i>), I don't really get anything out of using PHP.<p>d) People will pay me more to program in other languages.<p>So yeah, I suppose my first reaction on reading "PHP" in any job description is "Eww". It's not really because I think PHP is wholly unsuited for programming, though. It's just not optimal for me, personally.
brisance超过 14 年前
The "cool factor" of a language is inversely proportional to its popularity.
评论 #1820394 未加载
评论 #1819348 未加载
评论 #1819137 未加载
Yaggo超过 14 年前
As opposed to its peers (eg. Ruby, Python), the original PHP was not a programming language but just a collection of tools for HTML preprocessing. Although the current PHP has nothing to do with the original one, and PHP 5.3 actually has pretty nice feature set with namespaces (finally!) and anonymous functions, its "non-academic" roots still show off as general ugliness. That's why I wouldn't recommend PHP to anyone as their first programming language (been there, done that, nowadays a Pythonista).
klochner超过 14 年前
PHP devs are the silent majority.
nopal超过 14 年前
Can an admin update the link to: <a href="http://www.mailchimp.com/blog/ewww-you-use-php/" rel="nofollow">http://www.mailchimp.com/blog/ewww-you-use-php/</a><p>The submitted link requires clicking a "More" link in order to read the full entry. (And it will be out of date once they post another entry on the blog.)
Keyframe超过 14 年前
I picked up PHP because it was like C (which I use since I was born) with training wheels and some quirks.<p>It gets the job done, sometimes spectacularly, sometimes not so very much - depending on who did the work. It's a workhorse, and has been demonstrated as such millions of times so far. Performance depends a lot on deployment strategy, but it can be fast.<p>I really see no point in bashing PHP. It's a tool, it has tons of documentation, libraries and available helpful people. Sure, I'd like to have some tweaks here and there, but with what tool wouldn't you?<p>There is a saying around here, roughly translated: Rusty cock minds every(single) pube.
mcmc超过 14 年前
I have been contracting for a company that has an in-house version of this tool. We are able to push about 10 million emails a day, including processing bounces, click, unsubs, etc, with a fairly straightforward set of python scripts. Its not about the custom logic, its about choosing the right basic building blocks.<p>Based on my experience, I doubt they need their "highly sophisticated" PHP to do this -- plain old normal PHP would probably be fine so long as they choose the right out-of-the-box software to pair it with. (nginx, postfix, certain non-sql databases, and the right mysql setup)
hdeshev超过 14 年前
Everyone has to make his/her choice of technology and MailChimp has chosen PHP. That's perfectly okay.<p>I know PHP, and I've used it to put food on my table. Luckily that is no more. I'd consider doing PHP again only if my wife and kid were starving.<p>My advice to people stuck with PHP codebases - start changing the site backend first. Write everything not related to spewing HTML in a real programming language, and slowly limit PHP use as a simple template-processing tool that generates your app's HTML. Which is probably the only thing PHP is good for.
kloncks超过 14 年前
I grew up coding in PHP and still love it to this day, so I agree with the basic premises of this article.<p>The one thing that bothered me was towards the end. In trying to justify PHP's coolness (which I am not arguing against), people continuously bring up Facebook as an example, even though they've repeatedly stated that they wanted to move away from PHP to Python years ago but realized they couldn't after having hundreds of thousands of lines in PHP.<p>PHP's cool. I love PHP. But, let's stop using Facebook as an example of a company "embracing PHP".
JimmyRuska超过 14 年前
PHP is a pretty decent lazy language, it just could give rise to bad habits. It also has a few odd irregularities in the naming of functions/argument order. It's just a massive arsenal of functions for everything. For example if people want to manipulate a string or array, newbies will often not pay any attention to how often it gets iterated through redundantly. They just use a bunch of functions that do what they want magically.
smiler超过 14 年前
I have to say, I code in .NET during the day and have been considering ruby / python for my own projects because the hosting costs are a lot less. I used to do a lot of PHP and I keep thinking I should just stick with that.<p>Although it feels 'dirty', the only thing I consistently read about ruby &#38; python web apps are deployment issues and exactly the best way to deploy those apps.<p>With PHP it seems very straight forward and an easy way to avoid all those issues.
评论 #1819239 未加载
评论 #1819978 未加载
评论 #1819226 未加载
评论 #1819284 未加载
alexyoung超过 14 年前
I don't understand the "PHP is fast" comments. Whenever I've had major scaling problems with PHP or anything else it's been due to IO rather than a fundamental issue with whatever language I was using.<p>The things I did to fix the performance problems are generally language agnostic. Improved database architecture, search indexer configuration, clustering, memcache, etc.
评论 #1820446 未加载
lusis超过 14 年前
Speaking specifically of mailchimp, I interviewed with the a few years ago. They are a seriously cool company. If you ever get a chance to talk to Chad, ask him to tell you the story of DDoSing Mechanical Turk. Ignore the language they use, mailchimp is an amazing analytics company.
shawnzizzo超过 14 年前
Does your customer care which programming language you use? The true test is if the application that was developed meets the requirements of the customer/consumer. I don't develop for other developers; I develop for customers that want the app to work.
bombarolo超过 14 年前
&#62; thirty million emails sent by tens of thousands of users every day<p>Damn! Are these all spammers?
btilly超过 14 年前
<i>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.</i><p>He hasn't heard of Google? :-P
评论 #1819510 未加载
trustfundbaby超过 14 年前
I think this is the money quote in the article<p>"Once you get to the scale of computing we’re at, the language you use is much less important than the platform you build on it."
coolgeek超过 14 年前
moozeek -<p>It's 2010 - link the post, not the blog
评论 #1823039 未加载
pkulak超过 14 年前
Oh well, you built your own framework. That changes everything!
igorgue超过 14 年前
"Get out of languages, platforms that's the important thing" - Zed Shaw said something like that a while ago