Hacker Newsnew | past | comments | ask | show | jobs | submit | billpatrianakos's commentslogin

We get it, man. PHP sucks, you're cool/smarter/better because you use something else, and you need to remind us all about it by jumping in every time the letters P-H-P are seen in sequence to let us all know how it sucks by retreading the same old lines used by the last fifty guys who said the same thing but to your credit you really tried to be clever about it.

A good portion of why people like to mock PHP is due to the way people end up using the language rather than the language's ugly parts. This guide is a great step toward pointing people in the right direction with the language. PHP has come a very long way and continues to improve. A big chunk of the battle is having decent guides to replace all the crap that's out there showing new PHP devs the wrong way. So why not talk about the merits of the guide rather than taking an easy opportunity to shit on PHP. It's really gotten old.

Hey, remember when JavaScript was like the worst language ever and everyone felt the need to remind everyone about that constantly? I do. And now all of them are writing blogs about how awesome node.js is.


I used PHP for five years professionally, I consider myself as well positioned as many to have an informed opinion about PHP weaknesses and strengths. My diagnostic is that PHP weaknesses are structural, and no amount of guidance can fix that. If facing the choice, one should not choose PHP over other solutions. (It happens also that I am working in Chinese tech sphere, where many startup choose PHP just because it is used by Facebook and Wikipedia, which is really sad.)

However, I appreciate very well the need for such a guide when you have no other choice. I did not read all of it, but it is certainly necessary to have strong coding conventions and a defined set of "must do/musn't do". I remember we had even built a code checker that was forbiding the use of many php functions and syntax, and had a set of wrappers around basic functionalities like string functions or date functions.


> I used PHP for five years professionally, I consider myself as well positioned as many to have an informed opinion about PHP weaknesses and strengths.

Yeah, that doesn't mean anything. In fact, to be frank, when I read that, I fill in the underlying context:

"I used PHP for fives years professionally, and the code was horrible. Granted, it was code I wrote because PHP let me write code that way..."

or

"I used PHP for fives years professionally, almost a decade ago..."

> I remember we had even built a code checker that was forbiding the use of many php functions and syntax, and had a set of wrappers around basic functionalities like string functions or date functions.

Yeah, that didn't do much to change my mind.


Any reason for the personal attack (based on unfounded assumptions)?...


No personal attack. You used your experience to justify your position, which really means nothing. You then went on to describe practices that, if written accurately aren't in anyone's book of good things to do.

If you take it personally, thats your issue, not mine,


I’m not the OP.


He doesn't defend PHP as a language.

He is sharing some useful guidelines to approach it more properly and help people that are still using it.

I, for one, am a fan.


> A good portion of why people like to mock PHP is due to the way people end up using the language rather than the language's ugly parts.

Are you really going to trot out that old lie?

Why not read this, instead? http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de...


Because huge swathes of that blog post have already been debunked ad infinitum (here on HN, no less).


Yes, how dare he talk about the problems with PHP in the comments on a site dedicated to talking about how to avoid problems with PHP. Seriously, WTF? Are people actually offended that discussion of PHP's defects take place in a conversation about PHP best practices?


Offended, no. Weary of rehashing the same arguments against using PHP at all, when that is clearly not the point of the discussion...absolutely.


I think it is because we (as a community) should be past the piling-on stage and on to the constructive discussion stage. Snark doesn't add to the discussion.


I don't intend to jump into the ring, but as an observer, I don't think we're at that point yet. Here's the progression of the current anti-PHP flare up:

  Jeff Atwood says PHP sucks
   |- Says we should make other languages fill in on what PHP does best
   |- Post goes on HN
      |- PHP apologists say "No! PHP is fine, I've made a career out of it!"
      |- 'Atwoodians' continue to reject PHP, ruby/python need to be more accessible
      |- PHP apologists make reasonable arguments for why PHP isn't as bad as everyone says, while admitting its probably worse than python/ruby

There remains a conspicuous lack of response from the 'Atwoodian' camp regarding what could be done to add PHP's quick-start strengths to other languages so that PHP developers can develop similarly to how they currently do, just with a less wonky and problematic base language.

By no means, as an outsider, do I perceive the PHP apologists as having redeemed PHP to the point that the discussion should be about 'how to fix PHP' rather than 'how to discourage its propagation' as was originally put fourth in a fairly reasonable way by Atwood.

