Title: Aspect Oriented Software Development
1 Aspect Oriented Software Development
2 On July 20th 2008, our name has changed from
to
3Objectives
- To explain the principle of separation of
concerns in software development - To introduce the fundamental ideas underlying
aspect-oriented development - To show how an aspect-oriented approach can be
used at all stages of development
4Agenda
- Introduction
- Problem Statement
- Aspect Solution
- Aspect Anatomy
- Aspect Terminology
- Aspect Weaving
- Evolution of Systems Development Methods
- Aspect Oriented Software Development
5Introduction
- A concern is an area of interest or focus in a
system. Concerns are the primary criteria for
decomposing software into smaller, more
manageable and comprehensible parts that have
meaning to a software engineer. - Object-oriented programming, describing concerns
as objects - Procedural programming, describing concerns as
procedures
6Introduction
- Separation of concerns (SOC) The principle of
separation of concerns states that software
should be organized so that each program element
does one thing and one thing only. - Each program element should therefore be
understandable without reference to other
elements. - Object-oriented programming languages such as
Java can separate concerns into objects. - Service-oriented architecture can separate
concerns into services. - Procedural programming languages such as C and
Pascal can separate concerns into procedures.
7Agenda
- Introduction
- Problem Statement
- Aspect Solution
- Aspect Anatomy
- Aspect Terminology
- Aspect Weaving
- Evolution of Systems Development Methods
- Aspect Oriented Software Development
8Problem Statement
void transfer(Account fromAccount, Account
toAccount, int amount) if
(fromAccount.getBalance() lt amount)
throw new InsufficientFundsException()
fromAccount.withdraw(amount)
toAccount.deposit(amount)
9Problem Statement
void transfer(Account fromAccount, Account
toAccount, int amount) throws Exception
if (!getCurrentUser().canPerform(OP_TRANSFER))
throw new SecurityException()
Transaction tx database.newTransaction()
try if (fromAccount.getBalance() lt
amount) throw new InsufficientFundsExc
eption() fromAccount.withdraw(amoun
t) toAccount.deposit(amount)
tx.commit() systemLog.logOperation(
OP_TRANSFER, fromAccount, toAccount, amount)
catch(Exception e)
tx.rollback() throw e
Authentication Concern
Transaction Concern
Transaction Concern
Logging Concern
Transaction Concern
10Problem Statement
Transfer Concern
Authentication Concern
Logging Concern
Transaction Concern
11Problem Statement
Banking System
Transfer Concern
Cash Deposit Concern
Authentication Concern
Authentication Concern
Logging Concern
Logging Concern
Transaction Concern
Transaction Concern
Cash Withdrawal Concern
Authentication Concern
Logging Concern
Transaction Concern
12Problem Statement
- Code is scattered when one concern (like logging)
is spread over a number of modules (e.g.,
Transfer method). - Modules end up tangled with multiple concerns
(e.g., Transfer, logging, and Authentication).
13Agenda
- Introduction
- Problem Statement
- Aspect Solution
- Aspect Anatomy
- Aspect Terminology
- Aspect Weaving
- Evolution of Systems Development Methods
- Aspect Oriented Software Development
14Aspect Solution
- AOSD attempts to solve this problem by allowing
the programmer to express cross-cutting concerns
(e.g., Transaction, logging, and Authentication)
in stand-alone modules called aspects. - Used in conjunction with other approaches -
normally object-oriented software engineering. - Aspects encapsulate functionality that cross-cuts
and co-exists with other functionality. - Aspects include a definition of where they should
be included in a program as well as code
implementing the cross-cutting concern.
15Agenda
- Introduction
- Problem Statement
- Aspect Solution
- Aspect Anatomy
- Aspect Terminology
- Aspect Weaving
- Evolution of Systems Development Methods
- Aspect Oriented Software Development
16Aspect Anatomy
aspect authentication //this is the
aspect before call (public void Transfer
(..)) // this is a pointcut // this is
the advice int tries 0 string
userPassword Password.Get ( tries ) while
(tries lt 3 userPassword ! thisUser.password (
) ) // allow 3 tries to get the password
right tries tries 1 userPassword
Password.Get ( tries ) if (userPassword
! thisUser.password ( )) then //if password
wrong, assume user has forgotten to
logout System.Logout (thisUser.uid) //
authentication
17Agenda
- Introduction
- Problem Statement
- Aspect Solution
- Aspect Anatomy
- Aspect Terminology
- Aspect Weaving
- Evolution of Systems Development Methods
- Aspect Oriented Software Development
18Aspect Terminology
19Agenda
- Introduction
- Problem Statement
- Aspect Solution
- Aspect Anatomy
- Aspect Terminology
- Aspect Weaving
- Evolution of Systems Development Methods
- Aspect Oriented Software Development
20Aspect Weaving
- Aspect weavers process source code and weave the
aspects into the program at the specified
pointcuts.
21Aspect Weaving
22Agenda
- Introduction
- Problem Statement
- Aspect Solution
- Aspect Anatomy
- Aspect Terminology
- Aspect Weaving
- Evolution of Systems Development Methods
- Aspect Oriented Software Development
23Evolution of Systems Development Methods
24Agenda
- Introduction
- Problem Statement
- Aspect Solution
- Aspect Anatomy
- Aspect Terminology
- Aspect Weaving
- Evolution of Systems Development Methods
- Aspect Oriented Software Development
25Aspect Oriented Software Development
- A holistic approach to developing software
systems with aspects. - Better modularity for functional requirements,
nonfunctional requirements, platform specifics,
and so on and keeping them separate from each
other. - AOSD is not just AOP. It encompasses a whole
range of techniques to help you achieve better
modularity. - object orientation
- component-based development
- design patterns
- object-oriented frameworks such as J2EE and .NET,
and more
26Aspect Oriented Software Development
... Requirements Engineering
... Architecture
... Design
Aspect-oriented...
... Programming
... Verification techniques
27QA
28- Mostafa Elbarbary
- 012-428-6547
- Mostafa.elbarbary_at_its.ws
29Thank You