introduction terms design – modeling requirements languages maintenance comparison to object...

34
Aspect Oriented Software Development James Friedenberger Department of Software Engineering University of Wisconsin – Platteville [email protected]

Upload: warren-mcgee

Post on 25-Dec-2015

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

Aspect Oriented Software Development

 James Friedenberger

Department of Software EngineeringUniversity of Wisconsin – Platteville

[email protected]

Page 2: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

2

Contents

Introduction Terms Design – Modeling Requirements Languages Maintenance Comparison to Object Oriented Applications

Page 3: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

3

Introduction

Software Development History› Started out with emphasis on the machine code

(basic machines)› Problems discovered in 70s and 80s led to

emphasis on quality, productivity› 1980s and 1990s saw the rise of UML

Page 4: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

4

Introduction

Object Oriented Development› Benchmark of most projects today› Started in 1960s, rose to prominence in late 80s

and 90s› Supported by many languages, most common

C++ and Java› Easy to be modeled by UML language› Has several problems

Page 5: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

5

Introduction

“AOP can be understood as the desire to make quantified statements about the behavior of programs, and to have these quantifications hold over programs written by oblivious programmers.” – Filman and Friedman

Page 6: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

6

Introduction

Aspect Oriented Software Development› Developed due to problems with OO› First theory proposed in 1995› Implementation in early 2000s, Netherlands,

Texas› Entire new vocabulary› Key structural differences› Still relatively new, gaining acceptance in a few

areas

Page 7: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

7

Terms

Concerns› Key new concept› Similar but more refined than objects

Aspects› Implementation of concern› Usually contains only code for a specific feature

Page 8: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

8

Terms Crosscutting Concerns

› Code called in several places throughout a program› Feature that is hard to modularize in OO

Areas of Crosscutting Concerns: Synchronization Real-time constraints Error detection and correction Product features Memory management Information security Caching Logging Monitoring Code mobility Internationalization and localization Domain-specific optimizations

Page 9: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

9

Terms

Join Points› Where aspects are called in the execution of a

program› Placement dependent on language

Advice› Tells system what to do at a an aspect› Oblivious of base code› after() : set() { Display.update(); }

Page 10: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

10

Terms

Pointcut designator› Collection of join points› Can be used for features called often at specific

places (security) Weaving

› Inserting the aspects into the base code› Can happen at three stages of software

Page 11: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

11

Design – Modeling

Unified Modeling Language (UML)› Due to acceptance, often used› Implementations capture aspect methods, join

points› Separates base code from features

Page 12: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

12

Separation of Base / Aspect

Page 13: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

13

Design - Modeling

UML (Cont’d) Aspects can also be grouped by function

› Synchronization› Distribution› Coordination› Replication

Page 14: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

14

Class Diagram of Aspect

Page 15: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

15

Design - Modeling

Architectural Description Language› Still in development› Able to show connections between base code

and aspects› Also shows separation of base code and

functional code› Good for upper level requirements

Page 16: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

16

Other Diagrams

Sequence diagrams › Can demonstrate when aspects are called› Can help developers determine where to put join

points

Page 17: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

17

Requirements Gathering and Analysis

Best in beginning of software development Good at separating features and base code Good for determining join points Helps with concern determination

Page 18: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

18

Languages

