1. PHP / Говнокод #12236

    +121

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    This awesome yet simple and pragmatic PHP library performs an addition of two numbers.
    
    In early stages of Internet, developers were forced to work with poor, dry, functional, horrific languages. Everything had to be done through austere functions and operators. There was no objects. No interfaces. No dependency injection.
    
    For example, to make something as simple as an addition, our dads had to write: 1+1. Yeah, really.
    
    Hopefuly now, we have PHP 5.3 and its solid OOP implementation. SimplePHPEasyPlus lets you make this addition in a more fashionable way, using real OOP. It is fast, simple, flexible and tested. To add 1 to 1, all you have to do is:
    
    use SimplePHPEasyPlus\Number\NumberCollection;
    use SimplePHPEasyPlus\Number\SimpleNumber;
    use SimplePHPEasyPlus\Number\CollectionItemNumberProxy;
    use SimplePHPEasyPlus\Parser\SimpleNumberStringParser;
    use SimplePHPEasyPlus\Iterator\CallbackIterator;
    use SimplePHPEasyPlus\Operator\AdditionOperator;
    use SimplePHPEasyPlus\Operation\ArithmeticOperation;
    use SimplePHPEasyPlus\Operation\OperationStream;
    use SimplePHPEasyPlus\Engine;
    use SimplePHPEasyPlus\Calcul\Calcul;
    use SimplePHPEasyPlus\Calcul\CalculRunner;
    
    
    $numberCollection = new NumberCollection();
    
    $numberParser = new SimpleNumberStringParser();
    
    $firstParsedNumber = $numberParser->parse('1');
    $firstNumber = new SimpleNumber($firstParsedNumber);
    $firstNumberProxy = new CollectionItemNumberProxy($firstNumber);
    
    $numberCollection->add($firstNumberProxy);
    
    $secondParsedNumber = $numberParser->parse('1');
    $secondNumber = new SimpleNumber($secondParsedNumber);
    $secondNumberProxy = new CollectionItemNumberProxy($secondNumber);
    
    $numberCollection->add($secondNumberProxy);
    
    $addition = new AdditionOperator('SimplePHPEasyPlus\Number\SimpleNumber');
    
    $operation = new ArithmeticOperation($addition);
    
    $engine = new Engine($operation);
    
    $calcul = new Calcul($engine, $numberCollection);
    
    $runner = new CalculRunner();
    
    $runner->run($calcul);
    
    $result = $calcul->getResult();
    $numericResult = $result->getValue(); // 2
    This library is now available for production purposes. Enjoy!

    [КО]Складывает 2 числа[/КО]

    Запостил: Vasiliy, 01 Декабря 2012

    Комментарии (8) RSS

    • > simple and pragmatic
      Кто разобьёт аффтору розовые очки? )
      Ответить
    • Сложно оценивать с прагматической точки зрения то, что написано сугубо для лулзов.
      Ответить
      • Насчет сугубо для лулзов вспомнилось: https://github.com/tenderlove/enterprise

        I’m sure you’re asking yourself, “how can the enterprise gem promise so much?”. Well the answer is easy, through the magic of XML! The enterprise gem allows you to write your Ruby code in XML, therefore making your Ruby and Rails code scale. Benefits of writing your code in XML include:
            It’s easy to read!
            It scales!
            Cross platform
            TRANSFORM! your code using XSLT!
            Search your AST with XPath or CSS!
        The enterprise gem even comes with a handy “enterprise” binary to help you start converting your existing legacy Ruby code in to scaleable, easy to read XML files. Let’s start getting rid of that nasty Ruby code and replacing it with XML today!
        Ответить
    • а ссылку на репозиторий?
      https://github.com/Herzult/SimplePHPEasyPlus
      Ответить
    • Ничего так, ынтырпрайзно.
      Ответить
    • we need a lot MORE namespaces!
      Ответить
    • They are pretty common so far as these kinds of helmets go?athe headphones are built into the neckroll for any comfy fit, [url=http://www.beatsbydre-spiderman.com]Spider Man Beats Cheap[/url] and there's a mic and remote to the wire, so it is possible to take calls, change tunes, and change the quantity [url=http://www.beatsbydre-spiderman.com]Spider Man Beats[/url] . It is available in white or black and runs from XS-XXL for an ideal match. And for those who currently possess a POC helmet and don't want to pay the complete $110 to get a new head protector, you could just purchase the neckroll for $180.
      Ответить

    Добавить комментарий