Aspect-Oriented Programming and Depedency Injection

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

    1 Favorite & 1 Group

    Aspect-Oriented Programming and Depedency Injection - Presentation Transcript

    1. Robert Lemke | TYPO3 Association AOP and Dependency Injection
    2. Overview About me, the flow and buzz ... Unit Testing Dependency Injection Aspect-Oriented Programming AOP and Dependency Injection
    3. About me Robert Lemke, born 27/05/1976 beautiful code evangelist \"chief architect\" of TYPO3 5.0 and FLOW3 coffee junkie married, no children, 1 espresso machine AOP and Dependency Injection
    4. HINT About me Robert Lemke, born 27/05/1976 beautiful code evangelist \"chief architect\" of TYPO3 5.0 and FLOW3 coffee junkie married, no children, 1 espresso machine AOP and Dependency Injection
    5. About FLOW3 Offspring from the development of TYPO3 5.0 PHP-based enterprise application framework Enterprise: Information intensive applications with focus on domain logic FLOW3 is ready to go, with a default layer architecture, object management, security etc. Special support for Domain-Driven Design AOP and Dependency Injection
    6. About the buzz AOP, DI, DDD, TDD, XP, ... ? YAGNI ? IMYLME ! AOP and Dependency Injection
    7. The Demo Package Demo AOP and Dependency Injection
    8. Unit Testing Testing is important (as if you didn't know that) But not every code can be tested Dependencies make your developer's life hard AOP and Dependency Injection
    9. Unit Testing Dependencies Problem: Classes explicitly refer to other classes: AOP and Dependency Injection
    10. Unit Testing Dependencies Try to test this class: AOP and Dependency Injection
    11. Unit Testing Dependencies Unit Testing: You want to test a small unit You don't want to test The Simple File Logger The Card Repository AOP and Dependency Injection
    12. Unit Testing Dependencies Unit Testing: You want to test a small unit You want to test if the action returns a string representation of the random card it gets from the repository AOP and Dependency Injection
    13. Dependency Injection A class doesn't ask for the instance of another class but gets it injected This methodology is referred to as the \"Hollywood Principle\": \"Don't call us, we'll call you\" Enforces loose coupling and high cohesion Allows you to mock collaborators Makes you a better programmer AOP and Dependency Injection
    14. Dependency Injection Constructor without Dependency Injection AOP and Dependency Injection
    15. Dependency Injection Component with Constructor Injection AOP and Dependency Injection
    16. Dependency Injection Component with Setter Injection AOP and Dependency Injection
    17. Dependency Injection Component Manager Manages the whole object lifecycle Provides so-called \"IoC Container\" Components: objects Components can be configured AOP and Dependency Injection
    18. Dependency Injection Autowiring FLOW3 tries to autowire constructor arguments and arguments of inject* methods The type of the component to be injected is determined by the argument type (type hinting) Autowiring does not work with Setter Injection through regular setters (set* methods) Dependencies are only autowired if no argument is passed explicitly AOP and Dependency Injection
    19. Dependency Injection Component scope Component objects always live in a certain scope Currently supported scopes are: Singleton - Only one instance exists during one script run Prototype - Multiple instances are possible AOP and Dependency Injection
    20. Dependency Injection Component scope The scope can be defined through an annotation in the component class (recommended) through the component configuration in a Components.php file The default scope is \"Singleton\" AOP and Dependency Injection
    21. Components Component scope AOP and Dependency Injection
    22. Components Creating Prototypes Dependency Injection can be used in almost any case, there's no need to call getComponent() But what if you need to instantiate a component within a method? AOP and Dependency Injection
    23. Components Creating Prototypes Solution A: Call getComponent() AOP and Dependency Injection
    24. Components Creating Prototypes Solution B: Call a factory method AOP and Dependency Injection
    25. Aspect Oriented Programming AOP is a programming paradigm complements OOP by separating concerns to improve modularization OOP modularizes concerns: methods, classes, packages AOP addresses cross-cutting concerns AOP and Dependency Injection
    26. Aspect Oriented Programming Cross-cutting concerns Presentation Domain Data source AOP and Dependency Injection
    27. Aspect Oriented Programming Cross-cutting concerns Presentation The concerns live here Domain Data source AOP and Dependency Injection
    28. Aspect Oriented Programming Cross-cutting concerns Some Domain Model CONCERNS Security X-ING Logging AOP and Dependency Injection
    29. Aspect Oriented Programming PHP's missing features With AOP you can centralize and cleanly separate your concerns intercept any method call add new behavior to legacy code without touching it do a lot of dirty tricks AOP and Dependency Injection
    30. Aspect Oriented Programming Some Vocabulary Advice encapsulated code, to be re-used Joinpoint places in the code where advice can be applied Pointcut identifies set of joinpoints where advice should be applied Aspect groups advices and pointcuts AOP and Dependency Injection
    31. The AOP Hello World Classic Demo Demo AOP and Dependency Injection
    32. Aspect Oriented Programming Applications for AOP Logging Security Transactions Persistence Statistics In the Domain Layer AOP and Dependency Injection
    33. Aspect Oriented Programming Behind the Scenes Dynamic Proxy Classes Component Manager delivers the right implementation Only works if \"new\" is not used AOP and Dependency Injection
    34. More ... AOP and Dependency Injection
    35. More Where can I get FLOW3? From our Subversion repository: https://svn.typo3.org/FLOW3/Distribution/trunk/ AOP and Dependency Injection
    36. More ... DEV3 AOP and Dependency Injection
    37. More ... AOP Browser AOP and Dependency Injection
    38. More ... Known Issues FLOW3 (or rather PHP) currently causes Apache crashes - why ever ... Tests consume a lot of memory (> 400 MB) Access is comparably slow even in Production context (~ 3 req/s) and needs much memory (~ 20 MB) Many aspects are work in progress and neither optimized nor finished AOP and Dependency Injection
    39. Links FLOW3 Website http://flow3.typo3.org TYPO3 Forge http://forge.typo3.org T3CAST http://typo3.org/podcasts/robert AOP and Dependency Injection
    40. So long and thanks for the fish Questions AOP and Dependency Injection

    + Robert LemkeRobert Lemke, 2 years ago

    custom

    2471 views, 1 favs, 4 embeds more stats

    From the Dynamic Languages World 2008 in Karlsruhe. more

    More info about this document

    CC Attribution License

    Go to text version

    • Total Views 2471
      • 2265 on SlideShare
      • 206 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 54
    Most viewed embeds
    • 200 views on http://flow3.typo3.org
    • 4 views on http://mauriziostorani.wordpress.com
    • 1 views on http://wiki.assai.ch
    • 1 views on http://bertrandkeller.info

    more

    All embeds
    • 200 views on http://flow3.typo3.org
    • 4 views on http://mauriziostorani.wordpress.com
    • 1 views on http://wiki.assai.ch
    • 1 views on http://bertrandkeller.info

    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

    Groups / Events