Content deleted Content added
m Streamlined text and corrected grammar |
m Undid revision 1305034158 by Bender the Bot (talk) bot error fixed |
||
(10 intermediate revisions by 10 users not shown) | |||
Line 103:
"Kinded" PCDs match a particular kind of join point (e.g., method execution) and often take a Java-like signature as input. One such pointcut looks like this:
<syntaxhighlight lang="aspectj">
</syntaxhighlight>
This pointcut matches a method-execution join point, if the method name starts with "<code>set</code>" and there is exactly one argument of any type.
"Dynamic" PCDs check runtime types and bind variables. For example,
<syntaxhighlight lang="aspectj">
</syntaxhighlight>
This pointcut matches when the currently executing object is an instance of class <code>Point</code>. Note that the unqualified name of a class can be used via Java's normal type lookup.
"Scope" PCDs limit the lexical scope of the join point. For example:
<syntaxhighlight lang="aspectj">
</syntaxhighlight>
This pointcut matches any join point in any type in the <code>com.company</code> package. The ''<code>*</code>'' is one form of the wildcards that can be used to match many things with one signature.
Pointcuts can be composed and named for reuse. For example:
<syntaxhighlight lang="aspectj">
</syntaxhighlight>
This pointcut matches a method-execution join point, if the method name starts with "<code>set</code>" and <code>this</code> is an instance of type <code>Point</code> in the <code>com.company</code> package. It can be referred to using the name "<code>set()</code>".
Line 128:
| Advice specifies to run at (before, after, or around) a join point (specified with a pointcut) certain code (specified like code in a method). The AOP runtime invokes Advice automatically when the pointcut matches the join point. For example:
<syntaxhighlight lang="aspectj">
</syntaxhighlight>
Line 228:
Many [[programming language]]s have implemented AOP, within the language, or as an external [[Library (computing)|library]], including:
*[[.NET]] framework languages ([[C Sharp (programming language)|C#]], [[Visual Basic (.NET)]] (VB.NET))<ref>Numerous:
[https://github.com/vc3/Afterthought Afterthought] {{webarchive|url=https://web.archive.org/web/20160315162029/https://github.com/vc3/Afterthought |date=2016-03-15}}, [http://www.rapier-loom.net/ LOOM.NET] {{webarchive|url=https://web.archive.org/web/20080827215106/http://www.rapier-loom.net/ |date=2008-08-27}}, [http://www.codeplex.com/entlib Enterprise Library 3.0 Policy Injection Application Block] {{webarchive|url=https://web.archive.org/web/20070119154829/http://www.codeplex.com/entlib |date=2007-01-19}}, [
**[https://www.postsharp.net/ PostSharp] is a commercial AOP implementation with a free but limited edition.
**[[Unity Application Block|Unity]] provides an API to facilitate proven practices in core areas of programming including data access, security, logging, exception handling and others.
Line 246:
*[[Groovy (programming language)|Groovy]]
*[[Haskell]]<ref>[[Monad (functional programming)|Monad]]s allow program semantics to be altered by changing the type of the program without altering its code: {{cite journal |citeseerx=10.1.1.25.8262 |title=Monads As a theoretical basis for AOP |journal=International Workshop on Aspect-Oriented Programming at ECOOP |first=Wolfgang |last=De Meuter |year=1997 |page=25}} {{cite book |chapter-url=http://dl.acm.org/citation.cfm?id=2451457 |first1=Nicolas |last1=Tabareau |first2=Ismael |last2=Figueroa |first3=Éric |last3=Tanter |title=Proceedings of the 12th annual international conference on Aspect-oriented software development |chapter=A typed monadic embedding of aspects |series=Aosd '13 |date=March 2013 |pages=171–184 |doi=10.1145/2451436.2451457 |isbn=9781450317665 |s2cid=27256161 |url=https://hal.inria.fr/hal-00763695/file/main.pdf}} [[Type class]]es allow additional capabilities to be added to a type: {{cite book |first1=Martin |last1=Sulzmann |first2=Meng |last2=Wang |title=Proceedings of the 6th workshop on Foundations of aspect-oriented languages |chapter=Aspect-oriented programming with type classes |chapter-url=http://portal.acm.org/citation.cfm?id=1233842 |date=March 2007 |pages=65–74 |doi=10.1145/1233833.1233842 |isbn=978-1595936615 |s2cid=3253858 |url=https://kar.kent.ac.uk/47468/1/local_143541.pdf}}.</ref>
*[[Java (programming language)|Java]]<ref>Numerous others: [http://www.caesarj.org/ CaesarJ] {{webarchive|url=https://web.archive.org/web/20081219181529/http://caesarj.org/ |date=2008-12-19}}, [
**[[AspectJ]]
*[[JavaScript]]<ref>Many: [http://i.gotfresh.info/2007/12/7/advised-methods-for-javascript-with-prototype/ Advisable] {{webarchive|url=https://web.archive.org/web/20080704052200/http://i.gotfresh.info/2007/12/7/advised-methods-for-javascript-with-prototype |date=2008-07-04}}, [https://code.google.com/p/ajaxpect/ Ajaxpect] {{webarchive|url=https://web.archive.org/web/20160709203939/https://code.google.com/p/ajaxpect/ |date=2016-07-09}}, [http://plugins.jquery.com/project/AOP jQuery AOP Plugin] {{webarchive|url=https://web.archive.org/web/20080113184156/http://plugins.jquery.com/project/AOP |date=2008-01-13}}, [http://aspectes.tigris.org/ Aspectes] {{webarchive|url=http://archive.wikiwix.com/cache/20060508035836/http://aspectes.tigris.org/ |date=2006-05-08}}, [http://www.aspectjs.com/ AspectJS] {{webarchive|url=https://web.archive.org/web/20081216010832/http://www.aspectjs.com/ |date=2008-12-16}}, [http://www.cerny-online.com/cerny.js/ Cerny.js] {{webarchive|url=https://web.archive.org/web/20070627024906/http://www.cerny-online.com/cerny.js/ |date=2007-06-27}}, [http://dojotoolkit.org/ Dojo Toolkit] {{webarchive|url=https://web.archive.org/web/20060221211958/http://www.dojotoolkit.org/ |date=2006-02-21}}, [
*[[Logtalk (programming language)|Logtalk]]<ref>Using built-in support for categories (which allows the encapsulation of aspect code) and event-driven programming (which allows the definition of ''before'' and after ''event'' handlers).</ref>
*[[Lua (programming language)|Lua]]<ref>{{cite web|url=http://luaforge.net/projects/aspectlua/|title=AspectLua|access-date=11 August 2015|url-status=live|archive-url=https://web.archive.org/web/20150717094121/http://luaforge.net/projects/aspectlua/|archive-date=17 July 2015}}</ref>
*[[make (software)|make]]<ref>{{cite web|url=http://www.bramadams.org/makao/|archive-url=https://archive.today/20120724151524/http://www.bramadams.org/makao/|url-status=dead|archive-date=24 July 2012|title=MAKAO, re(verse)-engineering build systems|access-date=11 August 2015}}</ref>
*[[Matlab]]<ref>{{cite web|url=http://www.sable.mcgill.ca/mclab/aspectmatlab/|title=McLab|access-date=11 August 2015|url-status=live|archive-url=https://web.archive.org/web/20150924093214/http://www.sable.mcgill.ca/mclab/aspectmatlab/|archive-date=24 September 2015}}</ref>
*[[ML (programming language)|ML]]<ref>{{cite web |title=AspectML – Aspect-oriented Functional Programming Language Research |url=http://www.cs.princeton.edu/sip/projects/aspectml/
*[[Nemerle]]<ref>{{cite web|url=https://github.com/rsdn/nemerle/blob/master/README.md|title=nemerle/README.md at master · rsdn/nemerle|website=[[GitHub]] |access-date=22 March 2018}}</ref>
*[[Perl]]<ref>{{cite web|url=https://metacpan.org/module/Aspect|title=Aspect – Aspect-Oriented Programming (AOP) for Perl – metacpan.org|author=Adam Kennedy|access-date=11 August 2015|url-status=live|archive-url=https://web.archive.org/web/20130831064935/https://metacpan.org/module/Aspect|archive-date=31 August 2013}}</ref>
*[[PHP]]<ref>Several: [http://aop.io PHP-AOP (AOP.io)] {{webarchive|url=http://archive.wikiwix.com/cache/20140818050736/http://aop.io/ |date=2014-08-18}}, [http://go.aopphp.com Go! AOP framework] {{webarchive|url=https://web.archive.org/web/20130301043014/http://go.aopphp.com/ |date=2013-03-01}}, [https://code.google.com/p/phpaspect/ PHPaspect] {{webarchive|url=https://web.archive.org/web/20160822234503/https://code.google.com/p/phpaspect/ |date=2016-08-22}}, [http://www.seasar.org/en/php5/ Seasar.PHP] {{webarchive|url=https://web.archive.org/web/20051226040309/http://www.seasar.org/en/php5/ |date=2005-12-26}}, [https://archive.today/20120712081326/http://php-aop.googlecode.com/ PHP-AOP], [https://flow.neos.io/ Flow] {{webarchive|url=https://web.archive.org/web/20180104132543/https://flow.neos.io/ |date=2018-01-04}}, [https://github.com/AOP-PHP/AOP AOP PECL Extension] {{webarchive|url=https://web.archive.org/web/20170411031809/https://github.com/AOP-PHP/AOP |date=2017-04-11}}</ref>
*[[Prolog]]<ref>{{cite web |date=14 December 2005 |title=Aspect-Oriented Programming in Prolog |url=http://www.bigzaphod.org/whirl/dma/docs/aspects/aspects-man.html
*[[Python (programming language)|Python]]<ref>Several: [http://peak.telecommunity.com/ PEAK] {{webarchive|url=https://web.archive.org/web/20050409082546/http://peak.telecommunity.com/ |date=2005-04-09}}, [https://web.archive.org/web/20110609153559/http://old.aspyct.org/ Aspyct AOP], [http://www.cs.tut.fi/~ask/aspects/aspects.html Lightweight Python AOP] {{webarchive|url=https://web.archive.org/web/20041009194711/http://www.cs.tut.fi/~ask/aspects/aspects.html |date=2004-10-09}}, [http://www.logilab.org/projects/aspects Logilab's aspect module] {{webarchive|url=https://web.archive.org/web/20050309034259/http://www.logilab.org/projects/aspects |date=2005-03-09}}, [
*[[Racket (programming language)|Racket]]<ref>{{cite web|url=http://planet.racket-lang.org/display.ss?package=aspectscheme.plt&owner=dutchyn|title=PLaneT Package Repository : PLaneT > dutchyn > aspectscheme.plt|access-date=11 August 2015|url-status=live|archive-url=https://web.archive.org/web/20150905062740/http://planet.racket-lang.org/display.ss?package=aspectscheme.plt&owner=dutchyn|archive-date=5 September 2015}}</ref>
*[[Ruby (programming language)|Ruby]]<ref>{{cite web|url=
*[[Squeak]] [[Smalltalk]]<ref>{{cite web|url=http://www.prakinf.tu-ilmenau.de/~hirsch/Projects/Squeak/AspectS/|title=AspectS|website=tu-ilmenau.de|access-date=5 May 2018|url-status=dead|archive-url=https://web.archive.org/web/20060106112030/http://www.prakinf.tu-ilmenau.de/~hirsch/Projects/Squeak/AspectS/|archive-date=6 January 2006}}</ref><ref>{{cite web|url=http://csl.ensm-douai.fr/MetaclassTalk|title=MetaclassTalk: Reflection and Meta-Programming in Smalltalk|access-date=11 August 2015|url-status=dead|archive-url=https://web.archive.org/web/20150729062351/http://csl.ensm-douai.fr/MetaclassTalk|archive-date=29 July 2015}}</ref>
*[[UML 2|UML 2.0]]<ref>{{cite web|url=http://www.iit.edu/~concur/weavr|title=WEAVR|website=iit.edu|access-date=5 May 2018|url-status=live|archive-url=https://web.archive.org/web/20081212200221/http://www.iit.edu/~concur/weavr/|archive-date=12 December 2008}}</ref>
Line 281:
==Further reading==
* {{Cite conference |doi=10.1007/BFb0053381 |title=Aspect-oriented programming |work=Proceedings of the 11th European Conference on Object-Oriented Programming |conference=[[European Conference on Object-Oriented Programming|ECOOP]]'97 |volume=1241 |pages=220–242 |series=[[Lecture Notes in Computer Science]] (LNCS) |year=1997 |last1=Kiczales |first1=G. |author1-link=Gregor Kiczales |last2=Lamping |first2=J. |last3=Mendhekar |first3=A. |last4=Maeda |first4=C. |last5=Lopes |first5=C. |last6=Loingtier |first6=J. M. |last7=Irwin |first7=J. |isbn=3-540-63089-9 |citeseerx=10.1.1.115.8660 |url=http://www.cs.ubc.ca/~gregor/papers/kiczales-ECOOP1997-AOP.pdf}} The paper generally considered to be the authoritative reference for AOP.
* {{cite book |author1=Robert E. Filman |author2=Tzilla Elrad |author3=Siobhán Clarke |author3-link=Siobhán Clarke|author4=Mehmet Aksit |year=2004 |title=Aspect-Oriented Software Development |publisher=Addison-Wesley |isbn=978-0-321-21976-3}}
* {{cite book |author1=Renaud Pawlak, Lionel Seinturier |author2=Jean-Philippe Retaillé |name-list-style=amp |year=2005 |title=Foundations of AOP for J2EE Development |publisher=Apress |isbn=978-1-59059-507-7}}
* {{cite book |first=Ramnivas |last=Laddad |author-link=Ramnivas Laddad |year=2003 |title=AspectJ in Action: Practical Aspect-Oriented Programming |publisher=Manning |isbn=978-1-930110-93-9 |url-access=registration |url=https://archive.org/details/aspectjinactionp00ladd}}
* {{cite book |first=Ivar |last=Jacobson |author-link=Ivar Jacobson |author2=Pan-Wei Ng |year=2005 |title=Aspect-Oriented Software Development with Use Cases |publisher=Addison-Wesley |isbn=978-0-321-26888-4 |author2-link=Pan-Wei Ng}}
* [http://www.cmsdevelopment.com/en/articles/aosdinphp/ Aspect-oriented Software Development and PHP, Dmitry Sheiko, 2006]
* {{cite book |author1=Siobhán Clarke|author1-link=Siobhán Clarke |author2=Elisa Baniassad |name-list-style=amp |year=2005 |title=Aspect-Oriented Analysis and Design: The Theme Approach |publisher=Addison-Wesley |isbn=978-0-321-24674-5}}
* {{cite book |author=Raghu Yedduladoddi |date=2009 |title=Aspect Oriented Software Development: An Approach to Composing UML Design Models |publisher=VDM |isbn=978-3-639-12084-4}}
* "Adaptive Object-Oriented Programming Using Graph-Based Customization" – Lieberherr, Silva-Lepe, ''et al.'' – 1994
* {{cite journal|last=Zambrano Polo y La Borda|first=Arturo Federico|title=Addressing aspect interactions in an industrial setting: experiences, problems and solutions|date=5 June 2013|pages=159|doi=10.35537/10915/35861|url=http://sedici.unlp.edu.ar/handle/10915/35861|access-date=30 May 2014|doi-access=free}}
|