©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development.

Slides:



Advertisements
Similar presentations
Chapter 7 System Models.
Advertisements

©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design 1.
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
An Aspect-Oriented Approach For Web Application Access Control Presented by: Mohamed Hassan Carleton University Carleton University
Chapter 21 - Aspect-oriented Software Development Lecture 1 1 Chapter 21 Aspect-oriented software engineering.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 17 Slide 1 Rapid software development.
Figures – Chapter 21. Figure 21.1 Cross-cutting concerns.
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 8 Slide 1 System models.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 30 Slide 1 Security Engineering.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
©Ian Sommerville 2000Software Engineering, 6/e, Chapter 71 System models l Abstract descriptions of systems whose requirements are being analysed.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented design 2.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
Overview of Software Requirements
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development 2.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 5 Slide 1 Requirements engineering l The process of establishing the services that the.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 17 Slide 1 Rapid software development.
Architectural Design Establishing the overall structure of a software system Objectives To introduce architectural design and to discuss its importance.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 11 Slide 1 Architectural Design.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 11 Slide 1 Architectural Design.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 System models l Abstract descriptions of systems whose requirements are being.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 17 Slide 1 Extreme Programming.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse 2.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 31 Slide 1 Service-centric Software Engineering 2.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 18 Slide 1 Software Reuse.
Software Engineering Muhammad Fahad Khan
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 30 Slide 1 Security Engineering 1.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 System models l Abstract descriptions of systems whose requirements are being.
Chapter 4 System Models A description of the various models that can be used to specify software systems.
System models Abstract descriptions of systems whose requirements are being analysed Abstract descriptions of systems whose requirements are being analysed.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 10Slide 1 Chapter 10 Architectural Design.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 6 Slide 1 Software Requirements.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 6 Slide 1 Requirements Engineering Processes l Processes used to discover, analyse and.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 4 Slide 1 Software Processes.
©Ian Sommerville 2000 Software Engineering, 6th edition. Slide 1 Component-based development l Building software from reusable components l Objectives.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 1 Slide 1 Software Engineering The first lecture.
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 10Slide 1 Architectural Design l Establishing the overall structure of a software system.
©Ian Sommerville 1995/2000 (Modified by Spiros Mancoridis 1999) Software Engineering, 6th edition. Chapter 7 Slide 1 System models l Abstract descriptions.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development 1.
Chapter 7 System models.
System models l Abstract descriptions of systems whose requirements are being analysed.
Modified by Juan M. Gomez Software Engineering, 6th edition. Chapter 7 Slide 1 Chapter 7 System Models.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
Sommerville 2004,Mejia-Alvarez 2009Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Chapter 10 Analysis and Design Discipline. 2 Purpose The purpose is to translate the requirements into a specification that describes how to implement.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 Chapter 7 System Models.
FDT Foil no 1 On Methodology from Domain to System Descriptions by Rolv Bræk NTNU Workshop on Philosophy and Applicablitiy of Formal Languages Geneve 15.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 18 Slide 1 Software Reuse.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Defect testing l Testing programs to establish the presence of system defects.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 7 Slide 1 Requirements Engineering Processes.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Slide 1 Service-centric Software Engineering. Slide 2 Objectives To explain the notion of a reusable service, based on web service standards, that provides.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 4 Slide 1 Software Processes.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Aspect-Oriented Software Development (AOSD)
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 19Slide 1 Verification and Validation l Assuring that a software system meets a user's.
Engineering, 7th edition. Chapter 8 Slide 1 System models.
Software Reuse. Objectives l To explain the benefits of software reuse and some reuse problems l To discuss several different ways to implement software.
Service-centric Software Engineering
Software testing.
Presentation transcript:

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 2 Objectives l To explain the principle of separation of concerns in software development l To introduce the fundamental ideas underlying aspect-oriented development l To show how an aspect-oriented approach can be used at all stages of development l To discuss problems of testing aspect-oriented systems

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 3 Topics covered The separation of concerns Aspects, join points and pointcuts Software engineering with aspects

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 4 Aspect-oriented software development l An approach to software development based around a new type of abstraction - an aspect. l Used in conjunction with other approaches - normally object-oriented software engineering. l Aspects encapsulate functionality that cross-cuts and co-exists with other functionality. l Aspects include a definition of where they should be included in a program as well as code implementing the cross-cutting concern.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 5 The separation of concerns l The principle of separation of concerns states that software should be organised so that each program element does one thing and one thing only. l Each program element should therefore be understandable without reference to other elements. l Program abstractions (subroutines, procedures, objects, etc.) support the separation of concerns.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 6 Concerns l Concerns are not program issues but reflect the system requirements and the priorities of the system stakeholders. Examples of concerns are performance, security, specific functionality, etc. l By reflecting the separation of concerns in a program, there is clear traceability from requirements to implementation. l Core concerns are the functional concerns that relate to the primary purpose of a system; secondary concerns are functional concerns that reflect non-functional and QoS requirements.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 7 Stakeholder concerns l Functional concerns which are related to specific functionality to be included in a system. l Quality of service concerns which are related to the non-functional behaviour of a system. l Policy concerns which are related to the overall policies that govern the use of the system. l System concerns which are related to attributes of the system as a whole such as its maintainability or its configurability. l Organisational concerns which are related to organisational goals and priorities such as producing a system within budget, making use of existing software assets or maintaining the reputation of an organisation.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 8 Cross-cutting concerns l Cross-cutting concerns are concerns whose implementation cuts across a number of program components. l This results in problems when changes to the concern have to be made - the code to be changed is not localised but is in different places across the system. l Cross cutting concerns lead to tangling and scattering.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 9 Cross-cutting concerns

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 10 Tangling

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 11 Scattering

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 12 Aspects, join points and pointcuts l An aspect is an abstraction which implements a concern. It includes information where it should be included in a program. l A join point is a place in a program where an aspect may be included (woven). l A pointcut defines where (at which join points) the aspect will be included in the program.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 13 Aspect terminology

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 14 An authentication aspect

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 15 AspectJ - join point model l Call events Calls to a method or constructor l Execution events Execution of a method or constructor l Initialisation events Class or object initialisation l Data events Accessing or updating a field l Exception events The handling of an exception

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 16 Pointcuts l Identifies the specific events with which advice should be associated. l Examples of contexts where advice can be woven into a program Before the execution of a specific method After the normal or exceptional return from a method When a field in an object is modified

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 17 Aspect weaving l Aspect weavers process source code and weave the aspects into the program at the specified pointcuts. l Three approaches to aspect weaving Source code pre-processing Link-time weaving Dynamic, execution-time weaving

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 18 Aspect weaving

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 19 Software engineering with aspects l Aspects were introduced as a programming concept but, as the notion of concerns comes from requirements, an aspect oriented approach can be adopted at all stages in the system development process. l The architecture of an aspect-oriented system is based around a core system plus extensions. l The core system implements the primary concerns. Extensions implement secondary and cross-cutting concerns.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 20 Core system + extensions

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 21 Types of extension l Secondary functional extensions Add extra functional capabilities to the core system l Policy extensions Add functional capabilities to support an organisational policy such as security l QoS extensions Add functional capabilities to help attain quality of service requirements l Infrastructure extensions Add functional capabilities to support the implementation of the system on some platform

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 22 Concern-oriented requirements engineering l An approach to requirements engineering that focuses on customer concerns is consistent with aspect-oriented software development. l Viewpoints (discussed in Chapter 7) are a way to separate the concerns of different stakeholders. l Viewpoints represent the requirements of related groups of stakeholders. l Cross-cutting concerns are concerns that are identified by all viewpoints.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 23 Viewpoints and Concerns

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 24 Viewpoints on an inventory system

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 25 Availability requirements

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 26 Inventory system - core requirements l C.1 The system shall allow authorised users to view the description of any item of equipment in the emergency services inventory. l C.2 The system shall include a search facility to allow authorised users to search either individual inventories or the complete inventory for a specific item or type of equipment.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 27 Inventory system - extension requirements l E1.1 It shall be possible for authorised users to place orders with accredited suppliers for replacement items of equipment. l E1.1.1 When an item of equipment is ordered, it should be allocated to a specific inventory and flagged in that inventory as ‘on order’.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 28 Aspect-oriented design/programming l Aspect-oriented design The process of designing a system that makes use of aspects to implement the cross-cutting concerns and extensions that are identified during the requirements engineering process. l Aspect-oriented programming The implementation of an aspect-oriented design using an aspect-oriented programming language such as AspectJ.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 29 Use-cases l A use-case approach can serve as a basis for aspect-oriented software engineering. l Each use case represents an aspect. Extension use cases naturally fit the core + extensions architectural model of a system l Jacobsen and Ng develop these ideas of using use-cases by introducing new concepts such as use-case slices and use case modules.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 30 An extension use case

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 31 Inventory use cases

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 32 Inventory extension use-case

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 33 An AOSD process

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 34 UML extensions l Expressing an aspect oriented design in the UML requires: A means of modelling aspects using UML stereotypes. A means of specifying the join points where the aspect advice is to be composed with the core system.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 35 An aspect-oriented design model

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 36 A partial model of an aspect

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 37 Verification and validation l The process of demonstrating that a program meets it specification (verification) and meets the real needs of its stakeholders (validation) l Like any other systems,aspect-oriented systems can be tested as black-boxes using the specification to derive the tests l However, program inspections and ‘white-box’ testing that relies on the program source code is problematic. l Aspects also introduce additional testing problems

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 38 Testing problems with aspects l How should aspects be specified so that tests can be derived? l How can aspects be tested independently of the base system? l How can aspect interference be tested? l How can tests be designed so that all join points are executed and appropriate aspect tests applied?

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 39 Program inspection problems l To inspect a program (in a conventional language) effectively, you should be able to read it from right to left and top to bottom. l Aspects make this impossible as the program is a web rather than a sequential document. You can’t tell from the source code where an aspect will be woven and executed. l Flattening an aspect-oriented program for reading is practically impossible.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 40 White box testing l The aim of white box testing is to use source code knowledge to design tests that provide some level of program coverage e.g. each logical branch in a program should be executed at least once. l Aspect problems How can source code knowledge be used to derive tests? What exactly does test coverage mean?

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 41 Aspect problems l Deriving a program flow graph of a program with aspects is impossible. It is therefore difficult to design tests systematically that ensure that all combinations of base code and aspects are executed. l What does test coverage mean? Code of each aspect executed once? Code of each aspect exeucted once at each join point where aspect woven? ???

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 42 Key points l The key benefit of an aspect-oriented approach is that it supports the separation of concerns. l Tangling occurs when a module implements several requirements; Scattering occurs when the implementation of a single concern is spread across several components. l Systems may be designed as a core system with extensions to implement secondary concerns.

©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 43 Key points l To identify concerns, you may use a viewpoint- oriented approach to requirements engineering. l The transition from requirements to design may be made using use-cases where each use-case represents a stakeholder concern. l The problems of inspecting and deriving tests for aspect-oriented programs are a significant barrier to the adoption of AOSD.