Aspect.NET – an aspect-oriented programming tool for Microsoft.NET using Phoenix and Whidbey Vladimir O.

Download Report

Transcript Aspect.NET – an aspect-oriented programming tool for Microsoft.NET using Phoenix and Whidbey Vladimir O.

Aspect.NET – an aspect-oriented
programming tool for
Microsoft.NET using Phoenix and
Whidbey
Vladimir O. Safonov
Professor of computer science, head of
laboratory
St. Petersburg University
Aspect.NET project
(granted by MSR in 2002 and 2004)
Goals:




Develop a state-of-the-art aspect-oriented
programming (AOP) tool for Microsoft.NET, on top of
Microsoft Phoenix, integrated with the latest Visual
Studio (Whidbey) and working also in SSCLI/Rotor
environment
Make AOP ubiquitous for Microsoft.NET software
developers
Develop most adequate ways of representing
aspects for Microsoft.NET
Lay the foundation for future research and
development work on spreading AOP among
Microsoft.NET users
AOP origin and status
Aspect-oriented programming (AOP) – a prospective
software engineering paradigm based on a concept of
cross-cutting concern whose implementation contains
not only a related set of modules but a set of tangled
code fragments to be weaved (inserted) into a target
application
Predecessor: Professor A. L. Fouxman (Rostov
University), “Technological Aspects of Software
Systems Development”, 1979
Modern classicist of AOP: Professor Gregor Kichales,
University of British Columbia, Canada (AspectJ tool
~ AOP extension for Java)
AOP basics
Cross-cutting concern ~ a concern whose implementation
cannot be made by a generalized procedure
Examples ~ logging; security; MT-safety; implementation of a
new source language construct in a compiler
Aspect ~ implementation of a cross-cutting concern
Weaving ~ applying (inserting) an aspect to a target application
Pointcut ~ a set of weaving rules for an aspect
Join points ~ a set of concrete points in a target application
subject to aspect weaving
Benefits of AOP: make software development and
maintenance easier due to performing it in terms of aspects
Our approach to AOP
Make aspects multi-language (language agnostic), in accordance
to .NET programming paradigm, rather than extend each
programming language by AOP constructs (as opposed to
AspectJ)
Use a simple AOP meta-language Aspect.NET.ML to provide
user-level AOP annotations to compilation units
Represent meta-information on aspects by custom attributes
(AspectDef, AspectRef), to safely tie them to assemblies, to make
them easily available to AOP tools, and to avoid updating any
general .NET tools for the purpose of their “AOP-awareness”
Use Phoenix to handle assemblies and to support weaving
Develop Aspect.NET as a Whidbey add-in to closely integrate it to
a variety of .NET tools and technologies
Aspect.NET architecture
Aspect.NET.ML converters (for C#, VB.NET etc) to
definitions of AspectDef attribute
Aspect weaver:
Target assembly + Aspect assembly -> Target
assembly*
Aspect editor + aspect GUI: locating aspects, coloring
aspects, editing aspects, deleting aspects
Aspectizer: locating aspects in non-AOP applications
Example: the Politeness aspect
%aspect Politeness
public class Politeness
{
%modules
public static SayHello ()
{
System.Console.WriteLine(“Hello”);
}
public static SayBye ()
{
System.Console.WriteLine(“Bye”);
}
%rules
%before %call *
%action public static void SayHelloAction
{ Politeness.SayHello()}
%after %call *
%action public static void SayByeAction { Politeness.SayBye()}
Example: Weaving Politeness
%to MyApplication %apply Politeness
(the same can be done by means of Aspect editor)
Aspect.NET working screenshot
Aspect coloring screenshot
Aspect.NET status and perspectives
Aspect.NET implementation team (SPBU PhD and
graduate students: Dmitry Grigoryev, Mikhail Gratchev,
Alexander Maslennikov, Oleg Romashin et al.)
A working prototype of Aspect.NET on top of latest
Phoenix (02/28/05) and Whidbey developed
Aspect.NET installer/distribution developed
By September 2005: complete working version of
Aspect.NET
Perspectives: library of examples; further research on
aspect-oriented knowledge management and on
aspectizing (aspect mining)
Using Aspect.NET
Vladimir O. Safonov
Professor
St. Petersburg University
Aspect.NET references
1)
2)
3)
4)
5)
http://aosd.net - The starting Web site on AOP
Safonov V. O. Aspect.NET: a new approach to aspectoriented programming. - .NET Developer’s Journal,
2003, #4.
Safonov V.O. Aspect.NET: concepts and architecture. .NET Developer’s Journal, 2004, #10.
Safonov V.O., Grigoryev D.A. Aspect.NET: aspectoriented programming for Microsoft.NET in practice. .NET Developer’s Journal, 2005, # 7.
Safonov V.O., Grigoryev D.A. Aspect.NET – an aspectoriented programming tool for Microsoft.NET. –
Proceedings of St. Petersburg Regional IEEE
conference, St. Petersburg, May 2005.