Hacker News new | past | comments | ask | show | jobs | submit login
An actual PHP hammer with the claw on both sides (flic.kr)
226 points by neilk on April 20, 2012 | hide | past | favorite | 61 comments



How do I nominate a double-clawed hammer as the new logo of PHP?


http://php.net/download-logos.php

> In case you have found some PHP logos, icons or other material around the web, feel free to point those out to us, so we can include them here, if appropriate.


I've been using PHP for well over 10 years, and I love this thing. It seems like most commenters take this as a snub to PHP, I don't see it that way at all. Note that the guy who made this is also a PHP dev and has been for a long time.


You can't hate PHP properly unless you use it. But you also can't hate PHP properly unless you use other languages. If you don't use PHP first hand, then you don't know it well enough to appreciate what's truly wrong with it. And if you don't use and know other languages well enough, then you don't appreciate how much better PHP could have been if it wasn't so horribly designed.

So thinking PHP is horrible without ever having ever used it is as bad as thinking PHP is good without ever having used anything better.


Aye, while reading the epic Eevee's epic PHP rant recently it struck me how much it heightened my appreciation for all the things better-designed languages managed to get right, and all the things they managed to avoid.

The amount of sheer genericity, that is consistent reuse of concepts and freedom of expression stemming from wide application of simple rules, in something like Python is staggering compared to the myriad problems he lists with things like PHP's object model, built-in types, assignment mechanics, etc.

I started out doing web development in PHP in the 90s and then eventually graduated to desktop application work in C++ and finally added Python (on the desktop and also again for the web) to the mix in the last half-decade, and while I realized quickly that these were better languages and that they were much more fun to use due to the features they offer and the way things just click into place, Eevee's post was a fun tour of all the little whys.

Then again, Python 2.x's ordering rules - falling back to alphabetical collation of the type names when objects can't be ordered otherwise - almost smells of PHP-style implicitness :). Good thing that was made more strict in Python 3.


Not to make this into a 'my language is better than yours' debate because we all know how annoying those are, but imo once one has used enough languages, one realizes that all of them have good and bad things. Like you I'm mostly a C++ developer nowadays, and C++ has plenty of warts, but like PHP, the advantages outweigh the disadvantages (for me). Now one can say that I picked the two worst languages as examples (and to base my career on), and certainly PHP and C++ are the two languages that are most crapped upon nowadays, but at the same time they're also the most popular ones. Other languages that I've used all show not so nice aspects, even after not all that intensive use.

To take your Python example: I recently wrote a small Python application because in that context, Python was the obvious choice. Turns out that instantiating an object of a variable class name is quite non-intuitive (I don't even remember how it was done, it was typically something you need to look up every time you use, much like the syntax of calling a member function through a function pointer in C++ - I looked that up so often that I know by heart now that it's on page 219 of the 2nd edition of the Stroustrup - but I disgress...). Whereas in PHP it's simply $classname = 'AClass'; $a = new $classname(); . Completely obvious and in line with the way everything else works in PHP.

Again this is not to diss Python, I like some of the things of it that it does differently than other languages and there are many people doing great things with it. It may even well be that in the aggregate, Python has less 'annoyances' or rough parts than PHP, I don't know. It's just an example to illustrate that things are never black or white, and IMO the whole 'I hate XYZ' is widely overblown, because really, life is too short to get one's panties in a bunch over a stupid programming language, of all things. Sure I am annoyed with bad tools, but hating them and spending hours and hours crusading against them... That's the ultimate waste of time, im (maybe not even so h) o.


First of, let me say that I absolutely agree with your opening statement: I find that with every new language I learn, as long as it is at least somewhat viable and a little different from those I used before, it makes me a better programmer in all the languages I already know, because I get to think about problems in terms of the sum of all these languages and be more reflective and realistic about their strengths and weaknesses. A little programmer Sapir-Whorf going on there maybe?

As for your Python example of instanciating a class by a string - well. I realize this is going to be the groan-I-knew-someboy-was-going-to-do-it response, but I can't resist listing some imho not-so-hard ways to do this anyway:

- If you know the namespace the class is in, say your locals or globals, you can instanciate it by indexing the dictionaries returned by globals() or locals() respectively, say: globals()['classname'](constructor arguments)

- If the class is in a module, it's an attribute of the module object. If your class is nested in another class (or class instance), it's an attribute of the class (or one of its instances). Then you can do an attribute fetch by name string using the built-in getattr() function: getattr(module or any other object, 'classname')(constructor args)

