Presentation is loading. Please wait.

Presentation is loading. Please wait.

Software Engineering Lecture 7

Similar presentations


Presentation on theme: "Software Engineering Lecture 7"— Presentation transcript:

1 Software Engineering Lecture 7
Vladimir Safonov, Professor, head of laboratory St. Petersburg University WWW: Язык программирования Java. Лекция 1

2 Aspect-oriented programming (AOP): Aspect
Aspect – an implementation of a crosscutting concern Aspect – special kind of a module to be used by its weaving into other modules Examples of aspects: - implementation of MT safety for an existing library - implementation of a new source language feature in a compiler So aspects are ubiquitous in programming, but still added and located “by hand”, hence the modularity and maintenance issues (C) Vladimir O. Safonov, 2004

3 The structure of aspect definition (V. Safonov)
Aspect name Aspect parameters (optional) – generic aspects desirable Aspect data Aspect modules Aspect actions, with their weaving rules A separate reusable sets of weaving rules possible, to be used when weaving different aspects (C) Vladimir O. Safonov, 2004

4 Aspects – static or dynamic?
First view on aspects: Aspect weaving is a kind of “tangled macro expansion”: Second view: Aspect weaving is performed dynamically, at runtime if Condition then Action (looks like debugging breakpoints – well know for years) Our viewpoint (V. Safonov): we take the static view but do recognize the dynamic view should be also implemented (C) Vladimir O. Safonov, 2004

5 Aspects in AspectJ (1/2) AspectJ: Xerox PARC (1995) -> Univ. of British Columbia, Canada (2003), designed by prof. Gregor Kichales AspectJ – aspect-oriented extension of Java (compiler from the extended language, debugger in terms of aspects, Aspect GUI) Pointcut – definition of a group of weaving rules ( using wildcards for entity names), - not tied to a concrete code Join points – concrete points in concrete code to be modified in aspect weaving Advices – actions to be performed at join points (C) Vladimir O. Safonov, 2004

6 Aspects in AspectJ (2/2) Aspects in AspectJ are essentially dynamic (similar to debugging-style breakpoints/debugging actions) Introduce – weaving new definitions into a module; these definitions are visible by the aspect only (no encapsulation violation happens) around S A -> B - AspectJ style of code modification at runtime (self-modifying code); actually, AspectJ behaves as term rewriting system. Our viewpoint: this is a powerful tool but potentially dangerous (C) Vladimir O. Safonov, 2004

7 Aspects in Aspect.NET (V. Safonov)
Static approach to AOP very important: it improves program readability Aspects for .NET should be cross-language Using custom attributes (AspectDef, AspectRef) Syntactic sugar: a simple AOP annotations meta-language converted to AOP attributes Aspectizing (classical term – aspect mining): turning non-AOP programs into AOP ones (coloring the aspects) Aspect GUI Aspect.NET site: (C) Vladimir O. Safonov, 2004

8 Other new programming paradigms
Logic programming Functional programming Event-driven programming Generic programming Meta-programming (C) Vladimir O. Safonov, 2004

9 Home task and references to lecture 7
- the main Web site on AOP - the AspectJ Web site Safonov V. O. Aspect.NET – a new approach to aspect-oriented programming. – In: “.NET Developer’s Journal”, 2003, # 4. (C) Vladimir O. Safonov, 2004


Download ppt "Software Engineering Lecture 7"

Similar presentations


Ads by Google