Object-Oriented Programming in and Test-Driven Development with PHP 5

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    8 Favorites

    Object-Oriented Programming in and Test-Driven Development with PHP 5 - Presentation Transcript

    1. Object-Oriented Programming in and Test-Driven Development with PHP 5
    2. Who I Am
      • Born in 1978.
      • Student of Computer Science, University of Bonn, Germany.
      • Member of the PHP Development Team.
      • Author of PHP Open Source projects like PHPUnit or phpOpenTracker.
    3. Who Are You?
      • Who of you uses PHP?
      • Who of you does OOP with PHP?
      • Who of you has looked at PHP 5 already?
    4. Classes and Objects
    5. Classes and Objects
    6. Classes and Objects
    7. Constructor
    8. Destructor
    9. Class Type Hints
    10. References
    11. References in PHP 4
    12. References in PHP 5
    13. Object Cloning
    14. Class Context
    15. Abstract Classes
    16. Interfaces
    17. Exceptions
    18. Interceptor Methods
    19. Interceptor Methods
    20. Interceptor Methods
    21. Interceptor Methods
    22. Interceptor Methods
    23. Iterators
    24. Why Unit Tests?
      • Why Unit Tests?
      • Why test software at all (as a developer)?
        • „I have no time to write tests!“
        • „Testing is boring and stupid!“
        • „My code is flawless! At least it is good enough.“
        • „It is the testing department's job to test, right?“
        • These excuses lead to a vicious circle that is hard to break.
    25. Test-Driven Development
      • Write the test before the production code!
        • The test motivates the production code.
        • There can be no production code that is not covered by a test at any time.
        • Improved confidence in the code.
      • Write only as much production code as needed to make the corresponding test pass!
        • The production code is ready when the test passes.
        • Helps to prevent bloated code.
    26. Unit Testing Frameworks
      • Unit Tests
        • Originate in Procedural Programming.
          • Unit = Procedure.
        • Object-Oriented Programming
          • Unit = Method, Class, Package, Project.
      • Only automated test excecution and analysis makes Test-Driven Development feasible.
        • If tests would have to be manually executed they were doomed to be ignored.
        • That is what frameworks like PHPUnit are for ;-)
    27. PHPUnit
      • PHPUnit is a regression testing framework used by the developer who implements Unit Tests in PHP.
      • It is a port of JUnit, which is the de-facto standard in the Java World.
        • Has features JUnit doesn't (or only through add-ons), like Code Coverage, TestDox, and support for incomplete tests.
      • Work on PHPUnit for PHP 4 started in 2001.
        • No longer developed, bug fixes only.
      • PHPUnit2 is a complete rewrite that uses the new object-oriented language features of PHP 5.
        • Will get a JMock-inspired implementation of Mock Objects later this year.
      • It aims at „API Similarity“ with JUnit so that existing documentation can be leveraged.
    28. PHPUnit
    29. PHPUnit
    30. The BankAccount Example
      • Contract
        • A bank account's balance
          • ... is initially zero.
          • ... cannot become negative.
      • Interface
        • getBalance()
        • setBalance($balance)
        • depositMoney($amount)
        • withdrawMoney($amount)
    31. The BankAccount Example
    32. The BankAccount Example
    33. License
      • These slides are available under the Creative Commons Attribution-NoDerivs-NonCommercial 2.0 license.
      • You are free to copy, distribute, display, and perform the work under the following conditions:
        • Attribution: You must give the original author credit.
        • Noncommercial: You may not use this work for commercial purposes.
        • No Derivative Works: You may not alter, transform, or build upon this work.
        • For any reuse or distribution, you must make clear to others the license terms of this work.
        • Any of these conditions can be waived if you get permission from the author.
      • Your fair use and other rights are in no way affected by the above.

    + Sebastian BergmannSebastian Bergmann, 4 years ago

    custom

    3519 views, 8 favs, 0 embeds more stats

    More info about this document

    CC Attribution-NonCommercial-NoDerivs LicenseCC Attribution-NonCommercial-NoDerivs LicenseCC Attribution-NonCommercial-NoDerivs License

    Go to text version

    • Total Views 3519
      • 3519 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 8
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories