Title: Aspect Oriented Programming
1SEA Side Software Engineering Annotations
- AAnnotation 9 AOP
- One hour presentation to inform you of new
techniques and practices in software development.
- Professor Sara Stoecklin
- Director of Software Engineering- Panama City
- Florida State University Computer Science
- sstoecklin_at_mail.pc.fsu.edu
- stoeckli_at_cs.fsu.edu
- 850-522-2091
- 850-522-2023 Ex 182
2Adaptive Oriented Programming
Dr. Sara Stoecklin Florida State University
3Adaptive Oriented Programming
- MIT Technology Review
- January/February 2001 issue defined ten emerging
areas of technology that will soon have a
PROFOUND impact on the economy and on how we live
and work. - They listed as one of those ten areas adaptive
programming.
4Adaptive Oriented Programming
- Alias
- Adaptive Oriented Programming (Northwestern
University) - Subject Oriented Programming (IBM)
- Aspect Oriented Programming (XEROX)
5Adaptive Oriented Programming
- Definition
- A technique for creating robustness to changes in
a particular aspect of a system, program, or
software component.
6Adaptive Oriented Programming
- Concept
- Design software iteratively, identifying those
things that will become necessary to change at
later dates. - Build abstractions for these changes so that
changes during maintenance will be necessary only
in parts of the system.
7Adaptive Oriented Programming
- Concept
- Software is written in a manner that allows the
programmer to work at a higher level of
abstractions than the normal executable code. - It can be implemented as meta programming.
8Adaptive Oriented Programming
- Concept
- Adaptive Programming is an extension of OO
software development where relationships between
functions and data are flexible or loosely
coupled.
9 Aspect Oriented Programming
Agenda
- Why Aspect Oriented Programming?
- What are Aspects?
- What is a cross-cutting with Aspects?
- How AOP tackle a software problem?
- Examples.
- Conclusions
10Aspect Oriented Programming
Why Aspect Oriented Programming?
- A typical process model.
- Divide system into small units of functionality.
- Write code for each functional unit.
- Have the units collaborate to form the system.
- Design decisions are tangled, business rules are
tangled. - Results in tangled code.
11Aspect Oriented Programming
Why Aspect Oriented Programming --Contd.
- Hard to manage, maintain and expand.
- OO and Procedural languages have a few points in
common, functional decomposition into
procedure/function/object. - Called GP(Generalized Procedure Languages).
- The Tangling problem is not solved by GPs.
12Aspect Oriented Programming
What is a Cross Cutting with Aspects?
SOFTWARE PROJECT
13Aspect Oriented Programming
What is a Cross Cut?
SOFTWARE PROJECT
14Aspect Oriented Programming
What is an Aspect?
- Its not a unit of systems functional
decomposition. - Its a property that effect the performance of
the components in the system. - e.g. synchronization, memory access patterns etc.
15 Aspect Oriented Programming
How AOP addresses the problem.
- A new technique called AOP.
- Aspects and concerns can be dealt with in a
relatively new way. - Provides appropriate isolation between the
components and the aspects.
16 Aspect Oriented Programming
Proposed Solution
- AOP is a step ahead in this direction of
separation of concern. - Allows to write a separate code block for a
design decision instead of spreading it all over. - Aspect Oriented Languages
- AspectJ (core functionality),
- Cool(synchronization) and
- Ridl( distribution concerns).
17 Aspect Oriented Programming
An Example
Suppose you have an order entry system and one
use case allows you to create and cancel orders.
18 Aspect Oriented Programming
Order Entry System
- Lets assume we have the following simplified
Order class as our base object - public class Order
- int orderID
- public void placeOrder()
- public void cancelOrder()
19 Aspect Oriented Programming
Order Entry System
- Suppose we now need to add authorization checks
for the persons entering and canceling orders. - Suppose also we would like to check in particular
if the requester has access rights to the methods
placeOrder() and cancelOrder().
20 Aspect Oriented Programming
Order Entry System
- If we have written this in an OO architecture
with something like EJB. Then we are stuck with
the strict OO implementation of EJB. - EJB separates the services from the business
objects BUT now we want to add a service to the
already written C/S service (i.e EJB services)
and messaging provided in both Java and EJB
21 Aspect Oriented Programming
Order Entry System
- Thus this access to user procedures may be an
ASPECT of C/S systems.
22 Aspect Oriented Programming
The Difference
- In OO, components are glued together with bits of
code using create this object, create that
object, etc. - A transaction processing goes something along
these lines log this method to a file for
debugging, run a security check, start a
transaction, open a database connection, remember
to catch exceptions or Win32 structured
exceptions and validate parameters. - Thus this code is duplicated across transactions
for transaction and session management.
23 Aspect Oriented Programming
The Difference
- In the realm of AOP, these aspects need to be
programmed separately. - Aspects associated with components often use
metadata such as the session management aspect or
data management aspect or transaction management
aspect.
24 Aspect Oriented Programming
The Difference
- The runtime uses the metadata to compose the
stack of aspects, typically occurs at object
creation time. - Thus the correct class is created according to
the aspect technique (CICS like transaction
management)
25 Aspect Oriented Programming
What are some main uses?
26 Aspect Oriented Programming
What are some main uses?
27 Aspect Oriented Programming
What are some main uses?
28 Aspect Oriented Programming
Related work
- Mehmet Aksit et al. at university of Twente
developed composition filters,object model. - Component language is OOP.
- Aspects used to synchronization and
communication. - Calton Pu et. Al. at Oregon Graduate institute,
OS kernels. Components are typical OS kernels,
aspects are optimizations based on invariants.
29 Aspect Oriented Programming
Related work
- Karl Lieberherr et al at north eastern university
trying to make OOP more reusable by introducing
aspects to control cross cutting issues. - Joe Yoder has made progress Reflection and
Meta-object Proposals - Subjective Programming introduced by IBM
- Other Engineering Disciplines
- Mechanical engineers use static, dynamic and
thermal models as these models cross cut each
other.
30 Aspect Oriented Programming
Conclusions
- Components are properties of a system for which
implementation can be easily encapsulated in a
procedure/function/object. - Aspects are properties for which implementation
cant be encapsulated. - Aspects cross-cut in systems implementation.
- AOP is needed for clean abstraction and
composition of both components and aspects.
31 Aspect Oriented Programming
Conclusions
- AOP is different from other languages as it
provides separate languages for component and
aspects. - Also provides different abstraction and
composition mechanisms. - Aspect weaver is used to co-ordinate them.
- These systems are proven to be easier to develop
and maintain and being more efficient too.