Live data from Hacker News

Addition of 1 and 1 in PHP

github.com

71–80 of 89 posts

Re: Addition of 1 and 1 in PHP

#71

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…

Frameworks are also very useful. They can provide a tested database layer that prevents SQL injection, form data validation and escaping, straight-forward MVC structure, and a library of common functions that are well tested and help developers avoid common mistakes.

Ideally, a framework would have some basic elements and then additional components that can be included if required by a project but aren't core to the framework.

Re: Addition of 1 and 1 in PHP

#72

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?

The library supports adding other numbers than 1 and 1. Your use case of adding 2 to 1 is supported. As are multi-digit numbers. As are negative numbers.

As you can see, the library is quite advanced.

Re: Addition of 1 and 1 in PHP

#74
post #70
post #69

Earlier quoted context omitted.

>we need frameworks to implement the same http kernels so we can plug any middleware no matter what the lib is , that's very important. This is great news - it means PHP is going down the same route that very nearly lead Java to its death and still makes it the laughing-stock of the Dev world. PHP does not have this much traction with enterprisey enterprises, so following Java here probably means PHP is heading for a…

All web solutions use pluggable middleware ( Ruby Rake , Python WSGI , NodeJS Connect ). So PHP getting some abstraction is JAVA-ISH ?

s/Rake/rack

Re: Addition of 1 and 1 in PHP

#76
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'.

On the note of that, there should really be a SimpleNumberFactory.

Re: Addition of 1 and 1 in PHP

#77
post #70
post #69

Earlier quoted context omitted.

>we need frameworks to implement the same http kernels so we can plug any middleware no matter what the lib is , that's very important. This is great news - it means PHP is going down the same route that very nearly lead Java to its death and still makes it the laughing-stock of the Dev world. PHP does not have this much traction with enterprisey enterprises, so following Java here probably means PHP is heading for a…

All web solutions use pluggable middleware ( Ruby Rake , Python WSGI , NodeJS Connect ). So PHP getting some abstraction is JAVA-ISH ?

I notice that all of those things are internally simple. No bloat required.

Re: Addition of 1 and 1 in PHP

#79

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…

You know, planes are a very simple concept: something that flies. Aerospace engineering should reflect that.

Re: Addition of 1 and 1 in PHP

#80
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.

cringe ... a<0?sth:sthelse; phew...
Post reply on HN