I realize why saying 'PHP apologists' is problematic, but I'm mostly seeing responses that are in themselves critical of PHP, while espousing its widespread use, quick-start capabilities, and developer intertia--and not espousing why the fundamentals of the language are better of the equals of ruby/python.


While I can't speak for others in the "Atwoodian camp," I for one think Atwood's article was that response, to a large degree: it pretty much said that his next big project is trying to bring those strengths to a platform built on another language.

Having said that, it seems to me that there's certainly a fair amount of work being done to make deploying apps in other languages pretty simple. With mod_passenger, for instance, setting up a Rails app under Apache isn't notably more difficult than setting up any other Apache virtual host. Deploying Python web applications isn't quite as simple yet (at least in my experience), but it's nothing that should be beyond the ken of someone who's figured out how to write a Python web application in the first place. And that, in turn, isn't really beyond the ken of anyone who's learned how to write reasonably good PHP MVC code.


Well… Javascript does suck. No one in their right mind defends the language.



Javascript is just Scheme with a C-like syntax and a limited number of bad design decisions (like automatic semicolon insertion and the == operator). PHP is a never-ending fountain of bad design decisions, because its core devs continue to make new ones.


No, Javascript is not "just scheme" with a few bad design decisions. They have significant differences.

Scheme has:

  call-with-current-continuation http://people.csail.mit.edu/jaffer/r4rs_8.html#IDX509
  Tail Call Optimisation
  A numeric tower http://people.csail.mit.edu/jaffer/r4rs_8.html#SEC50
  A Code/Data equivalence and therefore macros
  Ports
Javascript has:

  Prototypal inheritance
  Every 'object' is mutable bag of string indexed properties
There's a pile of differences, even just at the semantic level before you get into the syntax or the equivalence semantics.

I understand that if you take a specific subset of javascript, you can write code as-though it has some scheme semantics (minus call/cc and TCO), but that's true to a similar extent of any language with lexical scope, closures and anonymous functions.


What bad design decisions have been made in PHP in the last 5 years?


Using '\' as a namespace seperator? Just off the top of my head, there are probably loads more.


What makes that explicitly bad?


I've actually gotten used to it (and I rallied against it heavily). It's really not so bad; it's even somewhat nice it has a file-system like connotation. PHP's design precluded using any existing operators.


Based on how long it took to introduce the ability to say foo()["bar"], I'm guessing it's not the language so much as it's a set of poorly designed parser rules.

Also, magically, I can't use empty(functionResult()); but I can say $result = functionResult(); empty($result);


> I'm guessing it's not the language so much as it's a set of poorly designed parser rules.

There are poorly designed parser rules but the namespace operator is not due to that. It's due to the fact that a single PHP file will be compiled to byte code without knowing what the symbols represent until runtime. The separate operator is needed because names are resolved before execution begins and before the symbols are known.

> Also, magically, I can't use empty(functionResult()); but I can say $result = functionResult(); empty($result);

Empty is identical to the not (!) operator except that empty() can operate on undefined variables, undefinted array keys, or undefined properties. empty(functionResult()) doesn't make any sense because functionResult() can never be an undefined variable. You just use !functionResult().


really? add: floating point everywhere, objects that act like hashes but not exactly, fucked up scoping rules including global by default, the braindead Dom API, a severiously limited standard library, and brain damage coersions to the list...


I'd leave the DOM API out of it, that's not really the languages fault.


Well, its the first one hat offered it, isnt it?


It is actually a very strong language with a few very well known warts (like every other language on the planet has). The problem is that people try to use it as if it were Ruby, PHP, Python, Java. One can do that, but just know that it is an exercise in futility. It will cause frustration and one will come to the conclusion that JavaScript sucks when in fact, it is just that most people don't really take the time to _understand_ JavaScript.

JavaScript could stand to be a bit less verbose (look into CoffeeScript for some relief if you value your sanity and time) in some areas and type coercion should just go away; but if you use strict mode and strict equality, a huge amount of pain is alleviated.

If one take the time to learn about constructor functions, the prototype chain, and own properties; they are 70% there. Most people can get by on just that.


Hey, Tikhon, we know you're proud of Parse and you really should be because it's awesome but taking liberties with a headline like you did there might not be so cool. It can be taken one of two ways:

1. The founder of Parse is a total egomaniac.

2. The founder of Parse is really proud of his company and has a great sense of humor.

