Chapter 8: Aspect Oriented Programming Omar Meqdadi SE 3860 Lecture 8 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming
Advertisements

Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Idaho National Engineering and Environmental Laboratory What is a Framework? Web Service? Why do you need them? Wayne Simpson November.
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development.
Overview of AspectJ Aspect Oriented Software Development Seminar Technion presented by Oren Mishali.
Copyright © 2008 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are trademarks of Accenture. Andrew Stone Common Security.
Aspect-Oriented Programming In Eclipse ® Aspect-Oriented Programming in Eclipse with AspectJ Dr Helen Hawkins and Sian January.
Object-Oriented Analysis and Design
Introduction To System Analysis and Design
Layered Architectures The objectives of this chapter are: To understand the principles and importance of Layered Architectures To explain the structure.
Review Amit Shabtay. March 3rd, 2004 Object Oriented Design Course 2 Review What have we done during the course? Where to learn more? What is for the.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
TRADING SOFTWARE AKSofttech. INTRODUCTION Trading Software is an integrated accounting system which takes care of all business needs. It incorporates.
+ Informatics 122 Software Design II Lecture 8 Emily Navarro Duplication of course material for any commercial purpose without the explicit written permission.
5.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Introduction to AOP.
BCS 2143 Introduction to Object Oriented and Software Development.
Aspect Oriented Programming (AOP) in.NET Brent Krueger 12/20/13.
5.0 Objects First with Java A Practical Introduction using BlueJ Introduction to Computer Science I Instructor: Allyson Anderson.
Aspect Oriented Programming Scott Nykl CSSE 411 Senior Seminar.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development 1.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
(Business) Process Centric Exchanges
Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer.
Aspect Oriented Programming Gülşah KARADUMAN.
SE: CHAPTER 7 Writing The Program
Chapter 7 Software Engineering Introduction to CS 1 st Semester, 2015 Sanghyun Park.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 6 Using Methods.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
Introduction Better Faster Cheaper (pick any two) On-going issue that continues to motivate research in software engineering Applications: –continue to.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Computing and SE II Chapter 9: Design Methods and Design Models Er-Yu Ding Software Institute, NJU.
Object Oriented Software Development
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 9 Database Triggers.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
Secure Systems Research Group - FAU 1 A Trust Model for Web Services Ph.D Dissertation Progess Report Candidate: Nelly A. Delessy, Advisor: Dr E.B. Fernandez.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
C++ Inheritance Data Structures & OO Development I 1 Computer Science Dept Va Tech June 2007 © McQuain Generalization versus Abstraction Abstraction:simplify.
Session 1 Module 1: Introduction to Data Integrity
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 1: Introduction to IS2803 Rob Gleasure
Refactoring Agile Development Project. Lecture roadmap Refactoring Some issues to address when coding.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
Copyright © 2004, Keith D Swenson, All Rights Reserved. OASIS Asynchronous Service Access Protocol (ASAP) Tutorial Overview, OASIS ASAP TC May 4, 2004.
Aspect-Oriented Software Development (AOSD)
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
7.5 Using Stored-Procedure and Triggers NAME MATRIC NUM GROUP Muhammad Azwan Bin Khairul Anwar CS2305A Muhammad Faiz Bin Badrol Shah CS2305B.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
Distributed Shared Memory
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Lecture 2 of Computer Science II
Objects First with Java A Practical Introduction using BlueJ
INFS 6225 – Object-Oriented Systems Analysis & Design
Chapter 9 Object-Oriented Programming: Inheritance
JAsCo an Aspect-Oriented approach tailored for
Oracle9i Developer: PL/SQL Programming Chapter 8 Database Triggers.
Objects First with Java A Practical Introduction using BlueJ
Chapter 8 Advanced SQL.
Objects First with Java A Practical Introduction using BlueJ
AspectAda Aspect-Oriented Programming for Ada95
Prof. Arfaoui. COM390 Chapter 9
Classes, Objects and Methods
Presentation transcript:

Chapter 8: Aspect Oriented Programming Omar Meqdadi SE 3860 Lecture 8 Department of Computer Science and Software Engineering University of Wisconsin-Platteville

2 Topic Covered Introduction Aspect Oriented Programming  Goals  Terms Examples  Code Example  Real-World Example

3 Introduction OO mechanisms collect related data and operations and encapsulate them into objects. Ideally, objects have high cohesion and low coupling. There are times when objects with their low coupling just don’t work or can lead to problems.

4 Introduction Possible Problems with OO can occur when:  Implementing High level, system wide requirements  Implementation of Enterprise wide Security Role based authentication to multiple application within a company Access login  Application (system level) logging or journaling  System security requirements  Other policy level requirements Handling messages among multiple applications and domains

