aspect-oriented software development

26
Eric Kenseth

Upload: latham

Post on 07-Jan-2016

54 views

Category:

Documents


0 download

DESCRIPTION

Aspect-Oriented Software Development. Eric Kenseth. Contents. History Terminology Aspect Oriented Programming Analysis Design Patterns Testing Maintenance Conclusion. History. Early 90s, U of Twente, Netherlands Subject-Oriented 1993, IBM Researched similar subjects - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Aspect-Oriented Software Development

Eric Kenseth

Page 2: Aspect-Oriented Software Development

HistoryTerminologyAspect Oriented ProgrammingAnalysisDesignPatternsTestingMaintenanceConclusion

Page 3: Aspect-Oriented Software Development

Early 90s, U of Twente, NetherlandsSubject-Oriented

1993, IBM Researched similar subjectsFeature-Oriented

1997-2000, Xerox PARC develops AspectJTrue birth of Aspect-Oriented

Page 4: Aspect-Oriented Software Development

ConcernAnything any stakeholder wants the system to

do.Anything, any stakeholder

Cross-cutting ConcernFar-reaching concernApplies to many subsections of the systemThe reason for Aspect Oriented to exist

Separation of ConcernsRemoval of sections in a module that deals with

other concerns

Page 5: Aspect-Oriented Software Development

JoinpointLocation where aspects can take over

executionDepends on language as to where is supported

Method CallsMethod ReturnsException ThrowsReading/Writing to a field

Page 6: Aspect-Oriented Software Development

• Advice– The code of a cross-cutting concern– Needs to be executed in many places

• Pointcut– Points in the program where the advice needs

to be executed• Joinpoints

• Inter-Type declaration• Declared member of another class in an aspect• Visible only to classed declared to have access

Page 7: Aspect-Oriented Software Development

• Aspect– A class-like structure to encapsulate cross-cut

concerns– Can be static or dynamic– Can have fields and methods as members– Can be abstract or not– Can be instantiated – Can have pointcuts, advice, and inter-type

declairations– May be ‘privileged’ to access private members of

other types

Page 8: Aspect-Oriented Software Development

Pointcut defines where to execute the AdviceAdvice may modify program flowAdvice may access values in the context of the

cutAspects encapsulate a cross-cut concernWhy?

ModularizationTanglingScattering

How?

Page 9: Aspect-Oriented Software Development

• What are the concerns?• Which of these are core concerns?• Which are cross-cutting concerns?

– Logging– Caching– Security concerns– Error detection– Error correction– Memory management– Real-time issues– Synchronization– Mutual exclusion– Complex rule monitoring

Page 10: Aspect-Oriented Software Development

Aspect use casesGeneralized in situationDetailed in stepsNot useful for the client, only the designers

Other use cases include the aspect cases a lot

Page 11: Aspect-Oriented Software Development

Not well supported by UMLFor now no formally accepted answerSeveral extensions proposedSome suggest separating base code from

aspects in design

Page 12: Aspect-Oriented Software Development
Page 13: Aspect-Oriented Software Development

Very useful when designing with aspectsDemonstrates when aspects are invokedCan help spot where pointcuts need to be set

Page 14: Aspect-Oriented Software Development

Spectator Pattern‘Harmless advice’Doesn’t modify the other concerns, just

watches itLoggers, Tracers, Profilers

Regulator PatternEnforces requirements on the system stateMay control the flow if errors occurSecurity Authorization, System Constraints

Page 15: Aspect-Oriented Software Development

Patch PatternEnhances or Modifies features being ReusedAspects act as methods for a class

Add new methods to classes you don’t have access to rewrite

Modify methodsAllows updating the reused asset without re-

modificationMust be careful about breaking assertions

Page 16: Aspect-Oriented Software Development

Extension PatternMaking an extendable system is problematicAspect solution: Create extension points

Empty method calls where the system will be extended

Extension aspects use these points to add to the system

Independent evolution of base code vs. extensions

Page 17: Aspect-Oriented Software Development

LanguageSpecialty language needed.

Compiler/Interpreter needs to support aspectsMost languages only have minor changes to them

Page 18: Aspect-Oriented Software Development

AspectJDozens of other Java-basedC/C++/C# based languagesMany other languages have Aspect-supporting

versions of themEven Cobol

Page 19: Aspect-Oriented Software Development

Development aspects can help test and debug base codeLoggingTracingProfilingPerformance Monitoring

These aspects have several advantagesEasier to add/remove to the system as aspects

Page 20: Aspect-Oriented Software Development

Aspects require different testing meansLack independent identityMay be coupled to context

New ways for aspects to cause faultsIncorrect pointcut pattersIncorrect aspect orderingIncorrect context checking in pointcuts

Systematic testing means are lacking

Page 21: Aspect-Oriented Software Development

Add new features without disturbing code.Separation makes modifying cross-cut

concerns much easierUntangling makes modifying primary

concerns saferUnlikely to break other concerns while

modifying.Modifying Joinpoints may be dangerous still.

Page 22: Aspect-Oriented Software Development

Code is modularNo tangling with cross-cut concerns in

componentsNo scattering of cross-cut concerns in other

concernsMany aspects are features useful in almost all

systemsLoggingTracingProfiling

Page 23: Aspect-Oriented Software Development

New and emergingStill needs refining in ways

DesigningTesting

Shows promise in certain situationsBig, Complex, with multiple user-rolesPatching and Extending

Page 24: Aspect-Oriented Software Development

[1] O. Aldawud, T. Elrad, and A. Bader. (2003) UML profile for aspect-oriented software development. In Proceedings of the AOM workshop at AOSD, 2003

[2] Hachani, O., Bardou, D. (2002) Using Aspect-Oriented Programming for Design Patterns Implementation. In: OOIS 2002 Workshop on Reuse in Object-Oriented Information Systems Design

[3] Blair, G., Blair, L., Rashid, A., Moreira, A., Araujo, J., Chitchyan, R. (2005). Engineering Aspect-Oriented Systems. In Fillman, Elrad, Clark, Aksit (Eds.), Aspect-Oriented Software Development (pp.380-398). Boston: Addison-Wesley.

Page 25: Aspect-Oriented Software Development

[4] James Noble, Arno Schmidmier, David J Pearce, Andrew P Black (2007) Patterns of Aspect-Oriented Design. In Proceedings of European Conference on Pattern Languages of Programs. Irsee

[5] Filman, R. & Friedman, D. (2005). Aspect-Oriented Programming Is Quantification and Obliviousness. In Fillman, Elrad, Clark, Aksit (Eds.), Aspect-Oriented Software Development (pp.1-7). Boston: Addison-Wesley.

[6] R. T. Alexander, J. M. Bieman, and A. A. Andrews. (2004) Towards the systematic testing of aspect-oriented programs. Technical Report CS-4-105, Department of Computer Science, Colorado State University, Fort Collins, Colorado.

[7] AspectJ. (n.d.). Retrieved October 31, 2009 from Eclipse website, www.eclipse.org/aspectJ

Page 26: Aspect-Oriented Software Development

Questions?