aspect oriented programing - introduction

13
Aspect-Oriented Programing Introduction

Upload: venkaiah-chowdary-koneru

Post on 17-Dec-2014

172 views

Category:

Education


2 download

DESCRIPTION

Very basic introduction to Aspect Oriented Programming. This helps you to prepare for learning AOP.

TRANSCRIPT

Page 1: Aspect Oriented Programing - Introduction

Aspect-Oriented Programing

Introduction

Page 2: Aspect Oriented Programing - Introduction

What is the problem with OOP?

Any custom software development necessarily needs to address cross-cutting concerns.

PoolingValidation Caching

SynchronisationProfiling

Transaction

LoggingLoadBalancing Reomoting

PersistanceSecurity

How to share these behaviors without "dirty" code?

Page 3: Aspect Oriented Programing - Introduction

What is the problem with OOP?

Business Logic Code

Logging

Monitoring

Validation

Transaction

Page 4: Aspect Oriented Programing - Introduction

What is the problem with OOP?

• The OOP provides a good level of abstraction and modularity

• Complex problems often arrive at the following cases– Too many abstractions– Difficulty in breaking code– Strong Coupling between components– Scattered code

• Principles of software development S.O.L.I.D– SRP

Page 5: Aspect Oriented Programing - Introduction

AOP

• aspect-oriented programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns

- wikipedia

Page 6: Aspect Oriented Programing - Introduction

A simplistic example

Identification of cross-cutting Concerns

Page 7: Aspect Oriented Programing - Introduction

A simplistic example

Writing the advice

Page 8: Aspect Oriented Programing - Introduction

A simplistic example

Select the action points (pointcut)

In our example: Pointcut = "At the beginning of each method"

Page 9: Aspect Oriented Programing - Introduction

In summary, AOP is

• Identify needs transverse (cross cutting concerns)

• Write one or more plugin code (advices)– Representation aspect – Encapsulation of behavior.

• Choosing where to apply these plugin(pointcuts)

Page 10: Aspect Oriented Programing - Introduction

OOP + AOP

Page 11: Aspect Oriented Programing - Introduction

Who links the code ?

Weaver

Page 12: Aspect Oriented Programing - Introduction

When to use AOP ?

Page 13: Aspect Oriented Programing - Introduction

Q & A ?