.NET Framework languages (C# / VB.NET)

C / C++ Cobol Cocoa ColdFusion Common Lisp Delphi Delphi Prism e (IEEE 1647) Haskell Java

› AspectJ

JavaScript Emacs Lisp Lua make ML Perl PHP Prolog Python Ruby Squeak Smalltalk UML 2.0 XML

Page 19: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

19

Language

Languages have to be adapted› Some languages are supplementary› Some have built in aspect support› Determine join points› Determine weaving time› Some languages are Object Oriented language

compatible, some not

Page 20: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

20

Language – AspectJ

Most Common Architecture of Java allows easy transition Reclassifies Java’s critical section features

Page 21: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

21

Example

public void doGet(JspImplicitObjects theObjects) throws ServletException{logger.entry("doGet(...)");JspTestController controller = new JspTestController(); controller.handleRequest(theObjects); logger.exit("doGet");}

public aspect AutoLog{

pointcut publicMethods() : execution(public * org.apache.cactus..*(..));

pointcut logObjectCalls() :

execution(* Logger.*(..));

pointcut loggableCalls() : publicMethods() && ! logObjectCalls();

before() : loggableCalls(){

Logger.entry(thisJoinPoint.getSignature().toString());

}

after() : loggableCalls(){

Logger.exit(thisJoinPoint.getSignature().toString());

}

}

Page 22: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

22

Maintenance

New features can be added without disturbing original code

Java programs can easily use aspects Separation of concerns make maintenance

easier Helps prevent tangling of code Easier to debug, all code in one place

Page 23: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

23

Maintenance

Still has some problems› Could cause problems in large projects, join

points getting changed› Small changes, function call placement can

cause problems› Different structure can cause problems for

programmers

Page 24: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

24

Comparison to OO

Aspect Oriented Development is a derivative of Object Oriented Development

Object Orientation focuses on Modularity Aspect Orientation focuses on Concerns Object Orientation tangles code, Aspect

Orientation separates Singletons not supported in AOP

Page 25: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

25

Comparison to Object Oriented – Study

Findings : › Easier to find where to put new code› Easier to implement new code› Similar compile times› Harder to make changes› Lack of understanding hurts› Processes not clear to fix problems

Page 26: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

26

Applications

Open Source Uses› Can allow mixing of proprietary and open source

programming› Easy to add new features to base code› Can determine what features are actually

needed

Page 27: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

27

Applications

Can implement several different features Allows many different products from one set

of base code Can roll out product sooner, worry about

features later

Page 28: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

Extraction/Composition Cycle

Page 29: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

29

Applications

Can turn existing software into AOP Easier to test, especially features Several different areas of features can be

separated from main program Makes software more portable

Page 30: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

30

Current Uses

SAP Siemens Health Sun Microsystems IBM Motorola Glassbox (Diagnostic Tool)

Page 31: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

31

Conclusion

New emerging technology Not complete solution to Object Oriented

Software Development, but improves in a few areas

Has some exciting features Currently in use, more widespread as it is

refined

Page 32: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

32

Resources [1] 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.

[2] Clemente, P., Hernandez, J., Herrero, J., Murillo, J., Sanchez, F. (2005). Aspect-Orientation in the Software Lifecycle: Fact and Fiction. In Fillman, Elrad, Clark, Aksit (Eds.), Aspect-Oriented Software Development (pp.409-420). Boston: Addison-Wesley.

[3] Pinto, M., Fuentes, L., Troya, J. (2003) A Dynamic Component and Aspect-Oriented Platform. The Computer Journal, 48, pp. 401-420.

[4] Spring Maintenance. (n.d.). Retrieved November 1, 2009 from Maintenance website. https://src.springframework.org/svn/spring-maintenance/

[5] 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 33: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

33

Resources 2 [6] AspectJ. (n.d.). Retrieved October 31, 2009 from Eclipse website,

www.eclipse.org/aspectJ.  [7] Colyer, A. (2005). AspectJ. In Fillman, Elrad, Clark, Aksit (Eds.),

Aspect-Oriented Software Development (pp.123-143). Boston: Addison-Wesley.

[8] Apel, S., Leich, T., Saake, G. (2008). Aspectual Feature Models. IEEE Transactions of Software Engineering, 34, p. 173. 

[9] Walker, R., Baniassad, E., Murphy, G. (2005). An Initial Assessment of Aspect-Oriented Programming. In Fillman, Elrad, Clark, Aksit (Eds.), Aspect-Oriented Software Development (pp.335-345). Boston: Addison-Wesley.

[10] Harrison, W., Ossher, H., Sutton, S., Tarr, P. (2005). Supporting aspect-oriented software development with the Concern Manipulation Environment. IBM Systems Journal, 44, (pp. 309-313).

[11] Aspect-Oriented Software Development(n.d.). Retrieved November 4, 2009 from Wikipedia website, http://en.wikipedia.org/wiki/Aspect-oriented_software_development.

Page 34: Introduction  Terms  Design – Modeling  Requirements  Languages  Maintenance  Comparison to Object Oriented  Applications 2

34

Thank You

Questions