Top Banner
Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo
30

Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Dec 26, 2015

Download

Documents

Lionel Clarke
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Outline

Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo

Page 2: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Introduction

Project: UML Class Diagram Drawing Complex Issue

Project Objective Practice Aspect Oriented Design &

Development No problem with Rational! ;)

Page 3: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Problem Statement Complex nature of Software Design Notation

UML Develop a UML Design Tool Implement using Aspect

Technology

Page 4: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Requirements Analysis Create Class Structures Present the Structure

Logical View Diagram View

Support Basic UML Elements Export Images Print Images

Page 5: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

User Interface Prototype

Page 6: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Use Cases

Create Model

Manipulate Model

Close Model

Save Model

Load Model

Print Diagram Export Diagram Image

User

Page 7: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Use Cases

Add Diagram

Manipulate Diagram

Delete Diagram

Add Model Element

Delete Model Element

Manipulate Model Element

User

Add Class

Add Interface

<<extend>>

<<extend>>

Add Stereotype

<<extend>>

Add Package

<<extend>>

Page 8: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Object-Oriented Design Logical Model Diagram Model Views Tools Managers

TreeViewManager DiagramViewManager

Page 9: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Logical Model Composite Pattern

Association(from data)

ClassElement(from data)

InterfaceElement(from data)

Package(from data)

Inheritance(from data)

Dependency(from data)

Aggregation(from data)

UMLModelModelElement

(from data)1..n1 1..n1

Page 10: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Managers - Singleton Pattern

public class Manager {

private static Manager instance = null;

private Manager() { }

public static Manager getInstance() { if (instance == null) { instance = new Manager(); }

return instance; }}

Page 11: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Other Design Patterns Factory Method

Creating diagram element UIs Observer

Reflecting data model updates to views

Faćade Saving, loading Project Drawing diagram contents

Page 12: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Crosscutting Concerns (Aspects)

View Update Product Version Generation

Page 13: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

View Updating Update of views due to model change

Tool<<Interface>>

AssociationTool

handleMouseMove()handleMousePress()handleMouseRelease()

NodeTool

handleMouseMove()handleMousePress()handleMouseRelease()

SelectionTool

handleMouseMove()handleMousePress()handleMouseRelease()

View Updating

CrosscuttingConcern

DiagramEditor

repaint()

Page 14: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

View Updating

TanglingCode

ScatteredConcern

class NodeTool { void handleMouseMove() { ... DiagramViewManager.getInstance().

getCurrentDiagramEditor().repaint(); }}

class AssociationTool { void handleMouseMove() { ... DiagramViewManager.getInstance().

getCurrentDiagramEditor().repaint(); }}

Page 15: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Aspect Code View Updateaspect ViewUpdating {

}

Page 16: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Aspect Code View Updateaspect ViewUpdating {

pointcut updatesView(): call(* tool.*.*(..));

}

Page 17: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Aspect Code View Updateaspect ViewUpdating {

pointcut updatesView(): call(* tool.*.*(..));

after(): updatesView() { DiagramViewManager.getInstance().

getCurrentDiagramEditor().repaint(); }}

Page 18: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

View Updating using AOP Crosscutting is localized

No scattering No tangling Increased modularity

Aspect Code

Base Code

Changes can be easily handled Scenario:

Interface of “DiagramEditor” has changed

Solution: Just need to change the “advice”

code

after(): updatesView() { DiagramViewManager.getInstance(). getCurrentDiagramEditor().repaint(); }

after(): updatesView() { DiagramViewManager.getInstance(). getCurrentDiagramEditor().invalidate(); }

Page 19: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Product Version Generation Different Versions

Personal Standard Enterprise

How to develop? Different Source

Trees

Enterprise EditionSource

Personal EditionSource

Standard EditionSource

Changes areunmanageable

Page 20: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Product Version Generation Different Versions

Personal Standard Enterprise

How to develop? Different Source

Trees Inline checking

public void printDiagram() {

int version = getVersion(); if ( version == ENTERPRISE ) { ... } else if ( version() ==

STANDARD ) { ... } else { ... }

} ScatteredConcern

TanglingCode

Page 21: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Product Version Generation Different Versions

Personal Standard Enterprise

How to develop? Different Source

Trees Inline checking Aspects

Page 22: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Aspect Code Version Controlaspect VersionControlling {

}

Page 23: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Aspect Code Version Controlaspect VersionControlling {

pointcut enterpriseOps(): call(* MainFrame.printDiagram()) || call(* MainFrame.exportDiagram());

}

Page 24: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Aspect Code Version Controlaspect VersionControlling {

pointcut enterpriseOps(): call(* MainFrame.printDiagram()) || call(* MainFrame.exportDiagram());

around(): enterpriseOps() { JOptionPane.showMessageDialog(null,

"This operation is supported in Enterprise Edition.","Warning", JOptionPane.WARNING_MESSAGE);

}

}

Page 25: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Product Version Generation using AOP Crosscutting is localized

No scattering No tangling Increased modularity

Aspect Code

Base Code

Changes can be easily handled Scenario:

Change supported operations in versions

Solution: Just need to change the “pointcut”

pointcut enterpriseOps(): call(* MainFrame.printDiagram()) || call(* MainFrame.exportDiagram());

pointcut enterpriseOps(): call(* MainFrame.layoutDiagram());

Page 26: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Aspect Oriented Design Simple, easy to understand design Aspect notation

UML extension mechanism (stereotypes)

VersionControlling

<<pointcut>> enterpriseOps()

<<aspect>>ViewUpdating

<<pointcut>> updatesView()

<<aspect>>

Page 27: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Aspect Specification Using Composition Filters Version Control

versionControl: Error = {

enterpriseEdition => {printDiagram, exportDiagram}, standardEdition ~> {printDiagram, exportDiagram} };

Page 28: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Conclusion Complex Software Systems Several concerns were crosscut

Not easy to localize, scattering, tangling Reduces modularity

We have overcame these using AOP Design became more modular Changes became more manageable

Page 29: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Demo

Page 30: Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.

Thank You! Questions?