Professional Documents
Culture Documents
Visvesvaraya Technological University: S.D.M College of Engineering and Technology
Visvesvaraya Technological University: S.D.M College of Engineering and Technology
A seminar report on
S#$mitte $%
CERTIFICATE
Certified that the seminar work entitled Aspect Oriented Programming is a bonafide work presented by Jeevan Dongre bearing U ! !O " D#$C %%% in a partial f&lfillment for the award of degree of 'achelor of (ngineering in Comp&ter cience (ngineering of the )isvesvaraya *echnological University+ 'elga&m d&ring the year "##,-%#. *he seminar report
has been approved as it satisfies the academic re/&irements with respect to seminar work presented for the 'achelor of (ngineering Degree.
Sta++ in c,ar"e
H.O.D CSE
INDE1 N O 1 2 ! 4 ' ( ) 8 * 10 11 12 Introduction Histor Introducing concerns" cross#cutting concerns" Aspects $ AO Imp%ications o& cross#cutting concerns AOP Deve%opment Stages Anatom o& AOP %anguages AOP %anguage Imp%ementation Current% used AOP too%s +,amp%e Code o& AspectJ AOP -ene&its .Conc%usion /e&erences !a" e 0 0 0 2 3 4 ( ( *' *' ** **
*. Intro #ction
As g%o-a% digita%i0ation and the si0e o& app%ications e,pand at an e,ponentia% rate" so&t1are engineering comp%e,ities are a%so gro1ing. One &eature o& this comp%e,it is the repetition o& &unctiona%it such as securit " memor management" resource sharing" and error and &ai%ure hand%ing throughout an app%ication. 2o address this issue" so&t1are researchers are deve%oping methodo%ogies -ased on a ne1 programming e%ement3 the aspect. Aspect Oriented Programming is a mindset3 a ne1 programming methodo%og invo%ving the aspects.
&. Histor%
AOP as such has a num-er o& antecedents3 the 4isitor Design Pattern" C5OS 6OP" and others . AspectJ 8perhaps the most popu%ar genera%#purpose AOP pac9age: 1as created - ;regor <ic0a%es and co%%eagues at =ero, PA/C and made avai%a-%e in 2001. I>6?s research team emphasi0ed the continuit o& the practice o& modu%ari0ing concerns 1ith past programming practice" and o&&ered the more po1er&u% 8-ut %ess usa-%e: H per@J and Concern 6anipu%ation +nvironment" 1hich have not seen 1ide usage.
7
Ae can vie1 a comp%e, so&t1are s stem as a com-ined imp%ementation o& mu%tip%e concerns. A t pica% s stem ma consist o& severa% 9inds o& concerns" inc%uding -usiness %ogic" per&ormance" data persistence" %ogging and de-ugging" authentication" securit " mu%tithread sa&et " error chec9ing" and so on. 2here are a%so deve%opment#process concerns" such as comprehensi-i%it " maintaina-i%it " tracea-i%it " and evo%ution ease. .
;raphica% i%%ustration o& a s stem as a set o& concerns imp%emented - various modu%es
Cross)c#ttin" concerns In this" the methods used &or di&&erent concerns intersect. Hence crosscutting concerns span over mu%tip%e imp%ementation modu%es. A%though crosscutting concerns span over man modu%es" current imp%ementtation techniBues tend to imp%ement these reB uirements concentrating main% imp%ementation on the coree modu%e# %eve%
Aspect)oriente pro"rammin" 8AO!9 Is a ne1 techno%og &or separation o& crosscutting concerns into sing%e units ca%%ed aspects . 2he name Aspect Oriented Program ming 1as coined - Chris 6aeder o& =ero, Pa%eo A%to research Centre. Aspect Oriented Programming r evo%ves around the three &unctions Identi& concerns that cutt across c%ass @ o-Cect -oundaries Arite code 8an aspect: that encapsu%ates that concern De&ine a 1eave that speci&&ies ho1 the aspect 1i%% -e 1eaved into e,isting code
Aspects An aspect is a modu%ar unit o& crosscutting imp%ementation. It encapsu%ates -ehaviors that a&&ect mu%tip%e c%asses into reusa-%e modu%es. An aspect is a piece o& code that descri-es a recurring propert o& a program. App%ications can" have mu%tip%e aspects. Aspects provide crosscutting modu%arit . In other 1ords" programmers can use aspects to create so&t1are modu%es &or issues that cut across various parts o& an app%ication. Aspect modu%es do not stand on their o1nD the &unction on% as add#on code that deve%opers can 1eave into app%ications.
!oor tracea$i:it%Simu%taneous% imp%ementing severa% concerns o-scures the correspondence -et1een a concern and its imp%ementation" resu%ting in a poor mapping -et1een the t1o. Lo;er pro #cti/it%Simu%taneous imp%ementation o& mu%tip%e concerns shi&ts the deve%oper?s &ocus &rom the main concern to the periphera% concerns" %eading to %o1er productivit . Less co e re#seSince" under these circumstances" a modu%e imp%ements mu%tip%e concerns" other s stems reBuiring simi%ar &unctiona%it ma not -e a-%e to readi% use the modu%e" &urther %o1ering productivit . !oor co e <#a:it%Code tang%ing produces code 1ith hidden pro-%ems. 6oreover" - targeting too man concerns at once" one or more o& those concerns 1i%% not receive enough attention. More i++ic#:t e/o:#tionA %imited vie1 and constrained resources o&ten produce a design that addresses on% current concerns. Addressing &uture reBuirements o&ten reBuires re1or9ing the imp%ementation. Since the imp%ementation is not modu%ari0ed" that means touching man modu%es" modi& ing each su-s stem &or such changes can %ead to inconsistencies. It a%so reBuires considera-%e testing e&&ort to ensure that such imp%ementation changes have not caused -ugs 2hese are the imp%ications o& cross cutting concerns. 2he s mptoms o& cross concerns %i9e code scattering and code tang%ing negative% a&&ects the code e&&icienc " and sca%a-i%it .
=. AO! e/e:opmenta: sta"esAOP imp%ements individua% concerns in a %oose% coup%ed &ashion" and com-ine these imp%ementations to &orm the &ina% s stem. Indeed" AOP creates s stems using %oose% coup%ed" modu%ari0ed imp%ementations o& crosscutting concerns. AOP invo%ves three distinct deve%opment steps3 Aspect#a: ecomposition- Decompose the reBuirements to identi& crosscutting and common concerns. Separate modu%e#%eve% concerns &rom crosscutting s stem# %eve% concerns. Concern imp:ementation- Imp%ement each concern separate% .
7
Aspect#a: recomposition- In this step" an aspect integrator speci&ies recom position ru%es creating modu%ari0ation units ## aspects. 2he recomposition process" a%so 9no1 n as 1eaving or integrating, uses this in&ormation to compose the &ina% s stem.
speci& ing procedures" it can -e used 1ith traditiona% %anguages %i9e C" CFF" or Java 1ith AOP. >ea/in" r#:es speci+ication- 2his speci&ies ho1 to compose independent% imp%emented
concerns to &orm the &ina% s ste m. Eor this purpose" an imp%ementation needs to use or create a %anguage &or speci& ing ru%es &o r composing di&&erent imp%ementation pieces to &orm the &ina% s stem. 2he %anguage &or speci& ing 1eaving ru%es can -e an e,tension o& th e imp%ementation %anguage.
8
2his code segment sho1s one 1a in 1hich aspect#oriented programming %ets deve%opers 1rite an aspect" a recurring so&t1are issue" once and have it appear 1herever needed. 2he segment ins tructs a%% pu-%ic methods o& the com.,ero,.printers so&t1are to %og their errors. 2he &ourth %ine indicates that the aspect app%ies to ca%%s to an methods. pu-%ic method in the com.,ero,.printers pac9age. It instructs the AOP compi%er to 1eave the aspect into a%% pu-%ic
*'.AO! $ene+its
AOP he%ps overcome the a&orementioned pro-%ems caused - code tang%ing and code scattering. 2hese are the speci&ic -ene&its AOP o&&er3 Mo #:ariAe imp:ementation o+ crossc#ttin" concernsAOP addresses each concern separate% 1ith minima% coup%ing" resu%ting in modu%ari0ed imp%ementations even in the presence o& crosscutting concerns. Such an imp%ementation produces a s stem 1ith %ess dup%icated code. Since each concern?s imp%ementation is separate" it a%so he%ps reduce code c%utter. Eurther" modu%ari0ed imp%ementation a%so resu%ts in a s stem that is easier to understand and maintain. Easier)to)e/o:/e s%stemsSince the aspected modu%es can -e una1are o& crosscutting concerns" it?s eas to add ne1er &unctiona%it - creating ne1 aspects. Eurther" 1hen ne1 modu%es are added to a s stem" the e,isting aspects crosscut them" he%ping create a coherent evo%ution. Late $in in" o+ esi"n ecisionsAith AOP" an architect can de%a ma9ing design decisions &or &uture reBuirements" since it can -e imp%emented as separate aspects.
1,
more co e re#se>ecause AOP imp%ements each aspect as a separate modu%e" each individua% modu%e is more %oose% coup%ed. In genera%" a %oose% coup%ed imp%ementation" 1hich can -e o-tained - using AOP" represents the 9e to higher code reuse.
**.Conc:#sion
AOP introduces a ne1 st %e o& decomposition and is a promising 1a o& separating crosscutting concerns that are usua%% hard to do in o-Cect#oriented programming. AOP is particu%ar% use&u% in separating concerns that are uni#directiona% and have 1e%%#de&ined e&&ect" such as de-ugging and tracing concerns. Ho1ever" the current AOP techno%og is sti%% in research stage. Current% " three AOP research areas are important3 +ase o& use. 2echniBues on ho1 to understand a s stem in term o& aspects shou%d -e 1e%% documented. ;uide%ines and design princip%es" such as G65 &or AOP" AOP design patterns" must a%so -e esta-%ished. 2he he%p reduce the cost &or so&t1are engineers to
adapt to this ne1 paradigm.
Studies and e,periment that prove the use&u%ness o& AOP - measura-%e -ene&its. 2his encourages the computer industr giants and in&%uentia% committees to endorse the
techno%og .
Deve%opment too%s &or discovering aspects" restructuring e,isting codes" recutting" etc. AOP techno%og 1i%% on% -e adapted - the so&t1are industr .
2hose three &actors are signi&icant to determine 1hether i& the so&t1are industr 1i%%
*&.Re+erences
111.parc.,ero,.com@cs%@proCects@aop@ 111.ccs.edu@home@%ie-er@connection#to#aop.htm% 111.aspectC.org@ 111.aosd.net@ 111.research.i-m.com@h perspace@H perJ@H perJ.htm 111.in&ormati9.uni#siegen.de@Imira
)ttp#--en&wi.ipe/ia&org-wi.i-0spect1oriente/1progra%%i ng
1 1