150 likes | 319 Views
Aspect-Oriented Software Development (AOSD) Tutorial #1. Course site : http://webcourse.cs.technion.ac.il/236608/Winter2007-2008/ T.A. : Emilia Katz emika@cs.technion.ac.il Reception hours: Sunday 17:00 – 18:00 Taub 641.
E N D
Aspect-Oriented Software Development (AOSD)Tutorial #1 Course site : http://webcourse.cs.technion.ac.il/236608/Winter2007-2008/ T.A. : Emilia Katz emika@cs.technion.ac.il Reception hours: Sunday 17:00 – 18:00 Taub 641 Aspect-Oriented Software Development (236608)
Tutorial 1: Why aspects? We will see: • Example system • Illustration of tangling and scattering Aspect-Oriented Software Development (236608)
General Remarks Facts about aspects: • Aspects can be identified at different stages of the development cycle • Ideally: “Low impact (non-invasiveness) of changes” Additive changes in requirements additive change in design and code. • Tangling and scattering reduce reusability and traceability, and changes become invasive Aspect-Oriented Software Development (236608)
Example : SEE Software Engineering Environment for programs consisting of expressions Description: • Supports specification of expression programs • Contains set of tools for expressions: • evaluation • display • check (syntactic & semantic correctness) Aspect-Oriented Software Development (236608)
Example : SEE – contd. Development process (simplified): Requirements (in natural language) Design (UML) Implementation (Java) decompose by tool decompose by object Intuition: difference in decompositions causes scattering and tangling! Aspect-Oriented Software Development (236608)
Design for SEE (partial) create() getters setters expression eval() display() check() access/modify apply tools binary operator … unary operator … number … minus … unary plus … unary minus … plus … Aspect-Oriented Software Development (236608)
New Requirements for SEE • Persistence: expressions should be optionally persistent • Style check support: it should be possible to check expressions against multiple styles (fonts, naming conventions, etc.) Aspect-Oriented Software Development (236608)
Adding Persistence • retrieve persistent objects on first access • flush modifications back to database expression scattering access/modify apply tools save tangling binary operator … unary operator … number … minus … unary plus … unary minus … plus … Aspect-Oriented Software Development (236608)
Adding Style Checks expression visitor let 3 style checkers be defined affect display() method access/modify apply tools ch. 1 ch. 2 ch. 3 accept(visitor) instead of check() method binary operator … unary operator … number … minus … unary plus … unary minus … plus … Aspect-Oriented Software Development (236608)
Style Checks + Persistance persistence of style-checkers state information expression visitor access/modify apply tools save ch. 1 ch. 2 ch. 3 accept(visitor) binary operator … unary operator … number … minus … unary plus … unary minus … plus … Aspect-Oriented Software Development (236608)
Adding Persistence as Aspect save() retrieve() flush() persistence asp. expression pointcut definition access/modify advice() apply tools binary operator … unary operator … number … minus … unary plus … unary minus … plus … Aspect-Oriented Software Development (236608)
Crosscutting More than one Hierarchy Example - system for exams in arithmetic Initially, includes exams: • Questions: each question is an expression • Answers: each answer is a number • Grade: grade is calculated based on answers checks (use the “eval()” function of the questions, check equality with the answers, count correct answers percentage) Addition: Persistency of the exams (the whole history)! Aspect-Oriented Software Development (236608)
Adding Persistency - Results Crosscutting more than one class hierarchy? • Expressions (Questions)? • Answers? • Grades? • Exam class? Yes! Crosscutting more than one class hierarchy! ✔ ✔ ✔ ✔ Aspect-Oriented Software Development (236608)
Adding Persistency - Treatment Without aspects – changes in: • Expressions (Questions) • Answers • Grades • Exam as a whole With aspects – Reuse persistency aspect, with changes in: • Pointcut definition [on what classes to be applied, …] • Additional aspect advice (may be unnecessary) Aspect-Oriented Software Development (236608)