Professional Documents
Culture Documents
NET
Vladimir O. Safonov Professor of computer science, Head of laboratory St. Petersburg University v_o_safonov@mail.ru
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
Vladimir Safonov, SSCLI Capstone Workshop, Redmond 2005 2
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 an aspect to a target application (inserting new modules and definitions; inserting, replacing or deleting tangled pieces of code) 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
Vladimir Safonov, SSCLI Capstone Workshop, Redmond 2005 4
Aspect.NET architecture
Aspect.NET.ML converters (currently for C#) to definitions of AspectDef AOP attribute Aspect weaver: Target assembly + Aspect assemblies -> Target assembly* Aspect editor + aspect GUI: locating aspects, coloring aspects, editing aspects, deleting aspects; integrated to Whidbey as add-in Aspect.NET .msi-based installer (checks where the Phoenix RDK is located on your machine) AspectRotor a separate console version of Aspect.NET for Rotor environment
Vladimir Safonov, SSCLI Capstone Workshop, Redmond 2005 7
10
11
Hasso-Plattner Institute, Potsdam, February 2004 Microsoft Academic Days, Moscow, April 2005 IEEE Regional Conference, St. Petersburg, May 2005 MSR Faculty Summit, Redmond, July 2005 (as part of the Phoenix panel) Now MSR Rotor Capstone Workshop, Redmond, September 2005 Current plans (Sep 2005): submit a paper and talk on Aspect.NET to the Fifth International AOSD Conference, Bonn, Germany, March 2006 (the classical AOP conference)
Vladimir Safonov, SSCLI Capstone Workshop, Redmond 2005 13
Aspect.NET users, evaluators and those who sent feedback (Sep 2005)
Microsoft Phoenix team
John Lefor, Shahrokh Mortazavi, Jim Hogg et al. Mercury Interactive (www.mercury.com), contact person: Yaniv Bronstein University in Brazil, contact person: Andrea Furtado Highly appreciated the project (email feedback): Andreas Mauer, TRIA IT-consulting GmbH (www.tria.de) John Fahring John.Fahring@gmx.net
Vladimir Safonov, SSCLI Capstone Workshop, Redmond 2005 14
15
Aspect.NET references
1) http://aosd.net - The starting Web site on AOP 2) http://www.msdnaa.net/curriculum/?6219 Aspect.NET&doc 3) Safonov V. O. Aspect.NET: a new approach to aspect-oriented 4) 5) 6)
programming. - .NET Developers Journal, 2003, #4. Safonov V.O. Aspect.NET: concepts and architecture. - .NET Developers Journal, 2004, #10. Safonov V.O., Grigoryev D.A. Aspect.NET: aspect-oriented programming for Microsoft.NET in practice. - .NET Developers 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.
Vladimir Safonov, SSCLI Capstone Workshop, Redmond 2005 16
Using Aspect.NET
Installing Aspect.NET
Pre-requisites: 1) Microsoft Visual Studio 2005 beta 2 installed. 2) Microsoft Phoenix RDK 02/28/05 Release installed Notes: Aspect.NET Framework has been tested under Microsoft
Visual Studio 2005 beta 2 and with assemblies written in C# only. To install Aspect.NET, run AspectNETFramework.msi and follow tips of the wizard. The installer copies core assemblies, deployment files as well as Phoenix binaries into the folder specified by the user.
Vladimir Safonov, SSCLI Capstone Workshop, Redmond 2005 18
19
20
21
Weaving aspects
Open or Create new C# project in Visual Studio. In Aspect.NET Framework click "Add Existing
Aspect Module" button on "Modules" tab to add Aspect assemblies. You can add multiple assemblies. Press "Find Joinpoints" button to find the join points in the currently active project. If join points have been found, Aspect.NET Framework switches to the "Aspects" tab. Here you can filter the joinpoints and browse them.
23
Weaving aspects
Use the checkboxes in the join points tree to enable or
disable a join point. You can enable or disable groups of join points by checking or unchecking parent methods, classes and namespaces. You can click the join point to see its location in a source code. Pressing "Weave Aspects" button results in aspects weaving into the debug assembly of the current project. When weaving is finished , Aspect.NET Framework informs you where the target assembly is located.
Vladimir Safonov, SSCLI Capstone Workshop, Redmond 2005 24
Weaving aspects
Visualization Tab represents program modules, with aspect actions
woven, as colored chart.
25
Example of Weaving
MAddNop is a basic sample included into
Phoenix RDK to demonstrate its capabilities. It is a simple managed Phoenix based application to add nop's to an existing executable. Lets change its behavior without touching source code and create an aspect MAddNopCounter to add some tracing. The aspect reports on starting Phoenix initialization process, prints Phoenix configuration state and counts the number of nops inserted to an executable.
Vladimir Safonov, SSCLI Capstone Workshop, Redmond 2005 26
27
28
29
30
31
32
AspectRotor
The first Aspect.NET console version working in the Rotor
environment. Included into the Aspect.NET archive uploaded to the MSDNAA Web site A set of Perl scripts (please use ActivePearl 5.8.7) to initialize, to build and remember target applications and aspects, to select join points, to visualize the sources, to weave aspects, to run the original and the updated assemblies Uses Phoenix as well-as the add-in version, and the Rotor binaries shipped with the Phoenix RDK A simple comfortable menus in console mode provided for each step; its possible to undo and return back DEMO (IF TIME PERMITS)
Vladimir Safonov, SSCLI Capstone Workshop, Redmond 2005 33
Q&A
34