Aspect-oriented programming: Difference between revisions

Content deleted Content added
m date format audit, refine ref details
Line 1:
{{short description|Programming paradigm}}
{{Programming paradigms}}
{{Use dmy dates|date=JulyJune 20132023}}
 
In [[computing]], '''aspect-oriented programming''' ('''AOP''') is a [[programming paradigm]] that aims to increase [[Modularity (programming)|modularity]] by allowing the [[separation of concerns|separation of]] [[cross-cutting concern]]s. It does so by adding behavior to existing code (an [[Advice (programming)|advice]]) ''without'' modifying the code itself, instead separately specifying which code is modified via a "[[pointcut]]" specification, such as "log all function calls when the function's name begins with 'set{{'"}}. This allows behaviors that are not central to the [[business logic]] (such as logging) to be added to a program without cluttering the code core to the functionality.
Line 86:
</syntaxhighlight>
 
One can think of AOP as a debugging tool or as a user-level tool. Advice should be reserved for the cases where you cannot get the function changed (user level)<ref>{{cite web|url=https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html|title=gnu.org|websitepublisher=www.gnu.orgGNU Project|access-date=5 May 2018|url-status=live|archive-url=https://web.archive.org/web/20171224053656/http://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html|archive-date=24 December 2017}}</ref> or do not want to change the function in production code (debugging).
 
==Join point models==
Line 239:
*[[ColdFusion]]<ref>{{cite web|url=http://coldspringframework.org/|title=ColdSpring Framework: Welcome|date=5 November 2005|access-date=5 May 2018|url-status=bot: unknown|archive-url=https://web.archive.org/web/20051105014513/http://coldspringframework.org/|archive-date=5 November 2005}}</ref>
*[[Common Lisp]]<ref>{{cite web|url=http://common-lisp.net/project/closer/aspectl.html|title=Closer Project: AspectL.|access-date=11 August 2015|url-status=live|archive-url=http://archive.wikiwix.com/cache/20110223172923/http://common-lisp.net/project/closer/aspectl.html|archive-date=23 February 2011}}</ref>
*[[Delphi (programming language)|Delphi]]<ref>{{cite web|url=https://code.google.com/p/infra/|title=infra - Frameworks Integrados para Delphi - Google Project Hosting|access-date=11 August 2015|url-status=live|archive-url=https://web.archive.org/web/20150909070130/http://code.google.com/p/infra/|archive-date=9 September 2015}}</ref><ref>{{cite web|url=https://code.google.com/p/meaop/|title=meaop - MeSDK: MeObjects, MeRTTI, MeAOP - Delphi AOP(Aspect Oriented Programming), MeRemote, MeService... - Google Project Hosting|access-date=11 August 2015|url-status=live|archive-url=https://web.archive.org/web/20150910210536/http://code.google.com/p/meaop/|archive-date=10 September 2015}}</ref><ref>{{cite web|url=https://code.google.com/p/delphisorcery/|title=Google Project Hosting|access-date=11 August 2015|url-status=live|archive-url=https://web.archive.org/web/20141225080131/https://code.google.com/p/delphisorcery/|archive-date=25 December 2014}}</ref>
*[[Delphi Prism]]<ref>{{cite web|url=http://prismwiki.codegear.com/en/Cirrus|title=RemObjects Cirrus|website=codegear.com|access-date=5 May 2018|url-status=dead|archive-url=https://web.archive.org/web/20120123094027/http://prismwiki.codegear.com/en/Cirrus|archive-date=23 January 2012}}</ref>
*[[E (verification language)|e]] (IEEE 1647)
*[[Emacs Lisp]]<ref>{{cite web|url=https://www.gnu.org/software/emacs/elisp/html_node/Advising-Functions.html|title=Emacs Advice Functions|websitepublisher=gnu.orgGNU Project|access-date=5 May 2018|url-status=live|archive-url=https://web.archive.org/web/20111024211408/http://www.gnu.org/software/emacs/elisp/html_node/Advising-Functions.html|archive-date=24 October 2011}}</ref>
*[[Groovy (programming language)|Groovy]]
*[[Haskell (programming language)|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 journal | url = http://dl.acm.org/citation.cfm?id=2451457 | title = A Typed Monadic Embedding of Aspects | first1 = Nicolas | last1 = Tabareau | first2 = Ismael | last2 = Figueroa | first3 = Éric | last3 = Tanter | journal = Proceedings of the 12th Annual International Conference on Aspect-oriented Software Development | series = Aosd '13 | date = March 2013 | pages = 171–184 | doi = 10.1145/2451436.2451457 | isbn = 9781450317665 | s2cid = 27256161 }} [[Type class]]es allow additional capabilities to be added to a type: {{cite journal | first1 = Martin | last1 = Sulzmann | first2 = Meng | last2 = Wang | url = http://portal.acm.org/citation.cfm?id=1233842 | title = Aspect-oriented programming with type classes | journal = Proceedings of the 6th Workshop on Foundations of Aspect-oriented Languages | date = March 2007 | pages = 65–74 | doi = 10.1145/1233833.1233842 | isbn = 978-1595936615 | s2cid = 3253858 }}.</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 }}, [http://composestar.sourceforge.net/ Compose*] {{webarchive|url=http://archive.wikiwix.com/cache/20050821193804/http://composestar.sourceforge.net/ |date=2005-08-21 }}, [http://dynaop.dev.java.net/ Dynaop] {{webarchive|url=https://web.archive.org/web/20070724061030/https://dynaop.dev.java.net/ |date=2007-07-24 }}, [http://jac.objectweb.org/ JAC] {{webarchive|url=https://web.archive.org/web/20040619135517/http://jac.objectweb.org/ |date=2004-06-19 }}, [[Google Guice]] (as part of its functionality), [http://www.csg.is.titech.ac.jp/~chiba/javassist/ Javassist] {{webarchive|url=https://web.archive.org/web/20040901095342/http://www.csg.is.titech.ac.jp/~chiba/javassist/ |date=2004-09-01 }}, [http://ssel.vub.ac.be/jasco/ JAsCo (and AWED)] {{webarchive|url=https://web.archive.org/web/20050411010213/http://ssel.vub.ac.be/jasco/ |date=2005-04-11 }}, [http://www.ics.uci.edu/~trungcn/jaml/ JAML] {{webarchive|url=https://web.archive.org/web/20050415091244/http://www.ics.uci.edu/~trungcn/jaml/ |date=2005-04-15 }}, [http://labs.jboss.com/portal/jbossaop JBoss AOP] {{webarchive|url=https://web.archive.org/web/20061017211354/http://labs.jboss.com/portal/jbossaop/ |date=2006-10-17 }}, [http://roots.iai.uni-bonn.de/research/logicaj LogicAJ] {{webarchive|url=https://web.archive.org/web/20060504154852/http://roots.iai.uni-bonn.de/research/logicaj/ |date=2006-05-04 }}, [http://www.objectteams.org/ Object Teams] {{webarchive|url=https://web.archive.org/web/20050831200910/http://objectteams.org/ |date=2005-08-31 }}, [http://prose.ethz.ch/ PROSE] {{webarchive|url=https://web.archive.org/web/20070124094344/http://prose.ethz.ch/ |date=2007-01-24 }}, [http://www.aspectbench.org/ The AspectBench Compiler for AspectJ (abc)] {{webarchive|url=https://web.archive.org/web/20141216200424/http://aspectbench.org/ |date=2014-12-16 }}, [[Spring framework]] (as part of its functionality), [[Seasar]], [http://roots.iai.uni-bonn.de/research/jmangler/ The JMangler Project] {{webarchive|url=https://web.archive.org/web/20051028191025/http://roots.iai.uni-bonn.de/research/jmangler/ |date=2005-10-28 }}, [http://injectj.sourceforge.net/ InjectJ] {{webarchive|url=https://web.archive.org/web/20050405080539/http://injectj.sourceforge.net/ |date=2005-04-05 }}, [http://www.csg.is.titech.ac.jp/projects/gluonj/ GluonJ] {{webarchive|url=https://web.archive.org/web/20070206010219/http://www.csg.is.titech.ac.jp/projects/gluonj/ |date=2007-02-06 }}, [http://www.st.informatik.tu-darmstadt.de/static/pages/projects/AORTA/Steamloom.jsp Steamloom] {{webarchive|url=https://web.archive.org/web/20070818100432/http://www.st.informatik.tu-darmstadt.de/static/pages/projects/AORTA/Steamloom.jsp |date=2007-08-18 }}</ref>
**[[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 }}, [http://humax.sourceforge.net/ Humax Web Framework] {{webarchive|url=https://web.archive.org/web/20081209103012/http://humax.sourceforge.net/ |date=2008-12-09 }}, [https://code.google.com/p/joose-js/ Joose] {{webarchive|url=https://web.archive.org/web/20150318193601/http://code.google.com/p/joose-js/ |date=2015-03-18 }}, [[Prototype.js|Prototype]] - [http://www.prototypejs.org/api/function/wrap Prototype Function#wrap] {{webarchive|url=https://web.archive.org/web/20090505233620/http://www.prototypejs.org/api/function/wrap |date=2009-05-05 }}, [http://developer.yahoo.com/yui/3/api/Do.html YUI 3 (Y.Do)] {{webarchive|url=https://web.archive.org/web/20110125115930/https://developer.yahoo.com/yui/3/api/Do.html |date=2011-01-25 }}</ref>
*[[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/2012.07.24-151524/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/index.html|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/index.html|archive-date=24 September 2015}}</ref>
*[[ML (programming language)|ML]]<ref>{{cite web|url=http://www.cs.princeton.edu/sip/projects/aspectml/|title=AspectML - Aspect-oriented Functional Programming Language Research|access-date=11 August 2015|url-status=live|archive-url=https://web.archive.org/web/20101205005108/http://www.cs.princeton.edu/sip/projects/aspectml/|archive-date=5 December 2010}}</ref>
*[[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/index.html Seasar.PHP] {{webarchive|url=https://web.archive.org/web/20051226040309/http://www.seasar.org/en/php5/index.html |date=2005-12-26 }}, [https://archive.today/2012.07.12-081326/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|url=http://www.bigzaphod.org/whirl/dma/docs/aspects/aspects-man.html|title=bigzaphod.org is coming soon|website=www.bigzaphod.org|access-date=5 May 2018|url-status=live|archive-url=https://web.archive.org/web/20160420181837/http://www.bigzaphod.org/whirl/dma/docs/aspects/aspects-man.html|archive-date=20 April 2016}}</ref>
*[[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 }}, [http://pythius.sourceforge.net/ Pythius] {{webarchive|url=https://web.archive.org/web/20050408072457/http://pythius.sourceforge.net/ |date=2005-04-08 }}, [http://springpython.webfactional.com/1.1.x/reference/html/aop.html Spring Python's AOP module] {{webarchive|url=https://web.archive.org/web/20160304055741/http://springpython.webfactional.com/1.1.x/reference/html/aop.html |date=2016-03-04 }}, [http://pytilities.sourceforge.net/doc/1.1.0/guide/aop/ Pytilities' AOP module] {{webarchive|url=https://web.archive.org/web/20110825101213/http://pytilities.sourceforge.net/doc/1.1.0/guide/aop/ |date=2011-08-25 }}, [http://python-aspectlib.readthedocs.org/en/latest/ aspectlib] {{webarchive|url=https://web.archive.org/web/20141105061010/http://python-aspectlib.readthedocs.org/en/latest/ |date=2014-11-05 }}</ref>
*[[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=http://aspectr-fork.sourceforge.net/|title=AspectR - Simple aspect-oriented programming in Ruby|access-date=11 August 2015|url-status=live|archive-url=http://archive.wikiwix.com/cache/20150812003432/http://aspectr-fork.sourceforge.net/|archive-date=12 August 2015}}</ref><ref>{{cite web|url=http://aquarium.rubyforge.org/|archive-url=https://web.archive.org/web/20071026055811/http://aquarium.rubyforge.org/|url-status=dead|archive-date=26 October 2007|title=Home|author=Dean Wampler|access-date=11 August 2015}}</ref><ref>{{cite web|url=https://github.com/gcao/aspector|title=gcao/aspector|work=GitHub|access-date=11 August 2015|url-status=live|archive-url=https://web.archive.org/web/20150104180534/https://github.com/gcao/aspector|archive-date=4 January 2015}}</ref>
*[[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>
*[[XML]]<ref>{{cite web|url=https://code.google.com/p/aspectxml/|title=aspectxml - An Aspect-Oriented XML Weaving Engine (AXLE) - Google Project Hosting|access-date=11 August 2015|url-status=live|archive-url=https://web.archive.org/web/20150912161613/http://code.google.com/p/aspectxml/|archive-date=12 September 2015}}</ref>
 
==See also==
Line 287:
* {{cite book |author1=Siobhán Clarke |author2=Elisa Baniassad |name-list-style=amp| year = 2005 | title = Aspect-Oriented Analysis and Design: The Theme Approach | 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 | 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}}
* Wijesuriya, Viraj Brian (2016-08-30) ''[http://www.slideshare.net/tyrantbrian/aspect-oriented-development Aspect Oriented Development, Lecture Notes, University of Colombo School of Computing, Sri Lanka]''
Line 298:
* [https://web.archive.org/web/20141216200424/http://aspectbench.org/ The AspectBench Compiler for AspectJ], another Java implementation
* [http://www.ibm.com/developerworks/views/java/libraryview.jsp?search_by=AOP@work: Series of IBM developerWorks articles on AOP]
* {{cite web |last1=Laddad |first1=Ramnivas |date=2002-01-18 |df=mdy |url=https://www.infoworld.com/article/2073918/i-want-my-aop---part-1.html |title=I want my AOP!, Part 1 |work=[[JavaWorld]] |access-date=2020-07-20}} A detailed series of articles on basics of aspect-oriented programming and AspectJ
* [https://web.archive.org/web/20090821185951/http://codefez.com/what-is-aspect-oriented-programming/ What is Aspect-Oriented Programming?], introduction with RemObjects Taco
* [http://www.cis.uab.edu/gray/Research/C-SAW/ Constraint-Specification Aspect Weaver]
Line 309:
* [http://java2novice.com/spring/aop-and-aspectj-introduction/ Spring AOP and AspectJ Introduction]
* [http://www.cs.bilkent.edu.tr/~bedir/CS586-AOSD AOSD Graduate Course at Bilkent University]
* [http://www.se-radio.net/podcast/2008-08/episode-106-introduction-aop Introduction to AOP - Software Engineering Radio Podcast Episode 106]
* [https://web.archive.org/web/20120801133941/http://innoli.com/en/Innoli-EN/OpenSource.html An Objective-C implementation of AOP by Szilveszter Molnar]
* [https://github.com/forensix/MGAOP Aspect-Oriented programming for iOS and OS X by Manuel Gebele]