• No results found

Aspect-Oriented Software Development

N/A
N/A
Protected

Academic year: 2021

Share "Aspect-Oriented Software Development"

Copied!
39
0
0

Loading.... (view fulltext now)

Full text

(1)

Aspect-Oriented Software

Development

Dr. Awais Rashid

Computing Department

Lancaster University, UK

© Awais Rashid, 2005.
(2)

Fundamental to Next

Generation Software

“AOSD is vital to our [IBM Software Group’s]

survival”.

Daniel Sabbah, IBM Vice President, speaking at

AOSD Conference, Lancaster University, 2004.

AOSD among top ten most promising technologies.

MIT Technology Review

• Being employed in

projects at IBM, Siemens, Boeing,

BEA, Oracle and NASA.

DARPA

PCES Programme investing approx.

15 million

USD/year

Support of 4.4m Euros to AOSD-Europe by the EC

Will be at the Plateau of Productivity in 5-10 years

(3)

Outline

• Motivation

• Aspect-Oriented Software

Development

• State-of-the-art in languages, methods

and tools

• Case studies

• Open issues

(4)

Need to Tackle Complexity

• Software systems are becoming

increasingly complex

• Estimated 15 million software

professionals worldwide

• Estimated 8000 lines of code per

developer per year

36 billion lines of code per year

worldwide

• Do the above figures add up?

(5)

Complexity Affects Quality

• Intrinsic vs extrinsic complexity

• Affects quality attributes of software

systems

• Evolvability

• Cost-efficiency

• Composability

• Reliability

• Fault tolerance

• Reusability

• Scalability

• Dependability

• Adaptability

• Etc.

(6)

Need for Separation of

Concerns

Development requires focusing on one concern

at a time

(7)

Outline

• Motivation

• Aspect-Oriented Software

Development

• State-of-the-art in languages, methods

and tools

• Case studies

• Open issues

(8)

Aspect-Oriented Software

Development (AOSD)

Distribution Security Data Management

AOSD tools, techniques and methodology Distribution Security Data Management

(9)

Potential Benefits of AOSD

• Improved ability to reason about problem

domain and corresponding solution

• Reduction in application code size,

development costs and maintenance time

• Improved code reuse

• Requirements, architecture and design-level

reuse

• Improved ability to engineer product lines

• Context-sensitive application adaptation

• Improved modelling methods

(10)

History and Evolution of

AOSD

Evolution

Time

In the Making Initial

BreakthroughExcitement Stabilisation TowardsMaturity

Composition Filters, Adaptive Prog., SOP, Reflection AspectJ @ PARC Hyper/J, UML Ext. AspectJ @ Eclipse, AOSD Conf.

More expressive Langs., Early Aspects,

Middleware, Databases, Industrial Applications, Transactions on AOSD

“AOSD is vital to our [IBM Software Group’s] survival”.

Daniel Sabbah, IBM Vice President, speaking at

AOSD Conference, Lancaster University, 2004.

(11)

Crosscutting: The Logging

Concern in a Bank Application

