SlideShare a Scribd company logo
phpAspect A spect- O riented  P rogramming William Candillon { [email_address] }
O verview Acknowledgment Introduction to AOP phpAspect New features Conclusion
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
P rogramming evolution
Introduction to AOP
O bject- O riented  P rogramming Advantages Business modeling Reusable technicals components Design patterns Frameworks Vertical organization Inheritance and interfaces Objects graph
T echnicals aspects in OOP
S ymptoms Inheritance can't modularize horizontal concerns Code Tangling Code scattering Difficulties Code comprehension Code reusability Code evolution
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
G eneral idea Inversion of technicals dependencies
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
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...
I nter-type declarations Inter-type attributes Inter-type constants Inter-type methods
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.
S imple persistence example Business logic Aspect
phpAspect
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
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...
A  virtual cart A client add products in the cart. Business logic without any technicals concerns.
A  logging aspect Log every added articles and give status of the order After weaving Result
A  security aspect Make a filter on the customer input Protection against cross scripting injection Result
S ingleton aspect All singletons are factorized in the same aspect The link between a class and its singleton is null
C urrent weaving chain
New features
N ew weaving chain
F eatures coming very soon Logicals operators:  Enum operator: New joinpoints Reusable aspects mechanisms (with Smarty) Aspect introspection
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
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
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']
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
A spects templates (1/2) XML parameters: Template:
L imitations Aspects composition Static weaving Debugging There is no PHP IDE having AOP features
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
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.
Demo
Questions ?

More Related Content

PPTX
Impedance Mismatch 2.0
PPTX
Whats Up With Ontopoly?
PPT
Introduction To Wpf Engines
PPTX
Custom Fields in Joomla - JoomlaDay UK 2016 - Marco Dings
PPTX
Introduction To Domain Driven Design
PPTX
Html 5 tutorial - By Bally Chohan
PDF
Paragraphs without pain (content strategy for Drupal Paragraphs)
PDF
Paragraphs and the Fieldable Authoring Experience in Drupal 7
Impedance Mismatch 2.0
Whats Up With Ontopoly?
Introduction To Wpf Engines
Custom Fields in Joomla - JoomlaDay UK 2016 - Marco Dings
Introduction To Domain Driven Design
Html 5 tutorial - By Bally Chohan
Paragraphs without pain (content strategy for Drupal Paragraphs)
Paragraphs and the Fieldable Authoring Experience in Drupal 7

What's hot (20)

PPTX
Creating a Data Driven UI Framework
PDF
Workflows - The Rise of the Machines
PPT
Html for desktop applications
PPT
Building configurable applications for the web
PPTX
Designing Optimized Symbols for InduSoft Web Studio Projects
PPT
Web 101
PPTX
Dhtml
PPT
Modern front end development
PPT
Framework
PDF
Baby steps to Domain-Driven Design
PPTX
70-480 - Programming in HTML5 with JavaScript and CSS3
PDF
Extracting deliverables from DITA
PPT
Toronto SharePoint Camp 2010
PDF
Domain driven design and model driven development
PPTX
COB - PowerApps - the good, the bad and the ugly - early 2018
PDF
Bootstrap framework and drupal paragraphs
PDF
tTecniche di sviluppo mobile per share point 2013 e office 365
PDF
Authoring Dita In Frame Maker
PPTX
Building Flexible SharePoint Solutions with AngularJS
PPTX
Oleksandr Valetskyy - C# best practices for students
Creating a Data Driven UI Framework
Workflows - The Rise of the Machines
Html for desktop applications
Building configurable applications for the web
Designing Optimized Symbols for InduSoft Web Studio Projects
Web 101
Dhtml
Modern front end development
Framework
Baby steps to Domain-Driven Design
70-480 - Programming in HTML5 with JavaScript and CSS3
Extracting deliverables from DITA
Toronto SharePoint Camp 2010
Domain driven design and model driven development
COB - PowerApps - the good, the bad and the ugly - early 2018
Bootstrap framework and drupal paragraphs
tTecniche di sviluppo mobile per share point 2013 e office 365
Authoring Dita In Frame Maker
Building Flexible SharePoint Solutions with AngularJS
Oleksandr Valetskyy - C# best practices for students
Ad

Viewers also liked (20)

ODP
Weaving aspects in PHP with the help of Go! AOP library
PDF
XREST Protocol
PDF
XQuery in the Cloud
PPT
Memorias ram2
PDF
JSONiq - The SQL of NoSQL
PPTX
Produce Cleaner Code with Aspect-Oriented Programming
PDF
Apache Solr lessons learned
PPTX
PDF
PHP High Availability High Performance
PDF
Carrillo carrillo cevallos_presentacionfinal (1)
PPTX
Spring aop concepts
DOCX
распутин григорий ефимович
KEY
Spring AOP
PDF
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
PPTX
Introduction to Aspect Oriented Programming
PPT
Aspect Oriented Software Development
PPT
Aspect Oriented Programming
PDF
Краса у сучасному світі
PDF
Arbitration and Choice of Law in Sub-Saharan Africa, Peter N. Levenberg, Flor...
DOCX
Mapa mental
Weaving aspects in PHP with the help of Go! AOP library
XREST Protocol
XQuery in the Cloud
Memorias ram2
JSONiq - The SQL of NoSQL
Produce Cleaner Code with Aspect-Oriented Programming
Apache Solr lessons learned
PHP High Availability High Performance
Carrillo carrillo cevallos_presentacionfinal (1)
Spring aop concepts
распутин григорий ефимович
Spring AOP
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
Introduction to Aspect Oriented Programming
Aspect Oriented Software Development
Aspect Oriented Programming
Краса у сучасному світі
Arbitration and Choice of Law in Sub-Saharan Africa, Peter N. Levenberg, Flor...
Mapa mental
Ad

