9 ms·
From my Quora post on PHP[1]: "PHP is just like every other language: it allows you to write horrible, insecure, stupid code. It also allows you to write clea
by bkrausz 16y ago
From my Quora post on PHP[1]:
"PHP is just like every other language: it allows you to write horrible, insecure, stupid code. It also allows you to write clean code."
Really, the language doesn't matter. Find people who write good code and give them the tools and atmosphere to do so, and your code will be good. Both are mature languages with plenty of time put into plugins, security, and documentation. Both can obviously scale well, and both have the same set of capabilities barring some specific edge cases.
[1] - http://www.quora.com/What-are-PHP-s-main-flaws-(and-good-parts)?__snids__=1360846#answer_55743 http://www.quora.com/What-are-PHP-s-main-flaws-(and-good-par...
- moe 16y agoReally, the language doesn't matter. I disagree. Python, by design, makes it hard to write bad code. PHP, by design, encourages bad code.
- bandushrew 16y agobut a good developer can write good, clean code in either one. Every language/IDE combination encourages a 'default' coding approach, I agree that the PHP 'default' coding approach tends to be to create a hopeless muddle of assorted, random crap. OTOH, which would you rather have...a coder who is currently being 'forced' to write marginally better code in Python than he would in PHP because of the language constructs, or a coder who understands good code design and knows how to apply it? A good coder will be a good coder in any language, the fact that a crappy coder can be made to look marginally better if they are forced to use Python just doesn't feel like much of a win to me.
- bkrausz 16y agoThank you! For some reason I always take flak for this position, great to know I'm not the only one who feels this way.
- moe 16y agoa coder who is currently being 'forced' to write marginally better code in Python than he would in PHP because of the language constructs, or a coder who understands good code design and knows how to apply it? That's an esoteric question. A good coder wouldn't choose PHP in first place, unless there are pressing reasons (i.e. a legacy code-base). Consequently you can speed up your hiring process simply by weeding out candidates who propose to use PHP.
- bandushrew 16y agoLOL 'No true scotsman...' FWIW my hiring process rarely includes a request that candidates propose the language that they will perform their work in. (oh, and its not an esoteric question. It is a deeply practical one. I desperately want to hire good, pragmatic coders, not people who are only capable of writing good code if they are in an environment that makes it easy)
- moe 16y agoWell, you probably want your coders to create and maintain an environment that makes it easy to write good code in. PHP has no place in such an environment. Moreover it's highly unlikely that a good coder would apply for a PHP job in first place.
- jasonlotito 16y ago> Well, you probably want your coders to create and maintain an environment that makes it easy to write good code in. PHP has no place in such an environment. I agree with the second part, but I think the first part is wrong. I think he wants coders to create and maintain software that the company will use on a daily basis, in which case, PHP is perfect for that.
- bandushrew 16y agoheh. especially if you and I decide to define "good coder" as "someone who wouldn't apply for a PHP job in the first place" that would make it IMPOSSIBLE. muah ha ha.
- benno 16y agoBS. Can PHP do this? http://www.joelonsoftware.com/items/2006/08/01.html http://www.joelonsoftware.com/items/2006/08/01.html (In fact the latest version of PHP (5.3) can, but for years PHP has been lacking this, so the point stands.) No amount of "good code design" can work around core features that are missing from a language. The argument that all languages are more or less equal is as nonsensical as saying all cars are more or less equal, or all guns are more or less equal -- it ignores the tremendous advantage that using good tools can provide.
- bandushrew 16y ago"Can PHP do this?" well, as you've pointed out yourself, yes it can. "for years PHP has been lacking this, so the point stands." Im sorry? I must be missing the point. How does the presence (or absence) of a particular language feature prove or disprove the point that bkrausz made originally? "..<snip>...it ignores the tremendous advantage that using good tools can provide." not really. well, kind of. so the thing is that if I take the things that (in my experience) work to make a project successful, and I squash them all up into a big ball, and then I take that ball and I split it up into two heaps....one heap consisting of the things that the developers brought to the project and one heap consisting of things that the language brought to the project...and I look closely at the relative sizes of those two heaps....then almost always the heap of things that the developers brings is a lot larger; so much larger in fact that in general the effect of the programming language can be ignored. That is a pretty general statement, and there are clear cases where it is simply not true, but in general it is true, and I would particularly claim that in the case of a web application and choosing between PHP or Python, it absolutely is true. In the hands of good developers either will solve the problem well, both will provide a good, readable and maintainable code base. In the hands of an idiot, neither will be any good.
- benno 16y ago"Im sorry? I must be missing the point. How does the presence (or absence) of a particular language feature prove or disprove the point that bkrausz made originally?" Yes, you are missing the point. I refer to closures, the feature at the core of functional programming, not just any "particular language feature". Functional programming is an extremely powerful tool to wield, and has been absent from PHP since its inception until very recently. A great developer with a functional programming tool in hand is able to well outperform a great developer who must work around its absence. Here's a paper that surfaced to the front page of HN recently on the importance of functional programming: http://news.ycombinator.com/item?id=1482797 http://news.ycombinator.com/item?id=1482797. This is just one example, but a very potent one, of why language selection matters.
- stevenwei 16y agoAgreed. Even if these two pieces of code might accomplish the same thing, at least the Python version doesn't make me want to stab myself in face whenever I write it: Invoking an object callback in PHP: call_user_func_array(array($object,'method_name'),array($arg1,$arg2,$arg3)); Invoking an object callback in Python: object.method_name(arg1,arg2,arg3) (Python's *args and **kwargs are especially useful in these types of situations.) Although PHP is slowly adding useful modern language features (lambdas, closures), some of the syntax really is terrible. I honestly can't imagine anyone preferring the former to the latter, at least in this example.