Download presentation
Presentation is loading. Please wait.
Published byDorcas Warner Modified over 9 years ago
1
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
2
programming languages and software design processes Design processes : break a system down into smaller and smaller units Programming languages : define abstractions of system sub-units, compose those abstractions to produce the overall system Abstraction and composition mechanisms is common key object-oriented languages, procedural languages and functional languages
3
Requirement Functional : system must able to do it. e.g. registering in education system. Nonfunctional : Issues in connection with the system and how to do tasks well. e.g. Performance, Quality of Service.
4
What is a Concern ? One or more requirement related to stakeholders and development, able to implement with a code structure Core Concerns : –Necessary for correct ? –Is part of program Logic –Encapsulate in module
5
What is a Concern ? (cont 1) Crosscutting Concerns: –Is not part of program Logic. e.g. Logging –Cannot be cleanly encapsulated in a module and affect on many module –Lack of clear separation in design and implementation –Tangling and Scattering
6
What are the Crosscutting Concerns ? Tangling –Code separate in multiple module Scattering –Code mixed with code of other concerns
7
Crosscutting Concerns Infrastructure Concern –Nonfunctional requirement. e.g. security, logging Peers Concern –Functional requirement –Overlap in implementation Extension Concern –Functional requirement –New concern over basic concerns
8
What Is an Aspect ? Aspects are an program unit of modularity. Avoid of separation cross-cutting code Implement Crosscutting Concerns Without Aspect With Aspect
9
What Is an Aspect ? (cont.) Aspect Consists of two sections : Advice code Including piece of code that must be executed (After, Before, Around) Pointcut Points that advice code must be executed in
10
Aspect Oriented programming Crosscutting concerns are implemented in aspects instead of fusing them into core modules. By reducing code tangling it makes it easier to understand what the core functionality of a module is. Not replacement for OOP
11
Aspect Weaver Integration takes the aspects and the core modules and composes the final system Can be implemented in various ways Compile-Time By the language compiler Loading-Time first compile source with original compiler, then weave aspects into class files Run-Time By a classloader
12
Aspect Weaver
13
Programming environment Use a Object Oriented language –E.g. Java, C++ AspectJ Weaving in loading and compiling time Java Aspect Component (JAC) Weaving in run time JBoss AOP Weaving in run time And open source
14
Example public class Example { public static void deliverMessage(String essage) { println ("The message is: " + message); } public static void main(String [] args) { deliverMessage("I'm here"); … deliverMessage("AspectJ rocks"); }
15
Example public aspect ExampleAspect { pointcut helloPC() : call(void Example.deliverMessage(..)); before() : helloPC() { System.out.print("Hello! "); } after() : helloPC() { System.out.println("The message has been delivered."); }
16
Current CBSE problems Lack of reusability and adaptability in CBSE Code-tangling is inherent to CBSE program (crosscutting concern) Uses statement (like CCM statement) during component specification may be considered harmful
17
Current CBSE problems (cont.) CBS adaptability and reusability Updating Non-functional properties in CCM each component can be configured in Package Phase. Updating functional properties Container can not be used, business rules change for system, specify in Design Phase
18
Current CBSE problems (cont.) Aspect Component Based Software Engineering (ACBSE) solved this problem New requirements involve change in all of the component life cycle AOP create changes in each component based system development phase
19
Dependency in Specification Phase Belong to the component Must be maintained by all implementations Use of component is quite limited New dependencies becomes difficult task Solution : Specify dependencies avoiding crosscutting at the Implementation Phase
20
Dependency in Implementation Phase Dependency 1.Intrinsic 2.Non-intrinsic Solution : Each component only implements the basic business functionality (intrinsic)
21
Dependency in Package Phase 1.Define during system design phase (UML) 2.Dependencies in UML translated to XML Descriptor Specification 3.XML descriptor describes the on-intrinsic for each component 4.Recompile the component code, add restriction and dependencies that specified in XML descriptor 5.These dependencies are expressed as aspect
22
Dependency in Package Phase XML descriptors use to describe the component properties Allows us to apply the non-intrinsic dependencies Dependencies with other component are not expressed in the implementation
23
Dependency in Assembly and Deployment Phase Define non-intrinsic and intrinsic dependencies Dependencies in UML translated to XML Assembly Descriptor Permit us to connect the component implementation
24
ACBSE advantages Reusability Component is not recoded, implementation adapted to new business rules by changing non- intrinsic dependencies Adaptability Modifying the component descriptor by altering the final component functionality Scalability New components with their intrinsic and non- intrinsic dependencies can be used to compose new system
25
References [1] Pedro J. Clemente and Juan Hernández, Aspect Component Based Software Engineering, University of Extremadura. Spain [2] Gregor Kiczales, et al., Aspect-Oriented Programming, proceedings of the European Conference on Object-Oriented Programming (ECOOP), Finland. Springer-Verlag LNCS 1241. June 1997.
26
Aspect Oriented Programming The end 07.01.2010 Aspect Component Based Software Engineering (ACBSE)
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.