Aspect-Oriented Programming for PHP

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

    6 Favorites

    Aspect-Oriented Programming for PHP - Presentation Transcript

    1. phpAspect A spect- O riented P rogramming William Candillon { [email_address] }
    2. O verview
      • Acknowledgment
      • Introduction to AOP
      • phpAspect
      • New features
      • Conclusion
    3. A cknowledgment
      • Gilles Vanwormhoudt ( [email_address] )
        • PhD in computer science at Telecom Lille
        • Collaborator on the phpAspect project
      • Yijun Yu ( [email_address] )
        • PhD in computer science, University of Toronto
        • Author of Yaxx
      • Sebastian Bergmann ( [email_address] )
        • Diploma Thesis, University of Bonn.
        • Google soc mentor
    4. P rogramming evolution
    5. Introduction to AOP
    6. O bject- O riented P rogramming
      • Advantages
        • Business modeling
        • Reusable technicals components
        • Design patterns
        • Frameworks
      • Vertical organization
        • Inheritance and interfaces
        • Objects graph
    7. T echnicals aspects in OOP
    8. S ymptoms
      • Inheritance can't modularize horizontal concerns
      • Code Tangling
      • Code scattering
      • Difficulties
        • Code comprehension
        • Code reusability
        • Code evolution
    9. A spect- O riented P rogramming
      • A new programming paradigm...
        • Working with OOP
        • Split technicals concerns from the business logic
      • ...defining mechanisms for
        • Writing aspects as a new software entity
        • Wrapping crosscutting concerns
        • Coating business logic with technicals concerns
    10. G eneral idea
      • Inversion of technicals dependencies
    11. J oinpoints
      • Identified instructions in the program flow:
        • Method execution (1)
        • Attribute writing/reading (2)
        • Objects construction (3)
        • Method call (4)
        • Objects destruction (5)
        • Exception throwing (6)
      • A pointcut is a logical association of joinpoints
      1 2 3 4 5 6
    12. C ode advices
      • Injected code in pointcuts
      • 3 types:
        • Before
        • Around
        • After
      • Aspect and joinpoint reflection to explore the context
        • Methods, arguments, targeted object etc...
    13. I nter-type declarations
      • Inter-type attributes
      • Inter-type constants
      • Inter-type methods
    14. W ildcards and operators
      • * denotes any method visibility, method scope, class name, method name or parameters number.
      • + denotes type or any subclass or subinterface of a given type in a join point .
      • The || offers the possibility to combine join points in an advice declaration.
    15. S imple persistence example
      • Business logic
      • Aspect
    16. phpAspect
    17. PHP
      • A highly dynamic language...
        • Easy to learn
        • Object-Oriented
        • Mainly designed for web applications
        • Used in more than 25 millions of websites.
      • ...more and more used outside its web context
        • Rapid prototyping
        • PHP-GTK applications
        • Command-Line interpreter
    18. S tate of the art in PHP
      • phpAspect
        • Static approach
        • Compiler architecture (Lex/Yacc)
      • Seasar
        • Dynamic approach
        • Using PHP containers
      • GAP, by Sebastian Bergmann
        • Only conceptual for now
      • Other projects: AOPHP, aspectPHP, AOP Library for PHP etc...
    19. A virtual cart
      • A client add products in the cart.
      • Business logic without any technicals concerns.
    20. A logging aspect
      • Log every added articles and give status of the order
      • After weaving
      • Result
    21. A security aspect
      • Make a filter on the customer input
      • Protection against cross scripting injection
      • Result
    22. S ingleton aspect
      • All singletons are factorized in the same aspect
      • The link between a class and its singleton is null
    23. C urrent weaving chain
    24. New features
    25. N ew weaving chain
    26. F eatures coming very soon
      • Logicals operators:
      • Enum operator:
      • New joinpoints
      • Reusable aspects mechanisms (with Smarty)
      • Aspect introspection
    27. W eb specifics joinpoints
      • PHP has a lot of globals variables with very sensitives informations:
        • $_GET, $_POST, $_COOKIE, $_SERVER, $_SESSION
      • We need to intercept writing/reading of these for security matters.
      • File joinpoint
    28. P ersistence with phpAspect
      • There is great tools existing for object persistence: Propel for example
      • Problem: If you regenerate the classes, you lose your businesses operations
      • Solution: generate an aspect of persistence with Propel from an aspect template and classes annotations
    29. A spect DOM
      • XPath is a way better than SQL for queries on tree structure.
      • By weaving DOM interfaces we can use Xpath expressions on:
        • your object graph
        • in a visitor design pattern
      • SQL Query : SELECT * FROM book, books, author WHERE books.idbook = {$_SESSION['id']} AND book.id = books.idbook AND book.author = author.id AND author.name = 'Alexandre Jardin'
      • Xpath query : //author[@name = 'Alexandre Jardin']
    30. A spects templates (1/2)
      • Put parameters on aspects with Smarty
      • A way to define generic and reusables aspects.
      • Parameters based on the XML format.
      • Aspect template construction:
        • Parameters evaluation with Smarty
        • Result: an aspect ready to be weaved
    31. A spects templates (1/2)
      • XML parameters:
      • Template:
    32. L imitations
      • Aspects composition
      • Static weaving
      • Debugging
      • There is no PHP IDE having AOP features
    33. C onclusion
      • phpAspect:
        • Wiki: http://phpaspect.org
        • Blog: http://wcandillon.blogspot.com
      • Perspectives:
        • PHP 6 ready (namespaces)
        • Aspect composition
        • Type inference
        • Framework integration
      • Looking for an internship: http://wcandillon.netcv.org
    34. R eferences
      • AOSD community and projects: http://aosd.net
      • AspectJ in action , by Ramnivas Laddad
      • Mastering AspectJ , by John & Wiley, Joseph D. Gradecki, Nicholas Lesiecki
      • Programmation Orientée Aspect pour Java , by Renaud Pawlak, Jean-Philippe Retaillé et Lionel Seinturier.
    35. Demo
    36. Questions ?

    + wcandillonwcandillon, 4 years ago

    custom

    3655 views, 6 favs, 5 embeds more stats

    Aspect Oriented Programming (AOP) is the name given more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 3655
      • 3558 on SlideShare
      • 97 from embeds
    • Comments 0
    • Favorites 6
    • Downloads 0
    Most viewed embeds
    • 66 views on http://phpaspect.org
    • 17 views on http://bao.nguyenquoc.com
    • 9 views on http://www.phpaspect.org
    • 4 views on http://wcandillon.blogspot.com
    • 1 views on http://www.nqbao.com

    more

    All embeds
    • 66 views on http://phpaspect.org
    • 17 views on http://bao.nguyenquoc.com
    • 9 views on http://www.phpaspect.org
    • 4 views on http://wcandillon.blogspot.com
    • 1 views on http://www.nqbao.com

    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