Similar to Aspect-Oriented Programming for PHP (20)

PPT
phases of compiler PPT includes phases of compiler
PPT
Final Jspring2009 Mda Slimmer Ontwikkelen Van Java Ee Applicaties
PPT
Concepts In Object Oriented Programming Languages
PPT
Software development effort reduction with Co-op
ODP
Aspect-oriented programming in Perl
PPT
pythonOCC PDE2009 presentation
PDF
Multimodal Knowledge Assistance - Berkeley LLM AI Agents MOOC
PPTX
.NET 4 Demystified - Sandeep Joshi
PDF
Generic _Composite_ in Python_ PyWeb TLV Meetup 07.08.2024.pdf
PPTX
Overview of VS2010 and .NET 4.0
PDF
conceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdf
PPTX
Build 2019 Recap
ODP
Patterns in Python
 
ODP
My Summer of Code
PPTX
PPTX
Framework engineering JCO 2011
PPTX
Introduction to Full Stack Development Using Python
PPTX
ISI work
PDF
Econometrics for python, how to deal with data
PPTX
phases of compiler PPT includes phases of compiler
Final Jspring2009 Mda Slimmer Ontwikkelen Van Java Ee Applicaties
Concepts In Object Oriented Programming Languages
Software development effort reduction with Co-op
Aspect-oriented programming in Perl
pythonOCC PDE2009 presentation
Multimodal Knowledge Assistance - Berkeley LLM AI Agents MOOC
.NET 4 Demystified - Sandeep Joshi
Generic _Composite_ in Python_ PyWeb TLV Meetup 07.08.2024.pdf
Overview of VS2010 and .NET 4.0
conceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdf
Build 2019 Recap
Patterns in Python
 
My Summer of Code
Framework engineering JCO 2011
Introduction to Full Stack Development Using Python
ISI work
Econometrics for python, how to deal with data

More from William Candillon (6)

PDF
Scalable XQuery Processing with Zorba on top of MongoDB
PDF
XQuery Rocks
PDF
Cutting Edge Data Processing with PHP & XQuery
PDF
Not your Grandma's XQuery
PDF
XQuery Design Patterns
PDF
Extending and scripting PDT
Scalable XQuery Processing with Zorba on top of MongoDB
XQuery Rocks
Cutting Edge Data Processing with PHP & XQuery
Not your Grandma's XQuery
XQuery Design Patterns
Extending and scripting PDT

Recently uploaded (20)

DOCX
unit 1 COST ACCOUNTING AND COST SHEET
PDF
Laughter Yoga Basic Learning Workshop Manual
PDF
Unit 1 Cost Accounting - Cost sheet
PPTX
Dragon_Fruit_Cultivation_in Nepal ppt.pptx
PDF
Reconciliation AND MEMORANDUM RECONCILATION
PDF
Traveri Digital Marketing Seminar 2025 by Corey and Jessica Perlman
PDF
HOT DAY CAFE , Café Royale isn’t just another coffee shop
PDF
Dr. Enrique Segura Ense Group - A Self-Made Entrepreneur And Executive
PPT
Chapter four Project-Preparation material
PPTX
CkgxkgxydkydyldylydlydyldlyddolydyoyyU2.pptx
PDF
Business model innovation report 2022.pdf
PDF
A Brief Introduction About - Stacey Soans
PPTX
Buy Chaos Software – V-Ray, Enscape & Vantage Licenses in India
PDF
TriStar Gold Corporate Presentation August 2025
DOCX
Business Management - unit 1 and 2
PPTX
Mastering Odoo ERP Implementation: Key Strategies for Business Success
PPTX
Helicopters in the Brazilian Oil Industry – Executive Summary
PDF
Roadmap Map-digital Banking feature MB,IB,AB
PDF
MSPs in 10 Words - Created by US MSP Network
DOCX
unit 2 cost accounting- Tender and Quotation & Reconciliation Statement
unit 1 COST ACCOUNTING AND COST SHEET
Laughter Yoga Basic Learning Workshop Manual
Unit 1 Cost Accounting - Cost sheet
Dragon_Fruit_Cultivation_in Nepal ppt.pptx
Reconciliation AND MEMORANDUM RECONCILATION
Traveri Digital Marketing Seminar 2025 by Corey and Jessica Perlman
HOT DAY CAFE , Café Royale isn’t just another coffee shop
Dr. Enrique Segura Ense Group - A Self-Made Entrepreneur And Executive
Chapter four Project-Preparation material
CkgxkgxydkydyldylydlydyldlyddolydyoyyU2.pptx
Business model innovation report 2022.pdf
A Brief Introduction About - Stacey Soans
Buy Chaos Software – V-Ray, Enscape & Vantage Licenses in India
TriStar Gold Corporate Presentation August 2025
Business Management - unit 1 and 2
Mastering Odoo ERP Implementation: Key Strategies for Business Success
Helicopters in the Brazilian Oil Industry – Executive Summary
Roadmap Map-digital Banking feature MB,IB,AB
MSPs in 10 Words - Created by US MSP Network
unit 2 cost accounting- Tender and Quotation & Reconciliation Statement

Aspect-Oriented Programming for PHP

  • 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
  • 6. O bject- O riented P rogramming Advantages Business modeling Reusable technicals components Design patterns Frameworks Vertical organization Inheritance and interfaces Objects graph
  • 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
  • 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
  • 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