- If two ways of doing this already sounds like too much, there's vars(): Without an argument it's identical to locals(), with an object as argument it returns that object's naemspace dictionary, which you can then index: vars(nothing or module or any other object)['classname'](constructor args)

- Of course, since classes are just objects, you can also add them to a container, and then access them that way. I.e. you can do: adict = { aclass.__name__ = aclass } and then adict['aclass'](constructor args)

IMHO, these examples demonstrate the same sort of "in line with the way everything else works in Python" property: Objects have namespace dictionaries that store their attributes. Attributes reference objects. Classes are objects. Modules are objects. Dictionaries are objects and reference objects.

And this sort of consistency is something Python is, for the most part, really really good at. Cf. the simple rules for assignment consistently popping up everywhere: Your regular assignment operation, function argument passing, loop variable assignment, and so on. And since assignment in Python can do impressive things (say, iterable unpacking: a, b, c = [1, 2, 3] - even nested, very handy to unpack lists of lists in a loop) the fact that it's used postively everywhere brings great power, from simple rules. That's what I meant.

No, truth be told, Python is not without its warts either. The idiotic ordering in Python 2.x I mentioned earlier is one such example (thankfully now fixed in version 3 of the language, along with a slew of others). The somewhat ugly exception of classes that use "slots" to store their attributes rather than namespace dictionaries are another (still around even in v3, though thankfully used only rarely, and built-ins like getattr() and vars() work the same on them and their instances regardless) are another. But compared to PHP ...


> I've been using PHP for well over 10 years, and I love this thing.

You're not alone. There are many of us. PHP powers the Internet, period. Facebook, Wikipedia, Wordpress, Drupal, etc. etc. You can whine all you want about this and that, but you can't argue with success.

As far as hammers go, I had my wife make me a stuffed PHP elephant! It's on my desk right now.


PHP powers the Internet, period.

That's a bit strong; I would even say it borders on being outright false no matter how you meant it. PHP is convenient for bashing out quick server-side scripts, but it doesn't "power the Internet" any more than any other language does.

Facebook, Wikipedia, Wordpress, Drupal, etc. etc. You can whine all you want about this and that, but you can't argue with success.

"Success"? You say it as though the use of PHP were in any way consequential to the success of those projects. Wordpress and Drupal, maybe, but Wikipedia and Facebook are squarely business successes more than anything.

I'm not saying PHP is necessarily as bad as people make it out to be (though I personally think it is), but the fact that a company like Facebook uses PHP (and in fact has poured millions into desperately engineering around its many faults) isn't exactly a shining testament to the virtue of the language (any more than a hypothetical Company X using COBOL internally would make COBOL a better language).

See:

* http://www.quora.com/Would-Facebooks-maintenance-costs-be-lo...

* http://www.quora.com/Quora-Infrastructure/Why-did-Quora-choo...

* http://www.quora.com/Do-Facebook-engineers-enjoy-programming...


Most people who praise the fact that Wikipedia and other software is written in PHP have never actually taken a good look at the source code and tried to do anything with it.

Care to discuss the design and architecture of the Mediawiki parser and template system, and what its history and future look like?


Oh, I will! I am a proud colleague and friend of the guy that made this hammer.

The future of MediaWiki's parser and templating system won't be PHP. It will be Node.JS.

http://www.mediawiki.org/wiki/Parsoid


There are many of us. PHP powers the Internet, period. Facebook, Wikipedia, Wordpress, Drupal, etc. etc.

There is a difference between the web and the internet. The Internet is powered by computer networking hardware, on the on the other hand, the web is powered by utter crap like HTML, CSS, JavaScript, and of course PHP.


"… but you can't argue with success."

McDonalds sells more meals than French Laundry. I don't think Thomas Keller cares.

PHP certainly has it's niche, and like the "fast food" niche, it can be adequately nutritious and fullfilling for the customers, and hugely profitable for the sellers.

There are _certainly_ other ways to do things though, and without doubt ways of measuring results that are more or less flattering to PHP. I'm not personally any more enamored with "Enterprise Java" as as web development tool, but there's clearly people selling those solutions who've got a _very_ convincing sales pitch.

(But yeah, I can see why PHP specialists might be "over" HN's typical attitude towards PHP…)


Period?

C powers the Internet, period. Facebook, Wikipedia, Wordpress, Drupal, etc. etc. You can whine all you want about this and that, but you can't argue with success.


Yeah yeah smart kid. And x86 machine code, and transistors, and electrons. And sand, and don't forget about the high-tech machines that were used to make the chips.


Kittens power the internet, everybody knows that.


> C powers the Internet, period.

PHP is written in C. So, yeah, I guess that's true.


Hey stop unfairly dissing C! It's perfectly possible to implement well designed programming languages in C. Blame the programmer, not the implementation language, for PHP's atrocities. It's not Dennis Ritchie's fault -- Rasmus Lerdorf deserves the blame.



I would prepare for some pictures of "duct tape and bailing wire... [that] we love it for...", if only I could imagine it could be done as creatively as the above hammer. But you know, the more I read these analogies the more I'm beginning to like PHP, not as something to work with but as that second cousin you met once at a family gathering and remember as being odd but nice and a funny guy.


Quite possibly the best thing I've seen this month. You can hammer nails using the side... Sorta.


If you offset one side, it might actually be useful for longer nails that are already started, you could turn the Hamm... I mean claw tool around and continue to extract the nail where you don't have to tilt the handle all the way down and put that narly bend in the nail. Nice job on the construction.


Wow, he did a really good job of making that weld disappear.


Yeah, I love how it's two perfectly good hammers, cut in half ; with the most important bit thrown away, and the rest "cut-n-pasted" together, then lovingly smoothed over so you cant tell… I think I've seen that before…


I want one with JavaScript written on it. And a curved nail with DOM written on it.


and of course the handle is semi-colon shaped and completely optional!


With completely being not so complete. Sometimes they change the code flow.


want!!

If you're going to make more, please announce; I'm buying.


I've seen worse Kickstarters.


I don't know what exactly to call this corner of the world, but this is exactly why I love it.


couldn't agree more.


Rasmus Lerdorf was at my college recently, and he too describes PHP in the very same terms.

>GG: Your take in one line on PHP.

>RL: In one line…it’s a web hammer - the one tool that you can use to solve any web problem you have.

Full interview at http://gg.ieeeiitr.com/rasmus_interview.php

The interview was for the college IEEE magazine.


Where do I place an order?


I'm sure there's a joke somewhere in its resemblance to a Ruby pickax, but I'll leave it for someone else to sort out.


Right now this is the top post on HN. Why?


Thanks for the downvotes, but I'm serious. A link to "funny" image is at the very top, this is one small step from memes being posted on HN.


It relates to a previous thread on HN discussing PHP being like a hammer with a claw on both sides. It's not some random image link.


Shouldn't it then be a comment on that thread? I see plenty of comments in serious threads pointing out that topic was already discussed in referenced threads.


Easily the best part of this photoset is that it's hanging in a spot labelled "wrench".

I have never seen PHP explained quite so succinctly.


This. Is. Awesome.


hahaha, that is fantastic


I don't see what all the fuss is. A good craftsman could build a house no matter what hammer he chooses. Don't be such a snob about insisting that hammers must have heads to drive nails, just because all the hammers you've used before happened to have them.


For that matter, why do they even need handles? Primitive ape-men just used big rocks as their tools. If it's good enough for the ape-men...!


Hey, you read the article that inspired the artifact! linked...


I once watched an ape-man try to use modern tools. He didn't get anything done, because he spent all his time trying to figure out how to use them. Simple people need simple tools. We thus can't complain about the existence of such tools.


Where did you see an actual ape-man?


A PHP conference, perhaps? :D


More likely at a Rails conference ;-)


A rock would be too simple; this is PHP, after all.

(Where's my NailDriverDeviceFactoryModuleImpl?)


You're confused with Java. In PHP it is simple, just counter-intuitive and set up to mislead you. It would look like a rock but turn into a viscous liquid as soon as you try to hit the nail and the nails get stuck in it.


Sounds like a description of a non-newtonian fluid, like maize flour mixed with water (which you can compact in your hand but liquefies when thrown), or quicksand.


In Java it would be:

DeviceFactoryFactory().createDeviceFactory().getNailDriverDeviceFactoryModuleImpl();


http://steve-yegge.blogspot.com.au/2006/03/execution-in-king... For the lack of a nail, throw new HorseshoeNailNotFoundException("no nails!");


I'll have you know that a good Ape man doesn't need a stick. He uses his eye-socket!


My hammer makes your hammer look ..well. ape-ish, http://i.imgur.com/R5CwZ.jpg



thanks that gave me a laugh!


You had a great opportunity to use the word "peen" in context and you let it go. Shame.


The fuss is that good tools don't require you to be a prize-winning craftsman to do day-to-day things.


More PHP envy? Get over it, PHP > all, and that's not gonna change anytime soon


This thread has very much of a "She's a witch! Burn her!!" vibe going on.




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

Search: