Presentation is loading. Please wait.

Presentation is loading. Please wait.

Aspect Oriented Programming An Introduction based on se-radio.net episode 106 29th October 2009 Aspect Oriented Programming - Nils Schmidt.

Similar presentations


Presentation on theme: "Aspect Oriented Programming An Introduction based on se-radio.net episode 106 29th October 2009 Aspect Oriented Programming - Nils Schmidt."— Presentation transcript:

1 Aspect Oriented Programming An Introduction based on se-radio.net episode 106 29th October 2009 Aspect Oriented Programming - Nils Schmidt

2 Agenda Separation of concerns and the need for AOP AOP by example Join point models & weaving se.radio.net Episode 106 Questions & answers session 29th October 20091Aspect Oriented Programming - Nils Schmidt

3 Separation of concerns “Separation of concerns is a fundamental principal of software design and implementation” [1] –it helps structuring code according to requirements –it improves maintainability of software –It has been a driving factor for new paradigms, patterns etc. Ideal Situation: Each element of source code serves exactly one concern 29th October 2009Aspect Oriented Programming - Nils Schmidt2

4 Separation of concerns – Some approaches 29th October 2009Aspect Oriented Programming - Nils Schmidt3 Object Orientation Subroutines Procedural Programming Service Orientation Web Services Structured Programming Data Structures Model View Controller Functional Programming Internet Protocol Suite Separation of rooms using corridors Modular Programming Component Servers Aspect Oriented Programming

5 Crosscutting concerns - The need for AOP Software is usually modularized according to its core concerns (its main functionality) 29th October 2009Aspect Oriented Programming - Nils Schmidt4 Mathematics Software System Prime Number Creation Sort Algorithms Matrix Chain Multipl. …

6 Crosscutting concerns - The need for AOP Software is usually modularized according to its core concerns (its main functionality) 29th October 2009Aspect Oriented Programming - Nils Schmidt4 Mathematics Software System Prime Number Creation Sort Algorithms Matrix Chain Multipl. … Core concerns

7 Crosscutting concerns - The need for AOP “Any structural realization of a system will find that some concerns […] cross multiple elements. AOP is focused on mechanisms for simplifying the realization of such crosscutting concerns.” [2] 29th October 2009Aspect Oriented Programming - Nils Schmidt5 Mathematics Software System Prime Number Creation Sort Algorithms Matrix Chain Multipl. … Core concerns

8 Crosscutting concerns - The need for AOP “Any structural realization of a system will find that some concerns […] cross multiple elements. AOP is focused on mechanisms for simplifying the realization of such crosscutting concerns.” [2] 29th October 2009Aspect Oriented Programming - Nils Schmidt5 Mathematics Software System Prime Number Creation Sort Algorithms Matrix Chain Multipl. … Core concerns Caching Security Profiling

9 Crosscutting concerns - The need for AOP “Any structural realization of a system will find that some concerns […] cross multiple elements. AOP is focused on mechanisms for simplifying the realization of such crosscutting concerns.” [2] 29th October 2009Aspect Oriented Programming - Nils Schmidt5 Mathematics Software System Prime Number Creation Sort Algorithms Matrix Chain Multipl. … Core concerns Caching Security Profiling Crosscutting concerns

10 AOP by Example Matrix Chain Multiplication Solver –Calculates minimal number of elementary multiplications needed for multiplying a sequence of matrices –Use dynamic programming (caching) –Use time consumption analysis (profiling) 29th October 2009Aspect Oriented Programming - Nils Schmidt6

11 29th October 2009Aspect Oriented Programming - Nils Schmidt7

12 29th October 2009Aspect Oriented Programming - Nils Schmidt7 Core concern (MCMS) Caching concern Profiling concern Core concern (MCMS) Caching concern Profiling concern Base code is tangled by crosscutting concerns Hard to maintain!

13 29th October 2009Aspect Oriented Programming - Nils Schmidt8 Only the core concern is left in the class No further concerns are present anymore Only the core concern is left in the class No further concerns are present anymore Easier to maintain! But where did the crosscutting concerns go?

14 29th October 2009Aspect Oriented Programming - Nils Schmidt9 Crosscutting concerns are moved into so called aspects

15 29th October 2009Aspect Oriented Programming - Nils Schmidt9 Crosscutting concerns are moved into so called aspects An aspect is a basic concept (similar to a class); it is composed of pointcuts and advices. Crosscutting concerns are moved into so called aspects An aspect is a basic concept (similar to a class); it is composed of pointcuts and advices.

16 29th October 2009Aspect Oriented Programming - Nils Schmidt9 Crosscutting concerns are moved into so called aspects An aspect is a basic concept (similar to a class); it is composed of pointcuts and advices. A pointcut defines when in the execution model the aspect needs to be applied. Crosscutting concerns are moved into so called aspects An aspect is a basic concept (similar to a class); it is composed of pointcuts and advices. A pointcut defines when in the execution model the aspect needs to be applied.

17 29th October 2009Aspect Oriented Programming - Nils Schmidt9 Crosscutting concerns are moved into so called aspects An aspect is a basic concept (similar to a class); it is composed of pointcuts and advices. A pointcut defines when in the execution model the aspect needs to be applied. An advice defines what needs to be applied to the execution model. Crosscutting concerns are moved into so called aspects An aspect is a basic concept (similar to a class); it is composed of pointcuts and advices. A pointcut defines when in the execution model the aspect needs to be applied. An advice defines what needs to be applied to the execution model.

18 Join Point Models A join point is a specific point in the execution model of a program A pointcut is a query that selects a subset of all join points in the execution model A join point model defines which join points could be selected by a pointcut (e.g. method calls, variables …) The more powerful the join point model is, the more one can do with that AO language 29th October 2009Aspect Oriented Programming - Nils Schmidt10

19 Weaving Weaving is the process of reconnecting the separated concerns (core elements + aspects) Weaving might be done at compile-time, load-time or run- time of a system 29th October 2009Aspect Oriented Programming - Nils Schmidt11 Aspects Core Elements

20 se-radio.net Episode 106 - Speakers 29th October 2009Aspect Oriented Programming - Nils Schmidt12 Markus Völter Founder and Editor of se-radio.netFounder and Editor of se-radio.net Independent ConsultantIndependent Consultant Author of several books and articlesAuthor of several books and articles Christia Schwanninger Siemens AGSiemens AG Researcher in the field of AOResearcher in the field of AO Iris Grohr Siemens AGSiemens AG PhD student at University of LinzPhD student at University of Linz Researcher in the field of AOResearcher in the field of AO

21 Motivation and basic terms Crosscutting concerns, aspects, advices, join points, pointcutsCrosscutting concerns, aspects, advices, join points, pointcuts Join Point Model Differences of JPMsDifferences of JPMs Examples of the AspectJ JPMExamples of the AspectJ JPM Aspect weaving Static, dynamic and load-time weavingStatic, dynamic and load-time weaving se-radio.net Episode 106 - Content (shortened) 29th October 2009Aspect Oriented Programming - Nils Schmidt13 Practical experience (Patching existing systems)(Patching existing systems) Product familiesProduct families AO mindset AO analysisAO analysis AO thinkingAO thinking Outlook AO in researchAO in research AO in businessesAO in businesses

22 Motivation and basic terms Crosscutting concerns, aspects, advices, join points, pointcutsCrosscutting concerns, aspects, advices, join points, pointcuts Join Point Model Differences of JPMsDifferences of JPMs Examples of the AspectJ JPMExamples of the AspectJ JPM Aspect weaving Static, dynamic and load-time weavingStatic, dynamic and load-time weaving se-radio.net Episode 106 - Content (shortened) 29th October 2009Aspect Oriented Programming - Nils Schmidt13 Practical experience (Patching existing systems)(Patching existing systems) Product familiesProduct families AO mindset AO analysisAO analysis AO thinkingAO thinking Outlook AO in researchAO in research AO in businessesAO in businesses

23 Motivation and basic terms Crosscutting concerns, aspects, advices, join points, pointcutsCrosscutting concerns, aspects, advices, join points, pointcuts Join Point Model Differences of JPMsDifferences of JPMs Examples of the AspectJ JPMExamples of the AspectJ JPM Aspect weaving Static, dynamic and load-time weavingStatic, dynamic and load-time weaving se-radio.net Episode 106 - Content (shortened) 29th October 2009Aspect Oriented Programming - Nils Schmidt13 Practical experience (Patching existing systems)(Patching existing systems) Product familiesProduct families AO mindset AO analysisAO analysis AO thinkingAO thinking Outlook AO in researchAO in research AO in businessesAO in businesses

24 Motivation and basic terms Crosscutting concerns, aspects, advices, join points, pointcutsCrosscutting concerns, aspects, advices, join points, pointcuts Join Point Model Differences of JPMsDifferences of JPMs Examples of the AspectJ JPMExamples of the AspectJ JPM Aspect weaving Static, dynamic and load-time weavingStatic, dynamic and load-time weaving se-radio.net Episode 106 - Content (shortened) 29th October 2009Aspect Oriented Programming - Nils Schmidt13 Practical experience (Patching existing systems)(Patching existing systems) Product familiesProduct families AO mindset AO analysisAO analysis AO thinkingAO thinking Outlook AO in researchAO in research AO in businessesAO in businesses

25 Motivation and basic terms Crosscutting concerns, aspects, advices, join points, pointcutsCrosscutting concerns, aspects, advices, join points, pointcuts Join Point Model Differences of JPMsDifferences of JPMs Examples of the AspectJ JPMExamples of the AspectJ JPM Aspect weaving Static, dynamic and load-time weavingStatic, dynamic and load-time weaving se-radio.net Episode 106 - Content (shortened) 29th October 2009Aspect Oriented Programming - Nils Schmidt13 Practical experience (Patching existing systems)(Patching existing systems) Product familiesProduct families AO mindset AO analysisAO analysis AO thinkingAO thinking Outlook AO in researchAO in research AO in businessesAO in businesses

