Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.
-
Upload
marjolaine-lelong -
Category
Documents
-
view
110 -
download
0
Transcript of Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.
![Page 1: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/1.jpg)
Programmation par Aspect
Présente Par :
Linda DibSTL-M2 APr
![Page 2: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/2.jpg)
Le PLAN
1. Définitions
2. Pourquoi la programmation par aspect?
3. Méthodes Programmation par aspect Approche par transformation de programmeApproche par transformation d’interprète Approches hybrides
4. Réflexion et Programmation par Aspect
5. AspectJ
6. Les références
![Page 3: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/3.jpg)
1.a. Aspect de Base
Décrit les services d’une application.
Exemple:Dans une libraire électronique
-“rechercher un ouvrage” -“passer une commande”
- …
![Page 4: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/4.jpg)
1.b. Aspects non fonctionnels
Interviennent sur la manière de réaliser ces services.
Exemple: -distribution-persistance -synchronisation
![Page 5: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/5.jpg)
1.c. Programmation par aspect
Etape1: Départager les aspects
Etape2: L’assemblage à travers la composition.
![Page 6: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/6.jpg)
Exemple de AOP
![Page 7: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/7.jpg)
1.d. La Réflexion
Un concept de Brian Smith
« La réflexion est la capacité d’une entité à s’auto représenter et plus généralement à se manipuler elle-même. »
Propriété de base:
soutient les calculs de méta
![Page 8: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/8.jpg)
1.d. La Réflexion
Deux types de réflexion:
-Structurale: pièce décrivant la structure (de charge statique) du programme
-Comportementale: pièce décrivant son comportement (dynamique),
![Page 9: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/9.jpg)
1.e. Introspection
Un système réfléchissant observant sa propre exécution
![Page 10: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/10.jpg)
1.f. Intercession
Un système réfléchissant peut changer son exécution
![Page 11: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/11.jpg)
1.g. Le langage réflexif
Le langage réflexif comporte deux niveaux :
1. Le niveau de base :Il décrit les services réalisés par
l’application (le “Quoi”)
2. Le niveau méta :Il décrit la manière d’interpréter le
niveau de base (le “Comment”)
![Page 12: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/12.jpg)
1.h. méta lien
Le lien entre un objet de base et un méta objet
également désigné sous le nom d'un lien causal de raccordement.
![Page 13: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/13.jpg)
Le langage réflexif: schéma
![Page 14: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/14.jpg)
1.i. Réflexion comportementale Partielle
Apporter la réflexion comportemental dans une langue comme java est un nouveau défi
![Page 15: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/15.jpg)
1.i. Réflexion comportementale Partielle
Les caractéristiques:
-l’adaptabilité
-modularité
-Basée sur la réification des opérations au niveau de base
![Page 16: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/16.jpg)
1.i. Réflexion comportementale Partielle
Le méta niveau est structuré en termes de méta - objets
Le méta niveau raisonne et agit sur des réifications du calcul du niveau de base
Ces calculs sont décrits en terme d’opérations
![Page 17: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/17.jpg)
1.i. Réflexion comportementale Partielle
Example de reifications des operations :
-Message sending & receiving-Instantiation-Casting & Serialization (in Java)-Field accesses
![Page 18: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/18.jpg)
1.j. Hook
C’est le morceau de bas niveau de code qui permet
-d’exécuter une réification
-donner la commande au méta objet associé.
![Page 19: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/19.jpg)
1.k. Objet Réflectif
C’ est un objet dans lequel quelques opérations sont réifiées et sont commandées par un méta objet
![Page 20: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/20.jpg)
1.l. Sélection Spatiale
Permet de choisir ce qui sera réifié dans une application
Le choix spatial peut être fait statiquement ou dynamiquement
- le choix d'entité - choix d'opération - choix d'Intra opération
![Page 21: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/21.jpg)
1.l. Sélection Temporelle
-Choisit quand les réifications sont effectuées
-Optimise l'exécution globale d'un système se servant de la réflexion une étape plus loin
![Page 22: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/22.jpg)
1.m. Reflex 1.0
Implémente la Réflexion comportementale Partielle en Java et pour Java
Inclus les concepts de sélection spatiale et temporelle
Permet d’effectuer une configuration Statique et Dynamique
![Page 23: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/23.jpg)
Le PLAN
1. Définitions
2. Pourquoi la programmation par aspect?
3. Méthodes Programmation par aspect Approche par transformation de programmeApproche par transformation d’interprète Approches hybrides
4. Réflexion et Programmation par Aspect
5. AspectJ
6. Les références
![Page 24: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/24.jpg)
2. AOP : Utilité
Assure la réutilisation des différents aspects
![Page 25: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/25.jpg)
Le PLAN
1. Définitions
2. Pourquoi la programmation par aspect?
3. Méthodes Programmation par aspect Approche par transformation de programmeApproche par transformation d’interprète Approches hybrides
4. Réflexion et Programmation par Aspect
5. AspectJ
6. Les références
![Page 26: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/26.jpg)
3. Méthode Programmation par aspect
-Considérons l’aspect de base comme un Programme P0 écrit pour un interprète I0
-L’exécution de P0 par I0 produit un résultat R0
![Page 27: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/27.jpg)
3. Méthode Programmation par aspect
-Les aspects non fonctionnels interviennent dans le traitement
-Il produisent un résultat final R1différent du résultat R0
![Page 28: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/28.jpg)
Le PLAN
1. Définitions
2. Pourquoi la programmation par aspect?
3. Méthodes Programmation par aspect Approche par transformation de programmeApproche par transformation d’interprète Approches hybrides
4. Réflexion et Programmation par Aspect
5. AspectJ
6. Les références
![Page 29: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/29.jpg)
Approche par transformation de programme
« Consiste à définir chaque aspect non fonctionnel sous la forme d’un ensemble de règles de transformation à appliquer à l’aspect de base. »
Dans cette approche nous n’allons pas modifier l’interprète.
Difficulté de cette approche:Construction des règles de transformation génériques, indépendantes de l’aspect de base.
![Page 30: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/30.jpg)
Règles de transformation
Définies en terme de points de jonction “abstraits”
Points de jonction -Utilisés lors de la composition -Permettent de référencer des éléments de l’aspect de base.
![Page 31: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/31.jpg)
La configuration
-Consiste à lier les points de jonction “abstraits” à des éléments concrets de la définition de l’aspect de base (affectations, boucles, . . .)
-Indique les points de jonction à utiliser pour composer chaque aspect non fonctionnel avec l’aspect de base.
![Page 32: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/32.jpg)
La composition
-Elle a lieu après la configuration
-C’est l’application des règles de transformation à l’aspect de base
-Elle produit un nouveau programme où les différents aspects sont fusionnés.
![Page 33: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/33.jpg)
Le PLAN
1. Définitions
2. Pourquoi la programmation par aspect?
3. Méthodes Programmation par aspect Approche par transformation de programmeApproche par transformation d’interprète Approches hybrides
4. Réflexion et Programmation par Aspect
5. AspectJ
6. Les références
![Page 34: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/34.jpg)
Approche par transformation de l’interprète
Construction d’ un nouvel interprète I1 à partir de- des aspects non fonctionnels - de l’interprète par défaut I0
Cette approche est basée sur le concept de réflexion
![Page 35: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/35.jpg)
La réflexion
La réflexion permet de séparer naturellement l’aspect de base des aspects non fonctionnels
METACLASSTALK sépare clairement les définitions des différents aspects non – fonctionnels
![Page 36: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/36.jpg)
La configuration
-Définir pour chaque objet du niveau de base, le(s) méta - objet(s) chargé(s) d’en contrôler l’exécution
-Désigne des points de jonction où les méta - objets doivent intervenir
![Page 37: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/37.jpg)
La Composition
-D’abord, l’interprète par défaut est étendu avec les définitions des métas objets
-Puis, l’aspect de base est composé avec les aspects non fonctionnels par l’intermédiaire du lien méta
![Page 38: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/38.jpg)
Le PLAN
1. Définitions
2. Pourquoi la programmation par aspect?
3. Méthodes Programmation par aspect Approche par transformation de programmeApproche par transformation d’interprète Approches hybrides
4. Réflexion et Programmation par Aspect
5. AspectJ
6. Les références
![Page 39: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/39.jpg)
Approches hybrides
Transforme le programme et l’interprète,pour introduire les aspects non fonctionnels
JAVASSIST est l’un des rares représentants de l’approche hybride
![Page 40: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/40.jpg)
Le PLAN
1. Définitions
2. Pourquoi la programmation par aspect?
3. Méthodes Programmation par aspect Approche par transformation de programmeApproche par transformation d’interprète Approches hybrides
4. Réflexion et Programmation par Aspect
5. AspectJ
6. Les références
![Page 41: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/41.jpg)
4. Les différences entre la Réflexion et AOP
-La réflexion est un concept de structure générique
-La programmation par aspect : introduit aux programmeurs des langages aspects spécifiques ASL
-La réflexion est : solution-oriented
-La programmation par aspect: problem-oriented
![Page 42: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/42.jpg)
4. Les différences entre la Réflexion et AOP
-La programmation par aspect permet uniquement de partager puis composer les différents aspects
-La réflexion et/ou la réflexion comportementale peuvent être aussi utilisée pour:
programmation dynamiqueles programmes adaptatifs
![Page 43: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/43.jpg)
4. Le Lien entre Réflexivité et AOP
La programmation par aspect est un sous ensemble de la réflexion comportementale partielle
La construction d’un langage aspect général sur un système réflexif générique permet de garantir les aspects comportementaux et diminue la complexité de la programmation
![Page 44: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/44.jpg)
4. Le langage général
Les causes de la difficulté de l’implémentation des aspects-diversité-leur large spectre
La recherche se concentre sur la création d’un langage de programmation général: AspectJ
![Page 45: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/45.jpg)
Le PLAN
1. Définitions
2. Pourquoi la programmation par aspect?
3. Méthodes Programmation par aspect Approche par transformation de programmeApproche par transformation d’interprète Approches hybrides
4. Réflexion et Programmation par Aspect
5. AspectJ
6. Les références
![Page 46: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/46.jpg)
5. ASPECTJ
Le langage AspectJ est issu des travaux menés au Xerox-PARC sur la programmation par aspects.
ASPECTJ est une extension du langage objet java.
![Page 47: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/47.jpg)
5. ASPECTJ
Quelques définitions:
Aspect : introduit une construction qui représente un aspectnon-fonctionnel et éventuellement la configuration associée
Joint point : point de jonction
Pointcut : un ensemble de points de jonction
Advice: code qui sera exécuté automatiquement dans tous les pointcut dans un certain point de jonction. Les règles de transformation sont introduites par l’intermédiaire de mots-clés tels que before et after.
Introduction Lexical: Ajouter des fonctionnalités a une classe.
![Page 48: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/48.jpg)
Le PLAN
1. Définitions
2. Pourquoi la programmation par aspect?
3. Méthodes Programmation par aspect Approche par transformation de programmeApproche par transformation d’interprète Approches hybrides
4. Réflexion et Programmation par Aspect
5. AspectJ
6. Les références
![Page 49: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/49.jpg)
Les références
1. Le point sur la programmation par aspectsNoury M. N. Bouraqadi- Saâdani—Thomas Ledoux
2.Aspect Oriented Programming versus Reflection: a first drafyJ.Malenfant and P.Cointe
3. Supporting Dynamic Crosscutting with Partial Behavioral Reflection: a Case StudyLeonardo Rodríguez— Éric Tanter — Jacques Noyé
4. AspectJ TutorialMorgan Deters
5.Partial Behavioral Reflection: Spatial and Temporal Selection of ReificationÉric Tanter- Jacques Noyé- Denis Caromel - Pierre Cointe
6. Supporting Dynamic Crosscutting with Partial Behavioral Reflection: a Case StudyLeonardo Rodríguez — Éric Tanter — Jacques Noyé
![Page 50: Programmation par Aspect Présente Par : Linda Dib STL-M2 APr.](https://reader034.fdocument.pub/reader034/viewer/2022051412/551d9da2497959293b8d2aa2/html5/thumbnails/50.jpg)
Les URL
1. MetaClassTalkhttp://csl.ensm-douai.fr/MetaclassTalk
2. Conférence sur AOPhttp://www2.parc.com/csl/projects/aop/workshops/icse98/
3. International conference on Aspect-Oriented software developmenthttp://aosd.net/2006/index.php