22
Aspect-oriented software engineering ABDELFATTAH AL ZAQQA PSUT-AMMAN-JORDAN 1

Aspect oriented software engineering-draft

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Aspect oriented software engineering-draft

1

Aspect-oriented software engineeringABDELFATTAH AL ZAQQA

PSUT-AMMAN-JORDAN

Page 2: Aspect oriented software engineering-draft

Chapter 21 A

spect-oriented software engineering

2Topics covered

The separation of concerns

Aspects, join points and pointcuts

Software engineering with aspects

Page 3: Aspect oriented software engineering-draft

3Introduction-Problem

RequirementsProgram

components

Complex Relationship

Req

R1

R2

R3

Program comp.

C1

C2

C3

Page 4: Aspect oriented software engineering-draft

4Complex

Even in reuse components (remove extra code)

Change on Requirements

understanding and changing several components

Needs

Page 5: Aspect oriented software engineering-draft

5AOSE

AOSEComplexity

Problem

Program

address

Maintain and reuse easily

Page 6: Aspect oriented software engineering-draft

6End intro

Page 7: Aspect oriented software engineering-draft

7Aspects, join points, and pointcuts Example: Assume that we have medical records system such as MHCPMS.

MHCPMS components Patient info.

Holds Personal Info.

Holds Prescribed medication

handle

updatePersonalInformation (patientId, infoupdate)updateMedication (patientId, medicationupdate)

by authorized person only

Page 8: Aspect oriented software engineering-draft

8solutions

Problem: Somehow illegal update happen

Solutions:

1. re-authentication before any change tangled implementation authentication with logging or not, where?!.

2. Modify system to do authentication each time update method called scattered implementation. every call?! Several different place?

* Cross cutting between authentication and logging

Page 9: Aspect oriented software engineering-draft

9An authentication aspect in Aspect Oriented system

aspect authentication{

before: call (public void update* (..)) // this is a pointcut {

// this is the advice that should be executed when woven into// the executing systemint tries = 0 ; string userPassword = Password.Get ( tries ) ;while (tries < 3 && userPassword != thisUser.password ( ) ){

// allow 3 tries to get the password righttries = tries + 1 ;userPassword = Password.Get ( tries ) ;

} if (userPassword != thisUser.password ( )) then

//if password wrong, assume user has forgotten to logoutSystem.Logout (thisUser.uid) ;

}} // authentication 

Where it will be woven into program

Advice

Page 10: Aspect oriented software engineering-draft

10Terminology used in aspect-oriented software engineering

Term Definition

advice The code implementing a concern.

aspect A program abstraction that defines a cross-cutting concern. It includes the definition of a pointcut and the advice associated with that concern.

join point An event in an executing program where the advice associated with an aspect may be executed.

join point model The set of events that may be referenced in a pointcut.

pointcut A statement, included in an aspect, that defines the join points where the associated aspect advice should be executed.

weaving The incorporation of advice code at the specified join points by an aspect weaver.

Not standard

Page 11: Aspect oriented software engineering-draft

11aspect authentication{

before: call (public void update* (..)) // this is a pointcut Monitor: Execution (System.Logout (thisUser.uid) ){public void get(System.systime)}{

int tries = 0 ; string userPassword = Password.Get ( tries ) ;while (tries < 3 && userPassword != thisUser.password ( ) ){

// allow 3 tries to get the password righttries = tries + 1 ;userPassword = Password.Get ( tries ) ;

} if (userPassword != thisUser.password ( )) then

//if password wrong, assume user has forgotten to logoutSystem.Logout (thisUser.uid) ;

}after: call (public void update* (..))

{public void logging(userID.Get(uid)}} // authentication 

Page 12: Aspect oriented software engineering-draft

12Source code pre-processing

Link time weaving, modify compiler

Dynamic weaving at execution time

Most commonRarely used More flexible

Page 13: Aspect oriented software engineering-draft

13End Aspects, join points, and pointcuts

Page 14: Aspect oriented software engineering-draft

14Concern-oriented requirements engineering

Req3.

Req2.

Req1.

Req6

.

Req5

.

Req4

.

ReqC

• organize the requirements

according to stakeholder viewpoint.• you can then analyze

them to discover related requirements that appear in all or most viewpoints.

Page 15: Aspect oriented software engineering-draft

15Viewpoints and Concerns

Cross-cutting concerns are concerns that are identified by all viewpoints.

Page 16: Aspect oriented software engineering-draft

16Viewpoints on an equipment inventory system

1. Emergency service users1.1 Find a specified type of equipment (e.g., heavy lifting gear)1.2 View equipment available in a specified store1.3 Check-out equipment1.4 Check-in equipment1.5 Arrange equipment to be transported to emergency1.6 Submit damage report1.7 Find store close to emergency

2. Emergency planners2.1 Find a specified type of equipment2.2 View equipment available in a specified location2.3 Check-in/cCheck out equipment from a store2.4 Move equipment from one store to another2.6 Order new equipment

3. Maintenance staff3.1 Check -in/cCheck -out equipment for maintenance3.2 View equipment available at each store3.3 Find a specified type of equipment3.4 View maintenance schedule for an equipment item3.5 Complete maintenance record for an equipment item3.6 Show all items in a store requiring maintenance

Page 17: Aspect oriented software engineering-draft

17Viewpoints on an equipment inventory system

Maintenanc

e staff

Emergency

planners

Emergency service

users

1. Find a specified type of equipment2. View equipment available in a specified location3. Check-in/cCheck out equipment from a store

 

Page 18: Aspect oriented software engineering-draft

18Availability-related requirements for the equipment inventory system AV.1 There shall be a ‘hot standby’ system available in a location

that is geographically well-separated from the principal system.

Rationale: The emergency may affect the principal location of the system.

AV.1.1 The system shall send status information to the emergency control room system every five minutes.

Rationale: The operators of the control room system can switch to the hot standby if the principal system is unavailable.

Page 19: Aspect oriented software engineering-draft

19Inventory system - core requirements

C.1 The system shall allow authorised users to view the description of any item of equipment in the emergency services inventory.

C.2 The system shall include a search facility to allow authorised users to search either individual inventories or the complete inventory for a specific item or type of equipment.

Page 20: Aspect oriented software engineering-draft

20Inventory system - extension requirements

E1.1 It shall be possible for authorised users to place orders with accredited suppliers for replacement items of equipment.

E1.1.1 When an item of equipment is ordered, it should be allocated to a specific inventory and flagged in that inventory as ‘on order’.

Page 21: Aspect oriented software engineering-draft

21General rule

many concerns or extensions to the system confuse the reader and may lead to premature design.

limits the freedom of designers and may result in a system design that cannot meet its quality of service requirements.

Page 22: Aspect oriented software engineering-draft

22End Concern-oriented requirements engineering