5 Solution1 The problem with supporting these application or enterprise wide requirements is  We want to support them with objects, but cannot encapsulate them in a single object The functionality must be many objects.

6 Solution2 An alternative might be multiple inheritance – but this solution  Increases object complexity  Increases maintenance  Possibly not be allowed in the current source level programming language.

We have an employee record system implemented as a large collection of objects  401K accounts: Home address, family members, accounts (bills), payroll data, stock options, vacation time, medical records, drug testing, awards, etc. For security purposes  We want to add the capability of logging any transaction that modifies data in this database.  We don’t want someone changing pay rates or adding vacation days or modifying other financial records! We would need to add this code to all classes/objects that contain writes/updates. Requirements Example

It would be major work adding update journaling for each of the data fields in each of these objects.  We would need to crawl though each of the objects looking for specific transactions that relate to this data and then insert the code as needed. If we needed to enhance this logging functionality we would need to crawl through all of the code to update each of these objects – major pain! High Coupling!  And hopefully we wouldn’t miss any places! Also we a lowering the Cohesion of each object that we are adding this security code Requirements Example: Problems

Goals:  Want to add all of the new journaling functionality in a single location. This simplifies implementation and maintenance.  Want to specify what functionality is invoked based on event conditions and/or rules  Don’t want to crawl though all the existing code to find extension points (locations where this functionality would need to be inserted).  Don’t want to miss finding a place that needs to be covered.  Don’t want to duplicate functionality in multiple objects Aspect Oriented Programming

Aspect Oriented Programming will allow us to:  Create a central collection of operations responsible for logging  Specify that when an employee database modification happens the object data will be journalized Aspect Oriented Programming

Terms:  Cross-Cutting Concern – Some aspects of implementation, like logging, error handling, standards enforcement, tracing are difficult to implement in a modular way. This results in code tangled and scattered across the entire system. This is called Cross-Cutting!  Advice – this is the code that we need to add to implement the features like those that we have discussed above, like logging. Aspect Oriented Programming

Terms:  Point Cut – is the place in the existing code that we want to insert the new functionality. We may want a point cut in at the beginning of the code that modifies a student record and another point to cut out when it finishes the modification.  Aspect – it the combination of the point-cut and the advice. We want to add logging to our student record system when any transaction attempts to modify data

Code Example

Code Example: Analysis Point-cut named “LogEmployeeChange:  Specifies specific points where employee object is changed.  Line 13 indicates that we will refer to this point cut as LogEmployeeChange, and that it takes an object ‘e’ of type Employee

Point-cut named “LogEmployeeChange:  In line 14, 15, 16, and 17 it specifies that the point cuts occur in methods: setName( ), setAddress( ), setSalary( ), …  Line 14 explicitly says, “for any ‘public’ method of class ‘Employee’ with any type of return parameter (‘*’), a name of ‘setName’, and a parameter set of anything (‘..’), execute the corresponding Advice. Lines 15 through 17 can be interpreted in a similar manner and are additional point-cuts Code Example: Analysis

Point-cut named “LogEmployeeChange:  The wildcards ‘*’ and “(..)” allow coverage of overloaded functions.  We could have other Point-Cuts for any of the other objects in the system that modify data Code Example: Analysis

Advice – what we want to perform at a Point-cut  Before Advice Line 19 says, “Since the LogEmployeeChange point-cut has been triggered, execute the code in its “before” advice block before executing the method which triggered the point-cut.” The actual instance of the Employee class, before it is written will be passed into the before Advice as “Employee e” for logging Code Example: Analysis

Advice – what we want to perform at a Point-cut  After Advice After executing before Advice, the method, which triggered the point-cut is executed; this method could be “setName”, “setAddress”,... Once execution returns from this method, the after Advice for LogEmployeeChange is executed, which logs the new Employee object’s data Code Example: Analysis

Open-source implementation of Java Servlet and JavaServer Pages developed at the Apache Software Foundation Real-World Example

The bars represent system objects  Red Shows encapsulated XML Parser in Tomcat Nicely contained in one object Real-World Example

Red Shows encapsulated URL Pattern Matching in Tomcat  Not too bad, functionality contained in two system objects Real-World Example

Consider the following figure Real-World Example

From previous figure  Red Shows Tomcat Logging The logging functionality is scattered across almost every object in the system. This is NOT good! What happens if we wanted to reengineering this logging?  This would be an excellent opportunity for Aspect Oriented Programming Increase Cohesion Greatly decrease Coupling Increase Maintainability Remove duplicate logging code that is scattered across the whole system Real-World Example