Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion...
-
Upload
lionel-clarke -
Category
Documents
-
view
223 -
download
0
Transcript of Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion...
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! ;)
Problem Statement Complex nature of Software Design Notation
UML Develop a UML Design Tool Implement using Aspect
Technology
Requirements Analysis Create Class Structures Present the Structure
Logical View Diagram View
Support Basic UML Elements Export Images Print Images
Use Cases
Create Model
Manipulate Model
Close Model
Save Model
Load Model
Print Diagram Export Diagram Image
User
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>>
Object-Oriented Design Logical Model Diagram Model Views Tools Managers
TreeViewManager DiagramViewManager
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
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; }}
Other Design Patterns Factory Method
Creating diagram element UIs Observer
Reflecting data model updates to views
Faćade Saving, loading Project Drawing diagram contents
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()
View Updating
TanglingCode
ScatteredConcern
class NodeTool { void handleMouseMove() { ... DiagramViewManager.getInstance().
getCurrentDiagramEditor().repaint(); }}
class AssociationTool { void handleMouseMove() { ... DiagramViewManager.getInstance().
getCurrentDiagramEditor().repaint(); }}
Aspect Code View Updateaspect ViewUpdating {
pointcut updatesView(): call(* tool.*.*(..));
after(): updatesView() { DiagramViewManager.getInstance().
getCurrentDiagramEditor().repaint(); }}
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(); }
Product Version Generation Different Versions
Personal Standard Enterprise
How to develop? Different Source
Trees
Enterprise EditionSource
Personal EditionSource
Standard EditionSource
Changes areunmanageable
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
Product Version Generation Different Versions
Personal Standard Enterprise
How to develop? Different Source
Trees Inline checking Aspects
Aspect Code Version Controlaspect VersionControlling {
pointcut enterpriseOps(): call(* MainFrame.printDiagram()) || call(* MainFrame.exportDiagram());
}
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);
}
}
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());
Aspect Oriented Design Simple, easy to understand design Aspect notation
UML extension mechanism (stereotypes)
VersionControlling
<<pointcut>> enterpriseOps()
<<aspect>>ViewUpdating
<<pointcut>> updatesView()
<<aspect>>
Aspect Specification Using Composition Filters Version Control
versionControl: Error = {
enterpriseEdition => {printDiagram, exportDiagram}, standardEdition ~> {printDiagram, exportDiagram} };
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