Parse is awesome though. I signed up back when you guys were first opening it up to people and I remember you sent out a lot of emails to get people to come back and keep using it and you have great documentation and tutorials. I see it "changing the way the app industry works" in the same way AWS, Heroku, and others changed how people thought about web app deployment. The big deal is in giving more people access to the tools they need to run a mobile app that they either couldn't build or afford before. That's awesome because lots of people will build some cool things with Parse... And amateurs like me will be able to churn out crap much quicker and cheaper. Awesome!


How did he take liberties with the headline? "This Startup Could Literally Change The Way The Entire App Industry Works" is the actual headline from Business Insider.


The Business Insider can be a bit on the sensationalist side. I don't want to say tabloid but they're around TechCrunch levels of overexaggeration.


The link sent me to Yahoo Finance which had a headline that didn't include about 99% of the words in the headline here. Oh well, my mistake.


Yahoo syndicates business insider


HN headlines are often changed by moderators to match the article's title. That might have happened here.


Back in the old days your comment would've been in the top spot here (despite what my profile says, I lurked for far longer so I do remember). Now, as of this writing you're at 3. You are totally right and your position in these comments can only support your view.


That's very paranoid. Occam's razor, my friend. They were probably going to do this anyway with timing being a coincidence. People give the US government too much credit for planning devious things. Most of it is a lot of fuck-ups and political favors. Nothing more. I sincerely doubt the Feds did this as so to give the finger to protesters. They've been doing this long before SOPA was introduced and will continue too. SOPA just codifies the status quo so that the chances of anyone getting in trouble for shutting sites down becomes nil.


> Most of it is a lot of fuck-ups and political favors.

There is a contradiction there perhaps. Political favors includes buckling due to lobbying. Then US govt. is just a proxy for large banking interests, the military industrial complex, pharmaceuticals, large agribusiness etc. So no the govt. might not have really cared about MU but maybe MPAA cared and when they care they line pockets and make promises about future rewards


So, the only way out for anyone who wants to survive is to lobby? Seems like the only solution out to me.

I've always had this problem with lobbying. If everyone has to lobby and I guess it mostly requires money these days then how is it not "legal bribing"?


Lobbying has always been legalized corruption, however it is better than actual corruption because it allows people to monitor the "bribes" (i.e. they're not hidden from everyone's eyes).


The key is to make the bribes matter less, by limiting the size and scope of government's power.


I agree with you wholeheartedly, but it seems we've reached the point that not only can we not shrink the size and scope of government power, we can't even stop it from growing.


But then you can't end people's careers when you catch them taking "bribes". Honestly, I can't see how it's any better. Now we just get to watch it happening but we still can't do anything about it.


That's too simplistic. Lets take the example of a gun. The gun industry makes a product that can be used for intentional harm or for protection. One company sells a 35mm handgun to the general public and another sells assault rifles to the general public. A reasonable person knows an assault rifle is not for protection (and don't get pedantic and say "well depends where you live", etc. because you know what I mean). That's like what MegaUpload is. Dropbox and Box.net are file locker services. MegaUpload was very obviously a file sharing service - one that was very much all about sharing movies, music, and software with no regard to copyright law. Dropbox and Box.net are the handguns to MegaUpload's assault rifle when you put it into my above example.


Not to get too pedantic, but you might want to amend that to "9mm handgun" or something similar. Apache helicopter gunships shoot 30mm projectiles!

But to address your argument - a large portion of the gun lobby and gun enthusiasts aren't necessarily uncomfortable with just a handgun for defense, but they are uncomfortable with a technically ignorant government deciding what is sufficient and allowable for that purpose. Similarly, what's to say a precedent established with Megaupload cannot be used to hamstring or shut down Dropbox or similar services? Though you can understand and make the distinction between the intents of the two services, can you trust a judge to properly frame why Megaupload is bad and Dropbox is good? Or for prosecutors, lawyers, and the assembled IP industry to not leverage any legal precedent to shut down what they feel like?


As you can tell, I don't know much about guns.

You've got a point but I can honestly say I can trust a judge, prosecutor, or a 5 month old to tell the difference between MegaUpload and Dropbox. What MegaUpload was encouraging was too obvious to even argue about.

That said, you are right. My argument was geared more toward MegaUpload defenders who, for some reason, have deluded themselves into thinking they're defending an innocent service and turning Kim Dotcom into some sort of freedom fighting hero. Your stance on copyright law is irrelevant here because what MegaUpload was all about is illegal in most first world countries. If you think MegaUpload was "just a file storage service" you've got to be lying to yourself.

