You are on page 1of 18

Contents

• Introduction
• AOP Methodology
• AOP Languages
• AspectJ

1
Programming Methodologies
Concern
Abstraction
AO Programming

Object
Function OO Programming Abstraction
Abstractio
n
Procedural Programming

Assembly Programming

Programming Methodologies
m/c Programming Evaluation
2
Introduction

• Currently, the dominant programming


paradigm is object-oriented programming
that:
 has been presented as a technology that can
fundamentally aid software engineering
 is reflected in the entire spectrum of current
software development methodologies and tools

• Object orientation is a clever idea, but has


certain limitations

3
Cont..

• A new programming technique called


aspect-oriented programming (AOP):
 makes it possible to clearly express
those programs that OOP fail to support
 enables the modularization of crosscutting
concerns by supporting a new unit of sw
modularity – aspects – that provide
encapsulation for crosscutting concerns
4
Terminology
Aspects
•In AOP crosscutting concerns are implemented in
aspects instead of fusing them into core modules.
•Aspects are an additional unit of modularity.
•Aspects can be reused.
•By reducing code tangling it makes it easier to
understand what the core functionality of a module
is.
•An “aspect weaver” takes the aspects and the core
modules and composes the final system.

5
Terminology
Concern
•AOP is based on the idea that computer systems are better
programmed by separately specifying the various concerns
of a system
•Separation of concerns is an important software
engineering principle guiding all stage of a sw development
methodology
•Concerns:
 are properties or areas of interest
 can range from high-level notion to low level-notion
 can be functional or nonfunctional (systemic)
6
Terminology cont

• Core concerns
– Central functionality of a Business logic (single
module)
– Customer and Account management, Interbanking
transactions, ATM transactions
• Crosscut concerns
– System-level, peripheral requirements (multiple
modules)
– Persistence of all entities, Transaction integrity,
Authorization of access to various services, logging,
Security, Error checking, Policy enforcement

7
Typical Application
Business Logic
Concern

Accounting

ATM
Persistence Logging
Database
Logging
Implementation
Persistence modules
System

8
Implementation by Traditional
Languages
API
invocations

Accounting Module

ATM Module
Logging Module

Database Module

9
Implementation by AOP
Automatically Weaving
Invocations
Accounting Module
API
Invocation

ATM Module
Logging Aspect Logging Module

Database Module

Aspect: A modular unit of crosscutting concern


implementation
10
AOP Methodology
• The idea behind AOP is “Separation of
concern”
• AOP builds upon Existing Methodologies
(OOP, Procedural programming),
augmenting them with concepts and
constructs in order to modularize
crosscutting concerns.
• Now, concern consists of what?

11
AOP Development Stages
Security Integrating all
Business concerns
Logic
Logging
Identify
concerns

Persistence

12
AOP Languages
• AOP Language Specification
– Describes the language constructs and
syntax
– Specification for implementing the
individual concerns and rules for weaving
different concerns

13
AOP Languages cont

• AOP language implementation


– Verifies the code and translates the code into
an executable form
– Implementation done by two steps
• Combining individual concerns using the weaving
rules - Weaving
• Then converting result into executable code.
• Some AOP Languages
– AspectJ, Aspect#, AspectC++, PHPaspect.

14
AspectJ
• Aspect-oriented extension to Java language
• Language Specification
• Language Implementation
– Concern by Java Language
– Weaving rules by extension Tools
• Crosscutting in AspectJ
– Implementation of the weaving rules by the compiler
– 2 Types:
• Dynamic Crosscutting
– Weaving of new Behavior into execution of program
• Static Crosscutting
– weaving of modifications into the static structure, to support the
Dynamic Crosscutting
15
AspectJ cont

• Crosscutting Elements
– Join Point
• Well-defined points in the execution of a program
– Pointcut
• A means of referring to collections of join points and certain values at
those join points
– Advice
• Method-like constructs to define additional behavior at join points
– Introduction
• Instruction that changes to the classes, interfaces of the system
– Compile time Declaration
• Instruction for adding compile time warnings and errors to the system
– Aspect
• Unit of modular crosscutting implementation
16
Conclusion
• Aspect-oriented programming (AOP) is a new
paradigm--a new way to think about programming
• AOP is somewhat similar to event handling, where
the “events” are defined outside the code itself
• AspectJ is not itself a complete programming
language, but an adjunct to Java
• AspectJ does not add new capabilities to what Java
can do, but adds new ways of modularizing the code
• AspectJ is free, open source software
• Like all new technologies, AOP may--or may not--
catch on in a big way
17
THANK YOU

18

You might also like