26 Motivation and basic terms Crosscutting concerns, aspects, advices, join points, pointcutsCrosscutting concerns, aspects, advices, join points, pointcuts Join Point Model Differences of JPMsDifferences of JPMs Examples of the AspectJ JPMExamples of the AspectJ JPM Aspect weaving Static, dynamic and load-time weavingStatic, dynamic and load-time weaving se-radio.net Episode 106 - Content (shortened) 29th October 2009Aspect Oriented Programming - Nils Schmidt13 Practical experience (Patching existing systems)(Patching existing systems) Product familiesProduct families AO mindset AO analysisAO analysis AO thinkingAO thinking Outlook AO in researchAO in research AO in businessesAO in businesses

27 Motivation and basic terms Crosscutting concerns, aspects, advices, join points, pointcutsCrosscutting concerns, aspects, advices, join points, pointcuts Join Point Model Differences of JPMsDifferences of JPMs Examples of the AspectJ JPMExamples of the AspectJ JPM Aspect weaving Static, dynamic and load-time weavingStatic, dynamic and load-time weaving se-radio.net Episode 106 - Content (shortened) 29th October 2009Aspect Oriented Programming - Nils Schmidt13 Practical experience (Patching existing systems)(Patching existing systems) Product familiesProduct families AO mindset AO analysisAO analysis AO thinkingAO thinking Outlook AO in researchAO in research AO in businessesAO in businesses

28 Cut-Outs Parts that have been cut out of the original se-radio.net episode 106: Characteristics of concerns –Business vs. software concerns –Technical vs. functional concerns Characteristics of aspects –Asymmetric vs. symmetric aspects –Heterogeneous vs. homogenous aspects –Developmental vs. productive aspects –Aspect ordering Sophisticated pointcut models Some Real World Examples Tools for AOP Research Languages 29th October 2009Aspect Oriented Programming - Nils Schmidt14

29 Summary Separation of concerns is an essential concept to improve maintainability AOP provides a well defined model to deal with crosscutting concerns AOP increases overall maintainability Aspects, Advices, pointcuts and joint points are the backbone of AOP The more powerful your joint point model is, the more you can do with it Weaving might be applied at different times and levels You need to think AO before you can program AO AOP is still a research topic, but yet a business relevant topic as well 29th October 2009Aspect Oriented Programming - Nils Schmidt15

30 Questions & Answers 29th October 2009Aspect Oriented Programming - Nils Schmidt16

31 Literature & Further Material Gregor Kiczales. Aspect Oriented Programming: Radical Research in Modularity. May 2006,Web Video. http://video.google.com/videoplay?docid=8566923311315412414#http://video.google.com/videoplay?docid=8566923311315412414# Tzilla Elrad and Robert E. Filman and Atef Bader. „Aspect-oriented programming“ ACM Computing Surveys 44.10 (Oct. 2001): 29-32. Print. G. Kiczales and J. Lamping and A. Mendhekar and C. Maeda and C. Lopes and J. Loingtier and. Irwin. „Aspect-Oriented Programming“ Proceedings of the European Conference on Object-Oriented Programming (1997): 220-242. Print. Ian Sommerville. Software Engineering. Addison Wesley, 8th edition, Jun. 2006. Print. „Aspect-oriented programming“ Wikipedia, the free encyclopedia. Web. http://en.wikipedia.org/wiki/Aspect-oriented_programming/ http://en.wikipedia.org/wiki/Aspect-oriented_programming/ Aspect-Oriented Software Development Community & Conference. Web. http://www.aosd.net/ http://www.aosd.net/ Ramnivas Laddad. AspectJ in Action. Manning Publications, 2nd edition, Sep. 2009. Print. Siobhán Clarke and Elisa Baniassad. Aspect-Oriented Analysis and Design: The Theme Approach. Addison-Wesley Professional, Apr. 2005. Print. Vladimir O. Safonov. Using Aspect-Oriented Programming for Trustworthy Software Development. Wiley-Interscience, May 2008. Print. 29th October 2009Aspect Oriented Programming - Nils Schmidt17

32 Bibliography [1]Ian Sommerville. Software Engineering. Addison Wesley, 8th edition, Jun. 2006. Print. [2]Tzilla Elrad and Robert E. Filman and Atef Bader. „Aspect-oriented programming“ ACM Computing Surveys 44.10 (Oct. 2001): 29-32. Print. 29th October 2009Aspect Oriented Programming - Nils Schmidt18


Download ppt "Aspect Oriented Programming An Introduction based on se-radio.net episode 106 29th October 2009 Aspect Oriented Programming - Nils Schmidt."

Similar presentations


Ads by Google