However, your argument is important because not all cases are so cut and dry. So yeah, in the future it is important to keep an eye on the Feds and make sure the law and due process are upheld because I'll concede that if people are lax (like I am in this case with MegaUpload) then in the future it might be a truly innocent Dropbox that's next. You never know.


Dropbox and Box are file syncing/backup services, and MegaUpload is a filesharing service. Both types have different legitimate use-cases. Youtube is also very much about sharing movies and music, but since youtube videos are publicly viewable, it's easier to monitor and take down. How is MegaUpload supposed to monitor a bunch of passworded "VacationPhotos.rar" files? Just because it might be a Hollywood movie doesn't mean they can take it down on suspicion.

There are music artists that have put their own albums on MegaUpload as a central place where anyone can come download. There are people like myself who put a collection of high res photos in an archive and hosted it on MegaUpload for any of my family or friends to download. Analogizing MegaUpload to an assault rifle is saying that there's no reason for civilians to have access to it, where there are actually many legitimate use cases for using a filesharing service for mass distribution.


> Dropbox and Box are file syncing/backup services, and MegaUpload is a filesharing service. Both types have different legitimate use-cases.

What are you talking about? Here is a dropbox public link to a photo: https://www.dropbox.com/s/q1rw9irkhyn400d/Boston%20City%20Fl...

Just as with megaupload, any person with that link is able to download that file. The paying customer is the person hosting the file, and just as with dropbox, anyone who only has a small volume of files doesn't have to pay anything.

I wouldn't be surprised if a lot of people are using dropbox, google drive, and any number of other companies today for EXACTLY the kind of piracy that megaupload stands accused of. The main difference seems to be that those other companies are not as successful and try very hard to present a public face that emphasizes their other features, like file syncing.


Your presenting a straw man. I used MegaUpload many times over the course of playing World of Warcraft, because one of the better known players had put his configuration files and some of his videos on the site for others to download. I also used it myself as storage for several (non-important) pictures. MegaUpload is very much a file sharing service. It is also used for sharing copyrighted files. It is nothing like an assault rifle.


> A reasonable person knows an assault rifle is not for protection

Makes for pretty fun sport shooting, though.


A 35mm handgun would be hilarious:)


I heard about someone back in the 1970s who replaced the barrel of an old .38 Special revolver with a piece of pipe (about an inch-and-a-half or 40 mm) and used .38 blank cartridges to shoot golf balls about a hundred yards.


and you just _know_ some people would be ordering them 6 months before they were available.. .. never mind that to avoid damaging yourself you'd have to load it so light the bullet would be visible in flight - I am sure it would sell.


That's a great analogy.


The problem with this analogy is that it's actually the wrong way around. The problem firearms are the handguns - the US has 17k murders per year, 13k of them are with firearms, 11k of those are with handguns. Much as people like debating about rifles, it's handguns that do the work.


You politely ask people not to get pedantic then the majority of the discussion becomes pedantry. Instead of replying one by one I'll lump a lot of responses here.

1. The millimeters on my defensive gun were very off. I don't know about guns. Just imagine a typical handgun.

2. The handgun analogy is not about how much damage one causes over the other nor is it about the severity of the consequences. The point is that we can all relate to the average homeowner buying a handgun for protection and most people can understand that and trust that your neighbor isn't buying it to commit crimes. But when your neighbor buys an assault rifle and claims its for self defense you start to wonder because we all know, on average, most of the time, it's common sense, stop being fucking pedantic, that assault rifles are not for self defense and when someone claims that it should set off alarm bells just like when someone says "I only used MegaUpload to share Excel spreadsheets with my coworkers and so did everyone else I know or have ever heard of" you've got to wonder if that person is living in a bubble or just straight up delusional.


The point is that we can all relate to the average homeowner buying a handgun for protection

Can we? Where I live, buying a pistol or an assault rifle for self-defence would get you viewed the same by your neighbours. I'd actually be more concerned if I heard someone on the street brag about their pistol because it's much easier to carry about secretely than a rifle.

This reminds me of the term 'security theatre', which is why I think the analogy is a bad analogy.


It might well have obviously been a file sharing service, but by your metaphor, every hi-fi featuring tape to tape recording was at the very least a Browning Automatic Rifle.

[edit] Also, in a hell of a lot of cultures around the world possession of a handgun is not considered defensive, but lets ignore that point as it would break your metaphor, and not only did you politely ask me not to, but you also probably have a handgun. < whistles innocently while slowly sidling out of range >


