aspect oriented programming razieh asadi university of science & technology mazandran babol...
TRANSCRIPT
![Page 1: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/1.jpg)
Aspect Oriented Programming
Razieh Asadi
University of Science & Technology
Mazandran Babol
Aspect Component Based Software
Engineering (ACBSE)
![Page 2: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/2.jpg)
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
![Page 3: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/3.jpg)
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.
![Page 4: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/4.jpg)
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
![Page 5: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/5.jpg)
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
![Page 6: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/6.jpg)
What are the Crosscutting Concerns ?
Tangling–Code separate in multiple module
Scattering
–Code mixed with code of other concerns
![Page 7: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/7.jpg)
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
![Page 8: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/8.jpg)
What Is an Aspect ?
Aspects are an program unit of modularity.
Avoid of separation cross-cutting code
Implement Crosscutting Concerns
Without Aspect
With Aspect
![Page 9: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/9.jpg)
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
![Page 10: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/10.jpg)
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
![Page 11: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/11.jpg)
Aspect Weaver
Integration takes the aspects and the core modules and composes the final system
Can be implemented in various waysCompile-Time
By the language compiler
Loading-Time first compile source with original compiler, then weave aspects into class files
Run-Time By a classloader
![Page 12: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/12.jpg)
Aspect Weaver
![Page 13: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/13.jpg)
Programming environment
Use a Object Oriented language–E.g. Java, C++
AspectJWeaving in loading and compiling time
Java Aspect Component (JAC)Weaving in run time
JBoss AOPWeaving in run time And open source
![Page 14: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/14.jpg)
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");}
}
![Page 15: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/15.jpg)
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.");}
}
![Page 16: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/16.jpg)
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
![Page 17: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/17.jpg)
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
![Page 18: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/18.jpg)
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
![Page 19: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/19.jpg)
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
![Page 20: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/20.jpg)
Dependency in Implementation Phase
Dependency
1. Intrinsic
2. Non-intrinsic
Solution :
Each component only implements the
basic business functionality (intrinsic)
![Page 21: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/21.jpg)
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
![Page 22: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/22.jpg)
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
![Page 23: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/23.jpg)
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
![Page 24: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/24.jpg)
ACBSE advantages
ReusabilityComponent is not recoded, implementation adapted to new business rules by changing non-intrinsic dependencies
AdaptabilityModifying the component descriptor by altering the final component functionality
ScalabilityNew components with their intrinsic and non-intrinsic dependencies can be used to compose new system
![Page 25: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/25.jpg)
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.
![Page 26: Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)](https://reader034.vdocuments.net/reader034/viewer/2022042822/56649e845503460f94b85dab/html5/thumbnails/26.jpg)
Aspect Oriented Programming
The end
07.01.2010
Aspect Component Based Software
Engineering (ACBSE)