Live data from Hacker News

Addition of 1 and 1 in PHP

github.com

51–60 of 89 posts

Re: Addition of 1 and 1 in PHP

#51
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)

Everything this guy writes is toxic. He consistently misrepresents reality to fit his biases.

Re: Addition of 1 and 1 in PHP

#52

Pretty much sums up how I feel about most of the big frameworks (Zend in particular, but also Symfony and CakePHP). The problem of over-engineering isn't just related to the big PHP frameworks - the same problem exists in Python and Ruby. At its core, web development is about taking some user input, validating it, throwing it in a database, and displaying it again (perhaps slightly modified) to users. That's a fairly…

It's a fairly "simple concept", but I'm sure you would agree that it gets complicated when you get into the details. No way around that.

Re: Addition of 1 and 1 in PHP

#53
post #34

While we are discussing PHP, why is the ternary operator nesting behavior different from every other mainstream language using "?" and ":" ?

there's a lot of stuff in PHP that bothers me...mostly consistency of function arg orders and function naming. but this has to be the one that really drives me up the wall. i cannot believe they choose to maintain this broken implementation because it's defined improperly in the spec. just yuck.

Re: Addition of 1 and 1 in PHP

#54
post #21

Earlier quoted context omitted.

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.

Those have been deprecated, you really need to be using the real_ksink functions.

Be careful, though, the argument order swapped.

Re: Addition of 1 and 1 in PHP

#55
I love it.

And I hope that after all the types of fad programming (that work almost as good as the fad diets) we will get to the "common sense programming" - use the proper tools and scale for the problem and don't try to fit the problem in your tools and frameworks.

Re: Addition of 1 and 1 in PHP

#56
post #5

The only flaw I can see is that the string literal '1' should have been declared as a const somewhere, preferably in another unrelated library, and called something like 'UNITY_VALUE'.

See, this is why I'm tired of freelancers and architecture astronauts at companies who just like to make things more complicated.

UNITY_VALUE? Seriously? The agile approach would be to contact the customer, ask them what kind of user story they need to interact with the number 1, e.g. "As an admin, I want to interact with the number that is the square root of 1, which is also the product of i^4, and the multiplicative identity." There may be some back and forth on this, since regular users (not just admins) will want to work with the number prescribed above.

Then, you need to draw up a quick prototype. We don't need any crap like UNITY_VALUE polluting our beautiful agile code. Instead we'll declare a constant called ONE somewhere. (It doesn't matter where you put it, since we'll probably just Martin Fowler that code anyway in 10 weeks--actually, make that 2.)

Then you go back to the customer, show them the prototype. In my opinion, it helps to show them Euler's identity or the multiplicative identity just to assure them it works, in case they doubt it. (They probably will doubt it, since all this agile process stuff looks like automagic to the unenlightened morons we call customers.)

Then move on. Done. Bam. No need for this UNITY_VALUE junk. No additional libraries. Agile magic.

Re: Addition of 1 and 1 in PHP

#57
post #11

I'm not familiar with the PHP ecosystem. Is the author making fun something other than obvious over-engineering? Does he or she feel like that's a problem in the PHP ecosystem? I'm criticizing, because it's funny. I'm just trying to figure out if theres some wisdom being conveyed that I'm missing.

I think he is mocking the general pattern of over-engineering and PHP just happens to be the language he wrote this in. At least PHP is not a language known for massive over-engineering. Usually people associate the exact contrary with PHP. But there is indeed a recent trend towards better object oriented designs in PHP and with it comes also more over-engineered code. But I have yet to see any Java-style absurdity.…

Yeah ... Take a look at Drupal 8 and you'll start to see this creeping in. I overheard Dries saying he wants to see Java style comments and wants to be more like Java.

Re: Addition of 1 and 1 in PHP

#58
post #11

Earlier quoted context omitted.

I think he is mocking the general pattern of over-engineering and PHP just happens to be the language he wrote this in. At least PHP is not a language known for massive over-engineering. Usually people associate the exact contrary with PHP. But there is indeed a recent trend towards better object oriented designs in PHP and with it comes also more over-engineered code. But I have yet to see any Java-style absurdity.…

> I have yet to see any Java-style absurdity. Then you probably haven't tried Zend Framework ;)

So what am I in for with Drupal 8 since the two communities are combining?

Re: Addition of 1 and 1 in PHP

#59
post #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.

Strong typing and dynamic typing are orthogonal. You can have the former and ignore the latter - see Python - and you can completely forget about both - see PHP.

Re: Addition of 1 and 1 in PHP

#60

Earlier quoted context omitted.

> I have yet to see any Java-style absurdity. Then you probably haven't tried Zend Framework ;)

So what am I in for with Drupal 8 since the two communities are combining?

Drupal 8 will use Symfony2 components, not Zend.
Post reply on HN