I like to always make the point that users are spoiled and have an awful sense of entitlement when it comes to the web but in this case I can't say I blame the users. It's really important to think long term and definitely overprice your product rather than pricing it as low as you can. If the price point you set can't be sustained in 2 to 5 years with the number of users you project (and this is where you should overprotect or, put another way, plan for the best case scenario) then be ready for some backlash and lost customers. Always try to make it so you have to lower prices as username grows. It's common sense. Now of course you can't always do that and you have to feel for the company when that happens but the customers will get over it. So long as you handle it well and you're offering something people want the users will pay the higher price as long as they're still getting value from the product.

Customers bitch about every little change you'll ever make so sometimes you just have to take it with a grain of salt. Hell, even free services get this when any change is made because people already using the product don't want any change. At all. Humans hate Amy and all change. So if you think enough current users will eventually get on board and new users will surely get more value from a change then it's worth it.

He frames this in terms of grandfathered pricing but really it's about users reacting to change. Higher pricing is the worst kind of change a user can experience but in the end it's almost no different than when Facebook changes privacy settings (or changes your email address without asking). The success or failure will be based on new users valuing the change thus getting them to sign up and current users eventually getting used to it versus the exact opposite of that. Users will bitch about all changes always. Upping the price, unfortunately, is the worst thing you could probably do. But they'll get over it.


Its very interesting.

I recently read an article about a game (i think it was realm of the mad gods), where the developers of the game initially priced some items cheaper, but got more expensive as you purchased more (i recall it was chests that allow you to store extra items). Buying 1 is say, $1, and 2 is $2, but buying 4 is $5 (this is to encourage casuals to buy 1, but extract more out of the hardcore players).

This lead to quite a backlash - so they changed the wording, such that buying the 1st one is still $1, but it was made clear that it was discounted X% from the 'real' price. This simple change, stopped almost all backlash.

So it is basically a psycological phenomenon. Its a similar thing to what this TED video had to say about how people estimate and make decisions http://www.ted.com/talks/dan_gilbert_researches_happiness.ht...


Well burying pricing and then doing a "gotcha" is pretty offensive. If that's what happened then the lack of transparency was probably the key point people objected to.


I hear what you are saying. I think it's very hard for a new business though to see that far out. Pricing too high too early can also mean no or very few customers. Secondly, you may price it accurately today but your customers drive you to enhance the service (and the costs) by adding more features. That's all healthy but that can also mean even the best laid original pricing needs to rise.


I'm really happy to see the, charging right from the get-go. I've seen a lot of my friends build a simple app that they want to make a little side income with but they usually make the tragic mistake of launching it as a free service and charging after it gets some attention. The logic is that no one will pay a no-name developer for something simple like this. That logic is wrong. Yeah, lots of people can implement the same things themselves but most won't and they'll pay for the convenience of having access to these projects. If you start charging after launching as a free service you're pretty much doomed as users get a sense of entitlement and feel like you've pulled a bait and switch on them. It's far easier to charge from the start and delight users by bringing down the price later if you can than it is to start free and increase the price. Joel from Buffer actually wrote about that recently and it's something that I've taken to heart. Kudos to RaterLater for having the balls to charge for their work in this crazy web culture of entitlement.


I get what you're saying and I'm on board but the way you put it left kind of a bad taste in my mouth. It came across just a little bit like you haven't considered that you can just stop reading when you come across bad writing. I'm a poster child for poorly thought out blog posts. Luckily, no one reads them. That's the thing I've learned about blogging. You suck at it for a long time and with practice you get better and then people can stand to read your writing.


Way to read into it. That was totally beside the point. The point was just to specialize. The example pitch was exactly that; an example.


I think we all knew this already. But now now does this article count as startup advice? If so, do we not take it seriously either? In all seriousness though, we should take startup advice with a grain of salt but at the same time realize that while most of it is contradictory that doesn't mean it's all worthless. The trick is to pick out what applies to your particular situation. If there are two conflicting pieces of advice that apply then you just go with your gut. Only you know what's best for your situation. It's always useful to learn what others think or have gone through. So yeah, it's all a bunch of feel-good contradictory stuff but it still has its worth. You can compare it to self-help which is often worthless but even then at least self-help gets you moving toward bettering your situation just like startup advice. Startup advice is like a very useful worthless thing. Yeah, it's both of those things at once.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: