Live data from Hacker News

Addition of 1 and 1 in PHP

github.com

21–30 of 89 posts

Re: Addition of 1 and 1 in PHP

#21
post #7

I know a couple of Java programmers that will find this helpful. Thanks.

What Java really needs is a KitcheSink class. I'm pretty sure there's already one in PHP.

No, but it has a bunch of kitchensnk_ functions in the kitchensnk extension.

Re: Addition of 1 and 1 in PHP

#22
post #6

Yes this is a good joke until you realize there is no other way to get some level of type safety in PHP other than adding a bunch of unnecessary classes.

Oh come on, PHP is a dynamically typed language. That's the trade.

Re: Addition of 1 and 1 in PHP

#24
post #20

This is so funny. The author's description is great on github, really fooling you at times. Even if this isn't intended as a joke, the dedication to doing something fun to prove a point got me thinking about over engineering design patterns too.

>"got me thinking about over engineering design patterns too."

Relevant: http://me.veekun.com/blog/2013/03/03/the-controller-pattern-... (by the same dude who wrote "PHP: A Fractal of Bad Design", no less)

Re: Addition of 1 and 1 in PHP

#29
post #13

Reminds me of something I wrote a few months ago on how to detect negative numbers: http://stackoverflow.com/a/11910993/1329367 but obviously the one above has much more value add and follows better design patterns.

You have to have a sick mind to come up with something like that, I salute you sir.

Re: Addition of 1 and 1 in PHP

#30

What if I need to add 2 and 1? Is there a lib for that? Or would this one need to be completely refactored? Also, in what version could we expect ability to handle 2 digit (or more!) numbers?

If you're going to implement 2+1 functionality, make sure to add the appropriate unit tests.
Post reply on HN