Aop2007

17
Guided By: Guided By: Prof. Manoj Chaudary Prof. Manoj Chaudary Presented By:- Presented By:- Tuhin Das Tuhin Das VI SEM CSE Smt.Bhagwati Chaturvedi College of Engineering, Nagpur “EXPRESSION” - THE PAPER PRESENTATION

description

Aspect Oriented programming.. A new era...

Transcript of Aop2007

Page 1: Aop2007

Guided By:Guided By:

Prof. Manoj ChaudaryProf. Manoj Chaudary

Presented By:-Presented By:-

Tuhin DasTuhin Das

VI SEM CSE

Smt.Bhagwati Chaturvedi College of Engineering, Nagpur

“EXPRESSION” - THE PAPER PRESENTATION

Page 2: Aop2007

CONTENTS INTRODUCTION

ABOUT OOP

ASPECT

ASPECTS & CLASSES

KEY CONCEPTS

EXAMPLE OF ASPECTS CROSS-CUT COMPONENTS

THE ROLE OF ASPECTS IN SOFTWARE DESIGN

ASPECTJ

ASPECTJ EXAMPLE

CONCLUSION

REFERENCES

Page 3: Aop2007

INTRODUCTION

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 cross-cutting concerns by supporting a new unit of s/w modularity aspects that provide encapsulation for crosscutting concerns

Page 4: Aop2007

ASPECT

An ASPECT is defined very much like a class and can have methods, field, advice initializers named pointcutsThe current working definition :

modular units that cross-cut the structure of other modular units

units that is defined in terms of partial information from other units

exist in both design and implementation

Page 5: Aop2007

ASPECTS & CLASSES

Similarities with classes:

have type

can extend classes and other aspects

can be abstract or concrete

can have fields, methods, and types as members

Differences with classes:

can additionally include as members pointcuts (picks out join points), advice (code that executes at each join point )

do not have constructor or finalizer and they cannot be created with the new operator

privileged aspects can access private members of other types

Page 6: Aop2007

KEY CONCEPTS

Cross-cutting: Crosscutting is how to characterize a concern than spans

multiple units of OO modularity.cross-cutting is respnsible for tangling in the code.

Pointcut:This is the term given to the point of execution in the application at which cross-cutting concern needs to be applied.

Join Points: Well defined points in code that can be identified.

Page 7: Aop2007

EXAMPLE OF ASPECTS CROSS-CUT COMPONENTS

We wanted to implement a distributed digital library that stores documents in many forms and provides a wide range of operations on those documents

APPLICATION COMPONENTS ASPECTS

digital database, minimizing network traffic,

Library printers, synchronization constraints,

services failure handling

Page 8: Aop2007

EXAMPLES OF HOW ASPECTS CROSS-CUT COMPONENTS

There are several aspects of concerns, including:

Page 9: Aop2007

THE ROLE OF ASPECTS IN SOFTWARE DESIGN

AOP aims at providing better means of addressing the well-known problem of separation of concerns.

Three basic approaches to addressing the process of separation of concerns:

Page 10: Aop2007

JOINT POINT MODEL

The advice-related component of an aspect-oriented language defines a join point model (JPM).

A JPM defines three things: JOIN POINTS

POINTCUTS

ADVICE

Page 11: Aop2007

AspectJ

AspectJ is:

a general-purpose AO extension to Java

Java platform compatible

easy to learn and use

freely available under an Open Source license

AspectJ enables the modular implementation of a wide range of crosscutting concerns

Page 12: Aop2007

AspectJ

When written as an aspect the structure of a crosscutting concern is explicit and easy to reason aboutAspects are modular

AspectJ enables: name-based crosscutting (tend to affect a small number of other classes)

property-based crosscutting (range from small to large scale)

The goals of the AspectJ project are to make AOP technology available to a wide range of programmers, to build and support an AspectJ user community

Page 13: Aop2007

AspectJ EXAMPLE

An example is tracing aspect that prints messages before certain display operation

The overall effect of this aspect is to print a descriptive message whenever the traced methods are called

Page 14: Aop2007

AspectJ EXAMPLEAspect SimpleTracing

{

pointcut traced() :

call (void Display.update () ) ||call (void Display.repaint (..) );

before() : traced ()

{ println(“Entering:” + thisJoinPoint); }

void println (String str)

{ <write to appropriate stream> }

}

Traced identifies calls to several key methods on Display

Before advice on this pointcut uses a helper method of the aspect to print a message

Advice uses the thisJoinPoint special variable to an object that describes the current join point

Page 15: Aop2007

CONCLUSION

In the coming years Aspect Oriented Programming will replace all the programming like POP, OOP, etc. and it is being implemented in large scale in upcoming IT industries. Languages C/C++,.NETFramework languages (C# / VB.NET)Delpi, Java, etc have implemented AOP, within the language, or as an external library.

Page 16: Aop2007

REFERENCES

web site:

http://aosd.net/

http://aspectj.org/

http://www.ccs.neu.edu/home/lieber/connection-to

-aop.html

Page 17: Aop2007

ANY QUESTIONS ??