25 ms·
Ewww, You Use PHP?
- skrebbel 15y agoThe problem with PHP isn't so much PHP itself as the shares of bad programmers, libraries and examples out there. Awesome PHP is awesome.
- Androsynth 15y agoAny examples of awesome open source php examples? (real question, not a snide remark)
- knieveltech 15y agoDrupal. Recently rumored to platform 1% of all websites. The codebase is clean (even cleaner in Drupal 7), and naysayers be damned the hook system baked in makes modular coding a breeze. Of course, code quality varies once you start looking at community contributed modules, but that's to be expected. Downvote? Really? Pfft.
- eropple 15y agoDrupal's core architecture is extremely dated. You might like the hook system, but it is in no way a replacement for dependency injection a la Symfony2.
- knieveltech 15y agoDated? By who's standards? Yours? The UN, NATO, Amnesty International and Sony all disagree with your assessment.
- eropple 15y agoYes, by mine. I've spent quite a lot of time elbow-deep in Drupal. It is better code than Wordpress--though that is damning with faint praise--but does not really reach the bar of a Lithium or a Symfony2. Now, it's certainly more normal-friendly than Symfony2 or the like by way of allowing non-developers to implement (a subset of) features, but I wouldn't call it programmer-friendly and I wouldn't use its internals as an example of good code.
- ceejayoz 15y agoTwitter's new developer site, too.
- TylerE 15y agoUrm, no. There's lots to like about Drupal, but clean code isn't one of theme. I mean, it's not PHPNuke, but clear and logical it ain't. I'm saying that as lead dev on a drupal site that pushes pretty heavy traffic and has thousands of man hours in it.
- ceejayoz 15y agoI love Drupal, but turning on devel.module and seeing 300+ queries on many pages was a bit of a fright.
- jtreminio 15y agoCode quality of the Kohana Framework is top notch, imo.
- JoeCortopassi 15y ago^this. I actually grow as a programmer when I read through the Kohana source
- jimktrains2 15y agoKohana is pretty nice IMHO
- pak 15y agoIf only they could get the docs back up to par! Things were sort of OK for 2.x, even if you needed some background in CodeIgniter to really understand everything, but half of the wiki for 3.x is empty pages with TODO's. I still recommend that people new to Kohana start with 2.x because a framework is worth a lot less without quality documentation, when you have to go read the code all the time. Not that you shouldn't do that eventually, there's a lot of good code in there to learn from!
- encoderer 15y agoKohana is wonderful because it's simple: I never had any problem reading the code if I wanted to know what something did.
- iaskwhy 15y agoThat's good but it also makes it annoying to work with it. I prefer having good docs which takes me 30 seconds to scan and find what I am looking for than having the better code in the world so I go with CodeIgniter instead (the new version is pretty good).
- devmach 15y agoBecause of the lack of documentation (v3), i begin to read source code to understand... At the and i found myself while writing my own framework :) Really, Kohana needs more documentation....
- akie 15y agoI really like the Yii framework - very clean if you ask me
- Periodic 15y agoAnother developer introduced me to Yii when he got me on board for a PHP contract he needed help with. I was hesitant to take PHP work at first, because my previous experiences were harrowing at best. However, I found the framework was almost pleasant. It had a lot of the features I had grown used to in frameworks like Rails, and though I still have to wrestle with some frustrations of PHP, it is a minor annoyance as I go about writing good OOP MVC code. I would personally pick another language if I were doing something from scratch, but the benefit is that it is a language others are already familiar with and so adding a framework like Yii isn't too hard.
- encoderer 15y agoFlow3
- j_col 15y agoDamn, long thread. I use Java, PHP, and Ruby: whever gets the job done in the given problem domain. Not a fan of a technical monoculture at all. PHP has been the language that is fashionable to hate for years now, but I still love it for web apps.
- troels 15y agoI use Java, PHP, and Ruby: whever gets the job done in the given problem domain I never really understood this argument. I mean, the overlap between Ruby and PHP are so great that they are virtually interchangeable.
- skrebbel 15y agoWait, you can upload a .rb file to a random hosting provider and it'll just work?
- jrockway 15y agoWait, you're eleven years old? (Hint: copying files to a server is not how real applications are deployed.)
- de90 15y agoCould you elaborate? My programming experience is just for fun\learning, and I'm ignorant about this.
- jrockway 15y agoYou just bought your shipment of 1000 servers. Do you really think you ssh to each one, edit config files, and copy your code over? Nope. You write a computer program to do all that. (See: puppet, etc.) At that point, it's equally easy to install a stack like haproxy + varnish + nginx + a bunch of CPAN modules as it is to rsync over a bunch of .php files, and therefore "it's easier to deploy" is meaningless. You click a button. Not to pick on you specifically, but one argument that comes up quite frequently, especially in PHP vs. X discussions, is "I don't see how xxx feature of other language is beneficial." Well, the reason you "don't see" that is because you simply don't have enough experience yet. Deployment is the same way; a lot of people get by for years without ever "doing it right". But that doesn't mean the wrong way is right, it just means you haven't been required to get deployment right yet.
- pkkk 15y agoJava and JVM as reliable platform +1 just go whatever language you want Scala, Haskell, Ruby... here language doesn't matter. If you want to create custom web based application (not RIA one ofc) go django or rails, now it's more matter of taste both choices will give you a lot benefits, and ofc you can run it ontop of JVM. But if you considering building anything today on PHP (when you have sooooooooo fucking many better platforms) you are incompetent and plain stupid, because it will be a big technical debpt for the whole project.
- robryan 15y agoI don't know about the more technical debt stuff, sure if you go off and use all the parts of the language any old way it will let you make a mess but there is no reason you can't apply some of the same practices that something like rails enforces on you.
- eropple 15y agoAgreed. Symfony2 is an excellent base for this reason--Fabien Potencier and friends are, as far as I'm concerned, the guys to look at for writing clear, maintainable, excellent PHP code.
- ittan 15y agoAgreed!
- Tomek_ 15y agoIt's not only Symfony2, PHP has a lot of high-quality projects going on: Zend Framework, Doctrine, Solar/Aura, Twig, Lithium, Jackalope, FLOW3 and probably much, much more.
- eropple 15y agoWhile some of your other listed projects are okay (as it happens, Doctrine and Twig are both used as part of Symfony2), Zend is generally considered about as ancient as CakePHP today, and I don't really know anyone who recommends using it for new projects. Most of the "big-name" PHP projects out there are creeping horrors (I'm looking at you, Wordpress), and Zend kinda falls into that bucket. Personally I'd be very wary of Lithium as the code looks pretty slipshod internally from a brief scan into it, but Solar and FLOW3 are solid projects.
- KnightWhoSaysNi 15y agoPHP has its faults, but it also has dead-easy deployment, cheap and reliable hosting, good documentation, and an excellent community.
- checker 15y agoExactly. There are tradeoffs to be made when making any architectural decision. PHP may not be the right choice for someone, but it might for someone else in a different situation that values the characteristics you highlighted. However, it is ultimately a potential hire's choice what they want to grow their experience in.
- masklinn 15y ago> it also has dead-easy deployment, cheap and reliable hosting Matters for a single 15 years-old developer. Deployment is never easy when you get do anything non-trivial, and the cheap hosting... hosting for other languages start at $5 or $10... The only cheaper hostage PHP has is free. > good documentation That's highly debatable. I've also seen the PHP doc comments being pimped, I could never find anything worth more than a laugh in that cesspool.
- KnightWhoSaysNi 15y agoRegarding hosting I wasn't just talking about shared hosting. Setting up a LAMP VPS is just a couple of clicks. Compare that to setting up e.g. Django or Rails. I personally love Django, Flask, etc., but setting up a website is still faster with PHP (depending on your setup, of course).
- sjs 15y agoTry to instruct a noob on configuring Apache for vhosts or adding users to mysql then come back and tell me the deployment story for LAMP is so good. Node.js wins for deployment if you ask me. Node.js + riak handily beats the pants off of the LAMP stack. It's so easy I'll tell you how to do it right now: 1. Install node, ./configure && make && make install 2. Install riak, make all rel && mv rel/riak /usr/local && export PATH="/usr/local/riak/bin:$PATH" 3. Install your app: scp -r remote:/my/app /web 4. Install dependencies: cd /web/app && npm install 5. Run your app: node /web/app/do/something/cool.js Back to my coffee. (I'm being somewhat facetious and these instructions don't get you startup services and such, but I do believe that Node.js stacks are much simpler than traditional stacks and easier for devs that have to wear the sysadmin hat too)
- creativityhurts 15y agoThis was on HN already 9 months ago http://www.hnsearch.com/search#request/submissions&q=ewww&sortby=points+desc http://www.hnsearch.com/search#request/submissions&q=eww...
- deleted 15y ago[deleted]
- saibotd 15y agoPHP is what I've started with and after many projects in Python and Java I still come back to it whenever I need to get stuff done. I mean look at the array functions (http://www.php.net/manual/en/book.array.php http://www.php.net/manual/en/book.array.php)! Some consider this bad design, but I love this about PHP.
- rbanffy 15y agohttp://docs.python.org/tutorial/datastructures.html#list-comprehensions http://docs.python.org/tutorial/datastructures.html#list-com... This should help you.
- TylerE 15y agoWTF? Array functions as something GOOD about PHP? It doesn't have a slicing syntax for crying out loud!
- Udo 15y agoDoes it really matter to you whether array slicing is implemented as syntactical sugar as opposed to the array_slice() function? If so, why? In my view the only problem with PHP array functions is the fact that the naming scheme is an absolute disaster (as it is all over PHP, for historical reasons).
- TylerE 15y agoYes, it DOES. Syntax matters. Small improvements in a few places add up. For example, let's say you've got a string like 4|1|45|343|22. You want to return a string with the last three numbers, but seperated by a comma and a space. In PHP: $arr = explode('|',$str); $last_three = array_slice($arr, -3); return implode(", ",$last_three); In Python: return ', '.join(str.split('|')[-3:]) Small conciseness improvements snowball as the codebase gets larger. In fact, being unable to chain functions in PHP is actually my biggest beef with the language. If you could do return implode(', ',array_slice(explode('|',$str),-3)); that'd be a lot less annoying. Still not as good as the python, but a lot closer.
- jinushaun 15y agoAt least it's not ColdFusion... I'm convinced some websites out there use fake .cfm file extensions as a joke. No way they're actually using ColdFusion!
- tobias3 15y agoCFScript is JavaScript (ECMAScript). Which means it actually should be cool at the moment ;)
- bad_user 15y agoCFScript is JavaScript (ECMAScript) No it isn't, by any stretch of definition or imagination. In fact, I think Ruby has more in common with ECMAScript than CFScript does.
- rbanffy 15y agoFrom my CF time, I remember a lot of CFML code. That and utterly unreliable servers, to the point of having a process running under Windows to restart the server when it accumulated, say, 50 pending requests. I'll never touch it again.
- c1sc0 15y agoNot sure about .cfm, but I once did append .asp to websites just to create some entertaining access logs.
- drdaeman 15y agoI've used /index.el (instead of /) for Emacs-themed easter egg once. I guess, nobody ever accessed that.
- rmason 15y agoI think that you'd be surprised. Most of the Fortune 500 uses CF as does the federal government. Even JBoss has an open source CFML distribution, http://www.getrailo.org/ http://www.getrailo.org/ so the whole cost argument is mute.
- maratd 15y agoFor many years now, more and more code has been moving to the client side. At this point, for me, PHP is just the glue between the database and the client side code. There's nothing left to hate. Move on already.
- rbanffy 15y agoThere still has to be a lot of glue logic on the server. When your client-side code calls something like "validate_purchase" on the server, you'd better have some trusted code handling that.
- maratd 15y ago> When your client-side code calls something like "validate_purchase" on the server, you'd better have some trusted code handling that. Why am I calling "validate_purchase" on the server? Client Clicks Buy -> JSONP to Payment Gateway -> Gateway to Server (with all the info) -> Server to Client Confirming Transaction All my server is doing is recording the transaction and forwarding the info to the client. The gateway is trusted, since they are processing payments. I'm serious. This is where we're headed. Yes, you will have a hell of a lot of server-side code on the gateway, but that's a service, not the application.
- amalcon 15y agoYour payment processor isn't going to know how much anything costs. You'll need some (server-side) validation logic if you don't want people buying new high-end smartphones for a penny. Which event invokes that logic is immaterial.
- maratd 15y ago> Your payment processor isn't going to know how much anything costs. So? > You'll need some (server-side) validation logic if you don't want people buying new high-end smartphones for a penny. That validation logic should be expressed in SQL. It's really really simple. If inventory id and price match in your inventory table, insert into your transaction table. Again, see my original point. PHP is just the glue for the database.
- ArtemZ 15y agoI use groovy on grails
- apinstein 15y agoAs another startup in Atlanta trying to hire good PHP developers, I can sympathize entirely with MailChimp on this one. I have been searching for months for local PHP developers with experience doing TDD or other agile/modern practices and it is extremely difficult. If you are one, please feel free to contact me. I think good TDD/agile/architecture cultures are more prevalent in ruby/python but as those languages have become more mainstream the quality of the average dev in those environments has dropped quickly. A few years ago only really good devs ventured into ruby stuff. Now everyone is trying it as the tools have made the language much more accessible for the average developer. I am seeing more and more programming mistakes in the ruby code I dive into than I used to. Language choice doesn't matter too much from a technical perspective. It matters from a practical perspective. Consider the jQuery/prototypejs war. Prototypejs was technically superior for a long time, yet due to jQuery's more accessible plugin culture and prettier web site they were over time able to build a more robust community and took the mindshare lead in the js space. I still think one of the core reasons ruby/rails and python/django got big is that for a long time there was only one major framework available for the language and this caused a better community than the php landscape, which pre-dated frameworks by a long time (this happened to perl as well). So there wasn't "one true way" in php to build apps quickly, and this hurt the php community when rails got big. I think as a community we lost a lot of talent to ruby/rails in the last few years. Bottom line is that accessibility, pervasiveness and low-learning-curve are critical to the initial and continued success of any platform, whether it's a language (ruby > php > perl), OS (ios > android > rim), etc. Language advances in PHP (circular gc, traits, closures, etc) have brought php's language capabilities forward enough that it's a respectable platform for sticking with. However, you can't fix the community really since it's so fragmented. Fortunately some frameworks are getting enough traction to have rich ecosystems, and that's definitely a great thing for the language and the community.
- deleted 15y ago[deleted]
- simonw 15y ago"Prototypejs was technically superior for a long time" Can you expand on that at all? What made Protoype technically superior?
- ristretto 15y agoPHP started at a time when web development was not considered "serious programming". I mean, people switched to it from building GUI or console apps on C/C++ and Perl. It was fast, efficient, had convenient hashtables and defaults in place, and it was better than writing simple HTML files, but it was still considered "scripting". Nowadays, web apps are a lot more complicated, but web development is still messy: as HTML always stands in the way, it's still hard to abstract the whole web development process without restricting yourself to a specific mode of development and its limitations.
- tibbon 15y agoMy main beef with PHP is that the most deployed applications that use it are some of the most difficult to manage and messy pieces of code that I've ever seen. I'm talking about Wordpress and vBulletin. While MVC isn't the only valid design pattern, some varient of it is rather nice when working with websites and these two seem to ignore it through and through. Testing? What's that? I know that better can be written in PHP, but for apps that I've had to deal with, PHP normally looks like an overpowered scripting language that's just a mess. I'll stay with Rails and Sinatra when I can.
- naz 15y agoDon't forget Mediawiki. Try to decipher the source to their wiki markup parser (or try writing a compatible one). Shudder.
- JonLim 15y agoHaving recently created a theme for MediaWiki and then reskinning that theme for another install, let me just say... it is frightening. MediaWiki is all over the place and the themes included in the install are just horrifying. Whoever made the original (monobook) theme should get slapped in the face.
- thorwawy99 15y agoor drupal.
- KnightWhoSaysNi 15y agoI agree with you that WordPress and Drupal aren't examples of great code. It has to do with the fact that CMSes take a long time to gain traction and acquire a true community, and WordPress and Drupal were started at a time when MVC was almost unknown in the web community. By the time they got traction, the oldest code in the codebase was, well, ugly. Things that have been added to WordPress and Drupal recently are usually okay code-wise.
- OzzyB 15y agoThis seems to be a common essay from well-established companies who use PHP and then write "oh gosh we use PHP!" The key here, as it states, is that they "built their own framework/libraries", which essentially means nothing to indie-devs and other small non-well-established companies who want to build something... So the trend is simply this: 1) We use PHP because it's what we know, easy to get started with etc. 2) It gets us by while we build our business 3) Profit! Re-factor our codebase, in PHP! Thus, the blog post should read: "Hey Mailchimp is doing awesomely, so we refactored our PHP codebase with our very own custom framework!" It's not that PHP is all bad; it just lost the "framework wars" IMO, and I think when companies come out and state things like this, it kinda proves it...
- Mikushi 15y agoNot really, being PHP, Python or Ruby, with the kind of load they are dealing with, no framework available out there is fitted.
- middus 15y agoThe key here, as it states, is that they "built their own framework/libraries" In the end, isn't that what everybody is doing anyway?
- OzzyB 15y agoWell yes, when you speak to experienced PHP devs that's their response when confronted with the "PHP sucks" argument -- they always say they have their own framework/libraries, which don't suck and thus in turn "PHP is fine"... I don't think everyone is doing that (building frameworks), or can, or even should when they're other possibilities outside of the PHP world...
- alecco 15y agoIt's hilarious how most PHP programmers think they are exceptional compared to the rest. While most of them rarely code in any other language besides PHP/ActionScript/JavaScript/ASP. And virtually none of them read a serious algorithms book.
- naner 15y agoIf you're in Atlanta you're near Georgia Tech. They're pumping out CS graduates, have undergraduate students looking for experience, and also have a pretty good internship program. It is not Silicon Valley but you're better situated than a lot of other places.
- bufo 15y agoNice idea and design, however chimps are NOT brown!