class Account { // some attributes

void deposit(int amount) { Logger.log(“Entering Account.deposit( )”); // method code Logger.log(“Leaving Account.deposit( )”); } String holderName( ) { Logger.log(“Entering Account.holderName( )”); // method code Logger.log(“Leaving Account.holderName( )”); // return a string } class Loan { // some attributes void sendReminder( ) { Logger.log(“Entering Loan.sendReminder( )”); // method code Logger.log(“Leaving Loan.sendReminder( )”); } int getBalance( ) { Logger.log(“Entering Loan.getBalance( )”); // method code Logger.log(“Leaving Loan.getBalance( )”); // return an integer }

(12)

Tangling and Scattering

Account Loan Customer

Data Classes

ATM Web PC Terminal

User Interface

Persistence

(13)

Revisiting the Logging Example

class Account { // some attributes

void deposit(int amount) { Logger.log(“Entering Account.deposit( )”); // method code Logger.log(“Leaving Account.deposit( )”); } String holderName( ) { Logger.log(“Entering Account.holderName( )”); // method code Logger.log(“Leaving Account.holderName( )”); // return a string } class Loan { // some attributes void sendReminder( ) { Logger.log(“Entering Loan.sendReminder( )”); // method code Logger.log(“Leaving Loan.sendReminder( )”); } int getBalance( ) { Logger.log(“Entering Loan.getBalance( )”); // method code Logger.log(“Leaving Loan.getBalance( )”); // return an integer }

(14)

Wouldn’t it be Nice if …

class Account {

// some attributes

void deposit(int amount) { // method code } String holderName( ) { // method code // return a string } class Loan { // some attributes void sendReminder( ) { // method code } int getBalance( ) { // method code // return an integer } aspect Logger {

when someone calls these methods

before the call {Logger.log(“Entering ” + methodSignature);} after the call {Logger.log(“Leaving ” + methodSignature);} }

(15)

Revisiting the Persistence and

Security Example

Account Loan Customer

Data Classes

ATM Web PC Terminal

User Interface

Persistence

(16)

Wouldn’t it be Nice if …

Account Loan Customer

Data Classes

ATM Web PC Terminal

User Interface

aspect Persistence

aspect Security

(17)

Aspect-Oriented

Programming (AOP)

Class A

Class B

Classes

Aspects

Aspect X Aspect Y

Aspect

Weaver

Composed

Code

Legend

Join Points: Reference points in classes used by aspects for specifying relationships with classes

(18)

The Notion of a Join Point

class Account {

// some attributes

void deposit(int amount) { // method code } String holderName( ) { // method code // return a string } class Loan { // some attributes void sendReminder( ) { // method code } int getBalance( ) { // method code // return an integer } aspect Tracing {

when someone calls these methods

before the call {Logger.log(“Entering ” + methodSignature);} after the call {Logger.log(“Leaving ” + methodSignature);} }

Type

of

Join Point

Points in this

Specific Join

Program that

we are

(19)

Programmer Productivity

(without AOP)

• Typically one class or component per

file

• For a typical release of a software

system, logging or tracing effort

– 15 minutes per file

• 100 files will require 25 person hours

• 1000 files will require 7 person weeks

Source: Adrian Colyer, Gregor Kiczales, Adoption of AOSD, AOSD Conference 2005

(20)

Programmer Productivity (with

AOP)

• Typical effort to write a tracing or

logging aspect

– Less than 25 person hours for a simple

one

– Less than 50 person hours for a more

elaborate, properly tested aspect

– Write once, reuse again and again

– Very cost-effective

Source: Adrian Colyer, Gregor Kiczales, Adoption of AOSD, AOSD Conference 2005

(21)

Outline

• Motivation

• Aspect-Oriented Software

Development

• State-of-the-art in languages, methods

and tools

• Case studies

• Open issues

(22)

Aspect-Oriented Programming

Languages and Frameworks

• AspectJ and AJDT (Eclipse) – IBM

• AspectWerkz and WebLogic – BEA

• JBoss AOP – JBoss Group

• Spring AOP – Spring project

• AspectS – DoCoMo Labs

• CaesarJ – Technical Univ. of Darmstadt

• AspectC – Univ. of British Columbia

• AspectC++ – Univ. of Erlangen-Nuremberg

• A number of other AOP languages, frameworks and

tools listed at: http://aosd.net

(23)

Aspect-Oriented Requirements

Analysis and Design

• 15 million software professionals

worldwide

• Only 30% are coders

1

• A significant effort goes into:

– Requirements engineering

– Modelling

– Architecture and design

– Testing and evolution

(24)

Better Understanding of the

Problem Domain

• Early Aspects: Aspect-oriented

requirements engineering

– Better understanding of the influence of

crosscutting properties on the problem

– Identify trade-offs early on

– Support decision making amongst stakeholders

– Early aspects drive architectural choices

• A number of UML extensions are already

available for subsequent modelling and

design

(25)

Preserving Architectural

Constraints

• Use aspects to declare warnings or

errors on unwanted development

practices

• Example: IBM Software Group

– Aspects are used to flag warnings when

one product uses APIs from another

– Used in a portfolio of 30 products

– 50000 such places flagged!

– Facilitates packaging and deployment

Source: Adrian Colyer, Gregor Kiczales, Adoption of AOSD, AOSD Conference 2005

(26)

Outline

• Motivation

• Aspect-Oriented Software

Development

• State-of-the-art in languages, methods

and tools

• Case studies

• Open issues

(27)

Enterprise Software: IBM

WebSphere

• Multiple crosscutting concerns

(without

AOSD)

Please refer to Dr. Daniel Sabbah’s keynote at AOSD conference at Lancaster in 2004:

(28)

Enterprise Software: IBM

WebSphere

• First Failure Data Capture

(without AOSD)

Please refer to Dr. Daniel Sabbah’s keynote at AOSD conference at Lancaster in 2004:

(29)

Enterprise Software: IBM

WebSphere

• First Failure Data Capture

(with AOSD)

Please refer to Dr. Daniel Sabbah’s keynote at AOSD conference at Lancaster in 2004:

(30)

Database Evolution: Lancaster

Study

A: Attributes deleted from non-leaf class

B: Introduction of non-leaf class

C: Attributes deleted from leaf class D: Class repositioned 0 5 10 15 20 25 A B C D System X SADES 0 2 4 6 8 10 A B C System X SADES System Y A: Customising routines resulting from additive change

B: Customising routines resulting from

subtractive change

C: Changes to entities upon customisation of instance adaptation approach

(31)

Database Aspects in Oracle

TopLink

• Aspects used for exception raising

whenever a developer attempts to write to

the database in a read-only profile

• Aspects used to mark objects as

dirty

for

database updates in a read-mostly profile

• Aspects at the vendor end only

• TopLink developers do not need to know

AOSD

(32)

Design Pattern Implementations

• Design patterns are solution templates

for recurring problems during software

development

• Already help to modularise design and

code by guidelines for good structure

• AOSD can further improve the

implementation of several design

patterns

(33)

Concern Diffusion over

Components

0 2 4 6 8 10 12

Component Decorator Mediator Colleague Handler Memento Originator

N u m b e r of C o m pone nt s Number of Components AO OO AO OO Decorator Pattern Mediator Pattern CoR Pattern Memento Pattern +67% +80% +50% 0% 0% +57% +40% -20% +29% +25% -33%

Before After Before After Before After Before After Before After Before After Before After

+67%

0% +67%

system viewpoint

CDC

(34)

Separation of Concerns

0 5 10 15 20 25 30 35

Component Decorator Mediator Colleague Handler Memento Originator

N u m b er of Tr a n s itio n Poin ts Num b er of Transition Points AO OO AO OO Mediator Pattern Memento Pattern +78% +25% +85% +22% 0% 0%

Before After Before After Before After Before After Before After Before After Before After +67% 0% +92% CoR Pattern +88% Decorator Pattern +50%+50% 0% +75% 50 CDLO C

(35)

Scalability: Introducing New

Elements

0 2 4 6 8 10 12

Component Decorator Mediator Colleague Handler Memento Originator

Nu m b e r o f C o m p o n e n ts Number o f Co m p onen ts AO OO AO OO Decorator Pattern Mediator Pattern CoR Pattern Memento Pattern +67% +80% +50% 0% 0% +57% +40% -20% +29% +25% -33%

Before After Before After Before After Before After Before After Before After Before After

+67% 0% +67% 0 5 10 15 20

Component Decorator Mediator Colleague Handler Memento Origin

N u m b er o f O p er at io n s Number o f O p er atio ns AO O AO O Decorator Pattern Mediator Pattern Memento Pattern +75% +88% +71% 0% 0% +67% -46% -+6% +60% -40%

Before After Before After Before After Before After Before After Before After Before +67% -14% -29% CoR Pattern 0 5 10 15 20 25 30 35

Component Decorator Mediator Colleagu

N u m b er of Tra n si ti o n P o in ts Number o f Tra n sition Points Mediator Pattern +78% +25%

Before After Before After Before After Before Af +67%

+88% Decorator Pattern

+50%+50% 0%

+75

(36)

Other Interesting Projects

• Boeing: Autopilot software product lines

• Siemens: Software product lines and

model-driven development

• New Aspects of Software: Modularising

security policies

• Near Infinity: Auditing in Intelliprints

• TU Darmstadt and TU Berlin: ToppRax

project (evaluation in SMEs)

• Lancaster University: Infolab21 Knowledge

Business Centre (Planned seminars for

(37)

Outline

• Motivation

• Aspect-Oriented Software

Development

• State-of-the-art in languages, methods

and tools

• Case studies

• Open issues

(38)

Open Issues for AOSD

• Need for more research into models for

early aspects: aspect-oriented requirements

engineering and architecture design

• Need for more research into aspect

mapping and traceability

• Need for effective testing and validation

techniques

• Need for more application studies

(39)

Open Issues for AOSD

• Need for AOSD processes

– Adaptation of existing processes to

incorporate AOSD

• Need for more empirical studies

• Need for an

Aspect-Oriented Software

Engineering

References

Related documents

The only effective method of long term storage is to treat the public key (or the certificate containing the public key) as a record and store them in the Record Keeping System..

Based on the critical role of Wnt/ β -catenin signaling pathway and versican expression in the development of hair follicle growth, we investigated whether β -catenin and

On the other hand, compilation of a balanced training dataset has a strong impact on developing a more accurate classifier than the one reported by Poria et al.. 1) Results

Concur Technologies Software Design Engineer Intern UX Design Intern Marketing Intern QA Engineer Intern MBA Intern Finance Intern Accounting Intern Mobile Intern Data Science

Bethany Durand is a prosecutor with the Baltimore City State’s Attorney’s Office. She has worked with the office since January 2002 and has been in the homicide unit since

While negative price differentials between Germany and Denmark or France are quickly corrected, and positive price differences are arbitraged away at a slower path, the

Correcting for finite-sample bias in estimates of affine DTSMs has important implications for the estimated persistence of interest rates and for inference about short rate

Every discussion leader will have to have their own MAIN post and must reply to at least 5 posts made by fellow students, including other discussion leaders.. Once your