Related Papers
- N. Tsantalis, A. Chatzigeorgiou, G. Stephanides, S. T. Halkidis, "Design Pattern Detection Using Similarity Scoring", IEEE Transactions on Software Engineering, vol. 32, no. 11, pp. 896-909, November, 2006.
- A. Chatzigeorgiou, N. Tsantalis, G. Stephanides, "Application of Graph Theory to OO Software Engineering", 2nd International Workshop on Interdisciplinary Software Engineering Research (WISER'2006), Shanghai, China, May 20, 2006.
Installation
-
Install Java™ 2 Runtime Environment, Standard Edition 1.5.0
You can download it from http://java.com/en/index.jsp -
Download the Design Pattern detection Tool (version 4.5 - build 28/05/2010)
In order to avoid Heap size OutOfMemoryError, execute in console java -Xms32m -Xmx512m -jar pattern4.jar
Usage
- You must first select the root of the project package. Only class files (bytecode files) are necessary for the project analysis.
- Then select the pattern(s) to be detected from the pattern list.
- You can use some of the Huston design pattern Java demos for testing the tool.
Proxy Variation
The design pattern reported by the tool as Proxy2 is actually a variation of Proxy pattern.However, this Proxy variation is structurally more similar to Decorator pattern than Proxy pattern, since Proxy role has an association to Subject role (named subject) and method Request() declared in Proxy invokes an abstract method having the same signature through subject association (as exactly happens between Decorator and Component roles in Decorator pattern).
The differences between Decorator pattern and this Proxy variation are: a) Decorator role is abstract while Proxy role is concrete, b) Proxy role initializes its association to Subject role with a reference to an object of RealSubject role which is instantiated inside the constructor of Proxy role.
This kind of Proxy variation has been reported by Günter Kniesel and Alex Binun from University of Bonn.
ChangeLog
- Fixed a bug related with the handling of composite generic types
(bug reported by Lin-Chieh Wen from the Dept. of Information Engineering
& Computer Science, Feng Chia University, Tai-Chung, Taiwan,
R.O.C.) (version 4.5)
- Report of additional pattern roles corresponding to methods and fields (version 4.4)
- The Subject role in Observer pattern should also contain a detach method used for unregistering Observers (version 4.3)
- In Visitor pattern visitConcreteElement methods may also have Element type as parameter instead of ConcreteElement types (version 4.2)
- Array types are included in the analysis for the identification of Composite and Observer pattern instances (version 4.1)
- Fixed the problem concerning the distinction of Observer from Composite pattern (version 4)
- Add support for Proxy design pattern (version 4)
- Export detected design pattern instances to XML format (version 2)
- Detection of all design patterns with a single click (version 2)
- Console version (version 2)
Execution: java -Xms32m -Xmx512m -jar pattern4.jar -target "C:\foo\myclasses" -output "C:\foo\output.xml"
Detected Design Patterns in JHotDraw 5.1
| Design Pattern Name | Roles and Corresponding Classes | |
|---|---|---|
| * Last updated on April 1st 2009 | ||
| Object Adapter- Command |
Adapter/ConcreteCommand | Adaptee/Receiver |
| CH.ifa.draw.standard.AbstractFigure adaptee: FigureChangeListener fListener Request(): release, invalidate, changed Target role is played by class CH.ifa.draw.framework.Figure |
CH.ifa.draw.framework.FigureChangeListener SpecificRequest(): figureRemoved, figureInvalidated, figureChanged |
|
| CH.ifa.draw.figures.RadiusHandle adaptee: RoundRectangleFigure fOwner Request(): locate Target role is played by class CH.ifa.draw.standard.AbstractHandle |
CH.ifa.draw.figures.RoundRectangleFigure SpecificRequest(): getArc, displayBox |
|
| CH.ifa.draw.figures.GroupCommand receiver: DrawingView fView Execute(): execute Command role is played by class CH.ifa.draw.util.Command |
CH.ifa.draw.framework.DrawingView Action(): selectionZOrdered, drawing, clearSelection, addToSelection(Figure), checkDamage |
|
| CH.ifa.draw.figures.InsertImageCommand receiver: DrawingView fView Execute(): execute Command role is played by class CH.ifa.draw.util.Command |
CH.ifa.draw.framework.DrawingView Action(): lastClick, add(Figure), clearSelection, addToSelection(Figure), checkDamage |
|
| CH.ifa.draw.figures.UngroupCommand receiver: DrawingView fView Execute(): execute Command role is played by class CH.ifa.draw.util.Command |
CH.ifa.draw.framework.DrawingView Action(): selectionElements, clearSelection, drawing, addToSelection(Figure), checkDamage |
|
| CH.ifa.draw.standard.AlignCommand receiver: DrawingView fView Execute(): execute Command role is played by class CH.ifa.draw.util.Command |
CH.ifa.draw.framework.DrawingView Action(): selectionElements, checkDamage |
|
| CH.ifa.draw.standard.BringToFrontCommand receiver: DrawingView fView Execute(): execute Command role is played by class CH.ifa.draw.util.Command |
CH.ifa.draw.framework.DrawingView Action(): selectionZOrdered, drawing, checkDamage |
|
| CH.ifa.draw.standard.ChangeAttributeCommand receiver: DrawingView fView Execute(): execute Command role is played by class CH.ifa.draw.util.Command |
CH.ifa.draw.framework.DrawingView Action(): selectionElements, checkDamage |
|
| CH.ifa.draw.standard.SendToBackCommand receiver: DrawingView fView Execute(): execute Command role is played by class CH.ifa.draw.util.Command |
CH.ifa.draw.framework.DrawingView Action(): selectionZOrdered, drawing, checkDamage |
|
| CH.ifa.draw.standard.ToggleGridCommand receiver: DrawingView fView Execute(): execute Command role is played by class CH.ifa.draw.util.Command |
CH.ifa.draw.framework.DrawingView Action(): getConstrainer, setConstrainer(PointConstrainer) |
|
| CH.ifa.draw.figures.TextFigure adaptee: OffsetLocator fLocator Request(): moveBy Target role is played by class CH.ifa.draw.standard.AbstractFigure |
CH.ifa.draw.standard.OffsetLocator SpecificRequest(): moveBy |
|
| CH.ifa.draw.standard.AbstractTool adaptee: DrawingView fView Request(): activate, deactivate Target role is played by class CH.ifa.draw.framework.Tool |
CH.ifa.draw.framework.DrawingView SpecificRequest(): clearSelection, setCursor(Cursor) |
|
| CH.ifa.draw.figures.LineConnection adaptee: Connector fStart, Connector fEnd Request(): updateConnection Target role is played by class CH.ifa.draw.framework.ConnectionFigure |
CH.ifa.draw.framework.Connector SpecificRequest(): findStart(ConnectionFigure), findEnd(ConnectionFigure) |
|
| CH.ifa.draw.standard.AbstractConnector adaptee: Figure fOwner Request(): displayBox, containsPoint Target role is played by class CH.ifa.draw.framework.Connector |
CH.ifa.draw.framework.Figure SpecificRequest(): displayBox, containsPoint |
|
| CH.ifa.draw.applet.DrawApplet adaptee: ToolButton fDefaultToolButton Request(): toolDone Target role is played by class CH.ifa.draw.framework.DrawingEditor adaptee: ToolButton fSelectedToolButton Request(): paletteUserOver Target role is played by class CH.ifa.draw.util.PaletteListener |
CH.ifa.draw.standard.ToolButton SpecificRequest(): name, tool |
|
| CH.ifa.draw.application.DrawApplication adaptee: ToolButton fDefaultToolButton Request(): toolDone Target role is played by class CH.ifa.draw.framework.DrawingEditor adaptee: ToolButton fSelectedToolButton Request(): paletteUserOver Target role is played by class CH.ifa.draw.util.PaletteListener |
CH.ifa.draw.standard.ToolButton SpecificRequest(): name, tool |
|
| CH.ifa.draw.standard.StandardDrawingView adaptee: Drawing fDrawing Request(): drawDrawing, setDrawing Target role is played by class CH.ifa.draw.framework.DrawingView adaptee: Drawing drawing() Request(): add(Figure), remove(Figure), freezeView, unfreezeView, selectionZOrdered |
CH.ifa.draw.framework.Drawing SpecificRequest(): draw, removeDrawingChangeListener, addDrawingChangeListener SpecificRequest(): add(Figure), remove(Figure), lock, unlock, figures |
|
| CH.ifa.draw.standard.StandardDrawingView adaptee: DrawingEditor fEditor Request(): tool Target role is played by class CH.ifa.draw.framework.DrawingView |
CH.ifa.draw.framework.DrawingEditor SpecificRequest(): tool |
|
| CH.ifa.draw.contrib.PolygonHandle adaptee: Locator fLocator Request(): locate Target role is played by class CH.ifa.draw.standard.AbstractHandle |
CH.ifa.draw.framework.Locator SpecificRequest(): locate(Figure) |
|
| CH.ifa.draw.standard.LocatorHandle adaptee: Locator fLocator Request(): locate Target role is played by class CH.ifa.draw.standard.AbstractHandle |
CH.ifa.draw.framework.Locator SpecificRequest(): locate(Figure) |
|
| CH.ifa.draw.standard.ToolButton adaptee: PaletteIcon fIcon Request(): paintNormal, paintPressed, paintSelected Target role is played by class CH.ifa.draw.util.PaletteButton |
CH.ifa.draw.util.PaletteIcon SpecificRequest(): normal, pressed, selected |
|
| CH.ifa.draw.standard.StandardDrawingView adaptee: Painter fUpdateStrategy Request(): paint(Graphics) Target role is played by class CH.ifa.draw.framework.DrawingView |
CH.ifa.draw.framework.Painter SpecificRequest(): draw(Graphics, DrawingView) |
|
| CH.ifa.draw.standard.ReverseFigureEnumerator adaptee: ReverseVectorEnumerator fEnumeration Request(): hasMoreElements, nextElement, nextFigure Target role is played by class CH.ifa.draw.framework.FigureEnumeration |
CH.ifa.draw.util.ReverseVectorEnumerator SpecificRequest(): hasMoreElements, nextElement |
|
| Composite | Component | Composite |
| CH.ifa.draw.framework.Figure | CH.ifa.draw.standard.CompositeFigure children: Vector fFigures Add(Component): add(Figure) Remove(Component): remove(Figure) Operation(): draw |
|
| Decorator | Component | Decorator |
| CH.ifa.draw.framework.Locator | CH.ifa.draw.standard.OffsetLocator component: Locator fBase Operation(): locate(Figure) |
|
| CH.ifa.draw.framework.Figure | CH.ifa.draw.standard.DecoratorFigure component: Figure fComponent Operation(): displayBox, basicDisplayBox, draw, handles |
|
| CH.ifa.draw.framework.Tool | CH.ifa.draw.standard.SelectionTool component: Tool fChild Operation(): mouseDown, mouseDrag, mouseUp |
|
| Factory Method | Creator | |
| CH.ifa.draw.framework.DrawingView FactoryMethod(): selectionElements, getFigureSelection ConcreteCreator role is played by class CH.ifa.draw.standard.StandardDrawingView |
||
| CH.ifa.draw.framework.Figure FactoryMethod(): figures, decompose, connectorAt ConcreteCreator role is played by class CH.ifa.draw.standard.AbstractFigure |
||
| Observer | Subject | Observer |
| CH.ifa.draw.standard.StandardDrawing observers: Vector fListeners Attach(Observer): addDrawingChangeListener Detach(Observer): removeDrawingChangeListener Notify(): figureInvalidated, figureRequestUpdate |
CH.ifa.draw.framework.DrawingChangeListener Update(): drawingInvalidated, drawingRequestUpdate |
|
| CH.ifa.draw.standard.StandardDrawingView observers: Vector fBackgrounds, Vector fForegrounds Attach(Observer): addBackground, addForeground Detach(Observer): removeBackground, removeForeground Notify(): drawAll -> drawPainters |
CH.ifa.draw.framework.Painter Update(): draw |
|
| CH.ifa.draw.standard.StandardDrawingView observers: Vector fSelection Attach(Observer): addToSelection Detach(Observer): removeFromSelection Notify(): keyPressed -> handleCursorKey -> moveSelection |
CH.ifa.draw.framework.Figure Update(): moveBy |
|
| Prototype | Client | Prototype |
| CH.ifa.draw.standard.ConnectionHandle prototype: ConnectionFigure fPrototype Operation(): createConnection |
CH.ifa.draw.framework.Figure | |
| CH.ifa.draw.standard.ConnectionTool prototype: ConnectionFigure fPrototype Operation(): createConnection |
CH.ifa.draw.framework.Figure | |
| CH.ifa.draw.standard.CreationTool prototype: Figure fPrototype Operation(): createFigure |
CH.ifa.draw.framework.Figure | |
| Singleton | Singleton | |
| CH.ifa.draw.util.Clipboard uniqueInstance: static Clipboard fgClipboard |
||
| CH.ifa.draw.util.Iconkit uniqueInstance: static Iconkit fgIconkit Instance(): instance |
||
| State-Strategy | Context | State/Strategy |
| CH.ifa.draw.standard.AbstractFigure | CH.ifa.draw.framework.FigureChangeListener | |
| CH.ifa.draw.standard.ChangeConnectionHandle CH.ifa.draw.standard.ConnectionHandle |
CH.ifa.draw.framework.Figure | |
| CH.ifa.draw.figures.GroupCommand CH.ifa.draw.figures.InsertImageCommand CH.ifa.draw.figures.UngroupCommand CH.ifa.draw.standard.AlignCommand CH.ifa.draw.standard.BringToFrontCommand CH.ifa.draw.standard.ChangeAttributeCommand CH.ifa.draw.standard.FigureTransferCommand CH.ifa.draw.standard.SendToBackCommand CH.ifa.draw.standard.ToggleGridCommand |
CH.ifa.draw.framework.DrawingView | |
| CH.ifa.draw.applet.DrawApplet CH.ifa.draw.application.DrawApplication |
CH.ifa.draw.framework.Tool | |
| CH.ifa.draw.standard.AbstractTool | CH.ifa.draw.framework.DrawingView | |
| CH.ifa.draw.standard.ChangeConnectionHandle CH.ifa.draw.standard.ConnectionHandle |
CH.ifa.draw.framework.ConnectionFigure | |
| CH.ifa.draw.samples.javadraw.URLTool CH.ifa.draw.standard.ConnectionTool CH.ifa.draw.standard.CreationTool CH.ifa.draw.standard.DragTracker |
CH.ifa.draw.framework.Figure | |
| CH.ifa.draw.standard.AbstractConnector | CH.ifa.draw.framework.Figure | |
| CH.ifa.draw.figures.LineConnection | CH.ifa.draw.framework.Connector | |
| CH.ifa.draw.util.CommandButton | CH.ifa.draw.util.Command | |
| CH.ifa.draw.standard.SelectionTool | CH.ifa.draw.framework.Tool | |
| CH.ifa.draw.util.PaletteButton | CH.ifa.draw.util.PaletteListener | |
| CH.ifa.draw.standard.StandardDrawingView | CH.ifa.draw.framework.Drawing | |
| CH.ifa.draw.figures.LineConnection | CH.ifa.draw.framework.Connector | |
| CH.ifa.draw.standard.StandardDrawingView | CH.ifa.draw.framework.Drawing | |
| CH.ifa.draw.standard.StandardDrawingView | CH.ifa.draw.framework.DrawingEditor | |
| CH.ifa.draw.contrib.PolygonHandle CH.ifa.draw.standard.LocatorHandle |
CH.ifa.draw.framework.Locator | |
| CH.ifa.draw.standard.ConnectionTool | CH.ifa.draw.framework.ConnectionFigure | |
| CH.ifa.draw.samples.javadraw.Animator | CH.ifa.draw.framework.DrawingView | |
| CH.ifa.draw.applet.DrawApplet CH.ifa.draw.application.DrawApplication |
CH.ifa.draw.framework.Drawing | |
| CH.ifa.draw.figures.TextTool | CH.ifa.draw.standard.TextHolder | |
| CH.ifa.draw.standard.StandardDrawingView | CH.ifa.draw.framework.Painter | |
| CH.ifa.draw.figures.PolyLineFigure | CH.ifa.draw.figures.LineDecoration | |
| CH.ifa.draw.standard.ChangeConnectionHandle | CH.ifa.draw.framework.Connector | |
| CH.ifa.draw.standard.StandardDrawingView | CH.ifa.draw.framework.PointConstrainer | |
| CH.ifa.draw.standard.HandleTracker | CH.ifa.draw.framework.Handle | |
| CH.ifa.draw.standard.ConnectionTool | CH.ifa.draw.framework.Connector | |
| CH.ifa.draw.standard.LocatorConnector | CH.ifa.draw.framework.Locator | |
| CH.ifa.draw.samples.javadraw.Animator | CH.ifa.draw.util.Animatable | |
| Template Method | AbstractClass | |
| CH.ifa.draw.standard.AbstractFigure TemplateMethod(): moveBy, displayBox(Point, Point), size, containsPoint, invalidate, center PrimitiveOperation(): basicMoveBy, basicDisplayBox, displayBox() moveBy -> {basicMoveBy } displayBox(Point origin, Point corner) -> {basicDisplayBox } size, containsPoint, invalidate, center -> {displayBox() } |
||
| CH.ifa.draw.standard.AbstractHandle TemplateMethod(): displayBox PrimitiveOperation(): locate |
||
| CH.ifa.draw.standard.ActionTool TemplateMethod(): mouseDown PrimitiveOperation(): action |
||
| CH.ifa.draw.standard.ChangeConnectionHandle TemplateMethod(): source, invokeStart, invokeStep, invokeEnd PrimitiveOperation(): target, disconnect, connect, setPoint source -> {target } invokeStart -> {target, disconnect } invokeStep -> {setPoint } invokeEnd -> {setPoint, connect } |
||
| CH.ifa.draw.util.PaletteButton TemplateMethod(): paint PrimitiveOperation(): paintBackground, paintPressed, paintSelected, paintNormal |
||
Detected Design Patterns in JRefactory 2.6.24
| Design Pattern Name | Roles and Corresponding Classes | |
|---|---|---|
| * Last updated on April 1st 2009 | ||
| Object Adapter- Command |
Adapter/ConcreteCommand | Adaptee/Receiver |
| org.acm.seguin.refactor.type.ExtractInterfaceRefactoring | org.acm.seguin.refactor.ComplexTransform | |
| org.acm.seguin.refactor.EliminatePackageImportVisitor | org.acm.seguin.summary.PackageSummary | |
| org.acm.seguin.refactor.type.RemoveEmptyClassRefactoring | org.acm.seguin.summary.TypeSummary | |
| org.acm.seguin.refactor.method.RenameParameterRefactoring | org.acm.seguin.summary.MethodSummary | |
| org.acm.seguin.refactor.AddImportTransform | org.acm.seguin.parser.ast.ASTName | |
| org.acm.seguin.refactor.type.ChangePackageTransform | org.acm.seguin.parser.ast.ASTName | |
| org.acm.seguin.pretty.PrettyPrintVisitor | org.acm.seguin.pretty.FieldSizeLookAhead | |
| org.acm.seguin.pretty.PrettyPrintVisitor | org.acm.seguin.pretty.LocalVariableLookAhead | |
| org.acm.seguin.metrics.TextReport | org.acm.seguin.util.TextFormatter | |
| org.acm.seguin.uml.refactor.ExtractMethodDialog | org.acm.seguin.refactor.method.ExtractMethodRefactoring | |
| org.acm.seguin.uml.refactor.ExtractMethodDialog | org.acm.seguin.awt.OrderableList | |
| org.acm.seguin.uml.refactor.MoveMethodDialog | org.acm.seguin.uml.refactor.ParameterPanel | |
| org.acm.seguin.tools.stub.StubGenTraversal | org.acm.seguin.tools.stub.StubFile | |
| org.acm.seguin.print.text.TextPagePrinter | org.acm.seguin.print.text.LineSet | |
| org.acm.seguin.uml.refactor.RenameParameterDialog | org.acm.seguin.summary.MethodSummary | |
| org.acm.seguin.uml.refactor.RenameClassDialog | org.acm.seguin.summary.TypeSummary | |
| org.acm.seguin.uml.UMLPackage | org.acm.seguin.uml.line.SegmentedLine | |
| org.acm.seguin.uml.print.UMLPagePrinter | org.acm.seguin.uml.UMLPackage | |
| org.acm.seguin.summary.SummaryTraversal | org.acm.seguin.summary.load.LoadStatus | |
| org.acm.seguin.metrics.GatherData | org.acm.seguin.metrics.MetricsReport | |
| org.acm.seguin.print.text.TextPagePrinter | org.acm.seguin.print.text.LinePrinter | |
| org.acm.seguin.summary.load.SwingLoadStatus | org.acm.seguin.tools.install.RefactoryStorage | |
| org.acm.seguin.metrics.MethodMetricsFrame | org.acm.seguin.summary.MethodSummary | |
| org.acm.seguin.metrics.PackageMetricsFrame | org.acm.seguin.summary.PackageSummary | |
| org.acm.seguin.metrics.TypeMetricsFrame | org.acm.seguin.summary.TypeSummary | |
| org.acm.seguin.uml.UMLPackage | org.acm.seguin.summary.PackageSummary | |
| Factory Method | Creator | |
| org.acm.seguin.refactor.type.TypeChangeVisitor FactoryMethod(): getFileSpecificTransform, getNewImports, getRemoveImportTransform ConcreteCreator role is played by classes EliminatePackageImportVisitor, MoveClassVisitor, RenameClassVisitor |
||
| Observer | Subject | Observer |
| org.acm.seguin.refactor.ComplexTransform observers: ArrayList transforms Attach(Observer): add(TransformAST) Detach(): clear Notify(): apply |
org.acm.seguin.refactor.TransformAST Update(): update |
|
| Singleton | Singleton | |
| org.acm.seguin.ide.command.PackageSelectorPanel uniqueInstance: static PackageSelectorPanel mainPanel Instance(): getMainPanel |
||
| org.acm.seguin.ide.common.action.CurrentSummary uniqueInstance: static CurrentSummary singleton Instance(): get |
||
| org.acm.seguin.ide.common.EditorOperations uniqueInstance: static EditorOperations singleton Instance(): get |
||
| org.acm.seguin.ide.common.PackageListFilter uniqueInstance: static PackageListFilter singleton Instance(): get |
||
| org.acm.seguin.ide.common.SourceBrowser uniqueInstance: static SourceBrowser singleton Instance(): get |
||
| org.acm.seguin.ide.jbuilder.RefactoryNodeViewerFactory uniqueInstance: static RefactoryNodeViewerFactory factory Instance(): getFactory |
||
| org.acm.seguin.ide.jbuilder.UMLNodeViewerFactory uniqueInstance: static UMLNodeViewerFactory factory Instance(): getFactory |
||
| org.acm.seguin.pretty.ai.RequiredTags uniqueInstance: static RequiredTags tags Instance(): getTagger |
||
| org.acm.seguin.refactor.RefactoringFactory uniqueInstance: static RefactoringFactory singleton Instance(): get |
||
| org.acm.seguin.refactor.undo.UndoStack uniqueInstance: static UndoStack singleton Instance(): get |
||
| org.acm.seguin.uml.line.LabelSizeComputation uniqueInstance: static LabelSizeComputation singleton Instance(): get |
||
| org.acm.seguin.version.VersionControlCache uniqueInstance: static VersionControlCache ssc Instance(): getCache |
||
| State- Strategy |
Context | State/Strategy |
| org.acm.seguin.parser.ast.SimpleNode org.acm.seguin.pretty.PrettyPrintVisitor org.acm.seguin.refactor.method.EMParameterFinder |
org.acm.seguin.parser.Node | |
| org.acm.seguin.parser.ast.SimpleNode | org.acm.seguin.parser.JavaParserVisitor | |
| org.acm.seguin.refactor.field.RenameFieldData | org.acm.seguin.summary.Summary | |
| org.acm.seguin.summary.ImportSummary org.acm.seguin.summary.MethodSummary org.acm.seguin.summary.TypeSummary org.acm.seguin.summary.VariableSummary |
org.acm.seguin.summary.SummaryVisitor | |
| org.acm.seguin.refactor.method.MoveMethodRefactoring | org.acm.seguin.summary.Summary | |
| org.acm.seguin.refactor.AddImportTransform | org.acm.seguin.parser.Node | |
| org.acm.seguin.parser.ast.ASTClassDeclaration org.acm.seguin.parser.ast.ASTConstructorDeclaration org.acm.seguin.parser.ast.ASTFieldDeclaration org.acm.seguin.parser.ast.ASTInterfaceDeclaration org.acm.seguin.parser.ast.ASTMethodDeclaration org.acm.seguin.parser.ast.ASTNestedClassDeclaration org.acm.seguin.parser.ast.ASTNestedInterfaceDeclaration org.acm.seguin.parser.ast.ASTPackageDeclaration |
org.acm.seguin.parser.JavaParserVisitor | |
| org.acm.seguin.refactor.method.MoveMethodVisitor | org.acm.seguin.summary.Summary | |
| org.acm.seguin.uml.line.DragPanelAdapter | org.acm.seguin.uml.line.EndPointPanel | |
| org.acm.seguin.uml.SaveMenuSelection | org.acm.seguin.io.Saveable | |
| org.acm.seguin.uml.line.DragPanelAdapter | org.acm.seguin.uml.line.LinedPanel | |
| org.acm.seguin.uml.line.LineMouseAdapter | org.acm.seguin.uml.line.LinedPanel | |
| org.acm.seguin.ide.common.SourceBrowserAdapter | org.acm.seguin.uml.ISourceful | |
| org.acm.seguin.uml.loader.ReloaderSingleton | org.acm.seguin.uml.loader.Reloader | |
| org.acm.seguin.refactor.method.ExtractMethodRefactoring | org.acm.seguin.parser.Node | |
| org.acm.seguin.refactor.ComplexTransform | org.acm.seguin.refactor.TransformAST | |
| org.acm.seguin.ide.common.action.RefactoringAction | org.acm.seguin.ide.common.action.SelectedFileSet | |
| org.acm.seguin.uml.UMLLine | org.acm.seguin.uml.UMLIcon | |
| org.acm.seguin.ide.elixir.version.ElixirContainsThread org.acm.seguin.ide.elixir.version.ElixirVersionControlThread |
org.acm.seguin.version.VersionControl | |
| org.acm.seguin.uml.line.SegmentedLine | org.acm.seguin.uml.line.EndPointPanel | |
| org.acm.seguin.summary.SummaryTraversal org.acm.seguin.summary.FrameworkFileSummaryLoader |
org.acm.seguin.summary.load.LoadStatus | |
| org.acm.seguin.summary.SummaryTraversal | org.acm.seguin.summary.FrameworkLoader | |
| org.acm.seguin.pretty.sort.MultipleOrdering | org.acm.seguin.pretty.sort.Ordering | |
| org.acm.seguin.pretty.sort.MultipleOrdering | org.acm.seguin.util.Settings | |
| Template Method | AbstractClass | |
| org.acm.seguin.ide.common.action.CurrentSummary TemplateMethod(): updateMetaData, find PrimitiveOperation(): getMetadataReloader, registerWithCurrentDocument updateMetaData -> {getMetadataReloader } find -> {registerWithCurrentDocument } |
||
| org.acm.seguin.ide.common.action.RefactoringAction TemplateMethod(): actionPerformed PrimitiveOperation(): activateListener |
||
| org.acm.seguin.io.DirectoryTreeTraversal TemplateMethod(): traverse PrimitiveOperation(): isTarget, visit |
||
| org.acm.seguin.metrics.MetricsFrame TemplateMethod(): createFrame PrimitiveOperation(): getTitle |
||
| org.acm.seguin.metrics.MetricsReport TemplateMethod(): finalReport, typeReport, methodReport PrimitiveOperation(): reportAverageStatements, reportAveragePublicMethods, reportAverageOtherMethods, reportAverageClassMethods, reportAverageInstanceVariables, reportAverageClassVariables, reportAbstractClasses, reportInterfaces, reportAverageParameters, reportPublicMethods, reportOtherMethods, reportClassMethods, reportInstanceVariables, reportClassVariables, reportStatement, reportParameters, reportLinesOfCode, reportBlockDepth finalReport -> {reportAverageStatements, reportAveragePublicMethods, reportAverageOtherMethods, reportAverageClassMethods, reportAverageInstanceVariables, reportAverageClassVariables, reportAbstractClasses, reportInterfaces, reportAverageParameters } typeReport -> {reportPublicMethods, reportOtherMethods, reportClassMethods, reportInstanceVariables, reportClassVariables } methodReport -> {reportStatement, reportParameters, reportLinesOfCode, reportBlockDepth } |
||
| org.acm.seguin.parser.factory.ParserFactory TemplateMethod(): getParser, getAbstractSyntaxTree PrimitiveOperation(): getInputStream, getKey getParser -> {getInputStream } getAbstractSyntaxTree -> {getKey } |
||
| org.acm.seguin.pretty.PrettyPrintFromIDE TemplateMethod(): prettyPrintCurrentWindow, getPrintData PrimitiveOperation(): getStringFromIDE, setStringInIDE, setLineNumber, getLineNumber prettyPrintCurrentWindow -> {getStringFromIDE, setStringInIDE, setLineNumber } getPrintData -> {getLineNumber } |
||
| org.acm.seguin.pretty.sort.Ordering TemplateMethod(): compare PrimitiveOperation(): getIndex |
||
| org.acm.seguin.print.xml.State TemplateMethod(): processLine(String), print(StringBuffer) PrimitiveOperation(): processLine(String, int, StringBuffer), getFont processLine(String) -> {processLine(String, int, StringBuffer) } print(StringBuffer) -> {getFont } |
||
| org.acm.seguin.refactor.Refactoring TemplateMethod(): run, recordUsage PrimitiveOperation(): preconditions, transform, getID run -> {preconditions, transform } recordUsage -> {getID } |
||
| org.acm.seguin.refactor.type.AddClassRefactoring TemplateMethod(): transform PrimitiveOperation(): transformOriginal, createClass |
||
| org.acm.seguin.refactor.type.TypeChangeVisitor TemplateMethod(): visit(FileSummary, Object), visit(ImportSummary, Object), isSamePackage, isMatchingPackage PrimitiveOperation(): getAppropriateClasses, getFileSpecificTransform, getNewImports, getNewFile, addRenamingTransforms, getRemoveImportTransform, getCurrentPackage visit(FileSummary, Object) -> {getAppropriateClasses, getFileSpecificTransform, getNewImports, getNewFile, addRenamingTransforms } visit(ImportSummary, Object) -> {getRemoveImportTransform, getCurrentPackage } isSamePackage, isMatchingPackage -> {getCurrentPackage } |
||
| org.acm.seguin.summary.query.TypeList TemplateMethod(): query(PackageSummary), add(FileSummary, LinkedList) PrimitiveOperation(): isIncluded(FileSummary), isIncluded(TypeSummary) query(PackageSummary) -> {isIncluded(FileSummary) } add(FileSummary, LinkedList) -> {isIncluded(TypeSummary) } |
||
| org.acm.seguin.uml.refactor.DialogViewListener TemplateMethod(): actionPerformed PrimitiveOperation(): createDialog |
||
| org.acm.seguin.uml.refactor.ExtractMethodDialog TemplateMethod(): followup, init PrimitiveOperation(): setStringInIDE, getStringFromIDE, getSelectionFromIDE followup -> {setStringInIDE } init -> {getStringFromIDE, getSelectionFromIDE } |
||
| org.acm.seguin.uml.refactor.NoInputRefactoringListener TemplateMethod(): runRefactoring PrimitiveOperation(): createRefactoring |
||
| org.acm.seguin.uml.refactor.RefactoringDialog TemplateMethod(): runRefactoring PrimitiveOperation(): createRefactoring |
||
| Visitor | Visitor | ConcreteElement |
| org.acm.seguin.parser.JavaParserVisitor | 86 subclasses of org.acm.seguin.parser.ast.SimpleNode | |
| org.acm.seguin.summary.SummaryVisitor | 13 subclasses of org.acm.seguin.summary.Summary | |
Detected Design Patterns in JUnit 3.7
| Design Pattern Name | Roles and Corresponding Classes | |
|---|---|---|
| * Last updated on April 1st 2009 | ||
| Object Adapter-Command | Adapter/ConcreteCommand | Adaptee/Receiver |
| junit.swingui.TestSuitePanel adaptee: TestTreeModel fModel Request(): addError, addFailure, endTest Target role is played by class junit.framework.TestListener |
junit.swingui.TestTreeModel SpecificRequest(): addError(Test), addFailure(Test), addRunTest(Test) |
|
| junit.awtui.TestRunner adaptee: TestResult fTestResult Request(): addError, addFailure, endTest Target role is played by class junit.framework.TestListener |
junit.framework.TestResult SpecificRequest(): errorCount, failureCount, runCount, wasSuccessful |
|
| junit.awtui.TestRunner adaptee: ProgressBar fProgressIndicator Request(): endTest Target role is played by class junit.framework.TestListener |
junit.awtui.ProgressBar SpecificRequest(): step |
|
| junit.swingui.TestHierarchyRunView adaptee: TestSuitePanel fTreeBrowser Request(): getSelectedTest, revealFailure, aboutToStart Target role is played by class junit.swingui.TestRunView |
junit.swingui.TestSuitePanel SpecificRequest(): getSelectedTest, getTree, showTestTree |
|
| junit.extensions.TestSetup$1 Request(): protect Target role is played by class junit.framework.Protectable |
junit.extensions.TestSetup SpecificRequest(): setUp, basicRun, tearDown |
|
| junit.framework.TestResult$1 Request(): protect Target role is played by class junit.framework.Protectable |
junit.framework.TestCase SpecificRequest(): runBare |
|
| Composite | Component | Composite |
| junit.framework.Test | junit.framework.TestSuite children: Vector fTests Add(Component): addTest(Test) Operation(): countTestCases, run -> runTest |
|
| Decorator | Component | Decorator |
| junit.framework.Test | junit.extensions.TestDecorator component: Test fTest Operation(): countTestCases, run -> basicRun |
|
| Observer | Subject | Observer |
| junit.framework.TestResult observers: Vector fListeners Attach(Observer): addListener Detach(Observer): removeListener Notify(): addError, addFailure, endTest, startTest |
junit.framework.TestListener Update(): addError, addFailure, endTest, startTest |
|
| State-Strategy | Context | State/Strategy |
| junit.extensions.ActiveTestSuite$1 | junit.framework.Test | |
| junit.swingui.FailureRunView junit.swingui.TestHierarchyRunView |
junit.swingui.TestRunContext | |
| junit.swingui.TestRunner | junit.runner.FailureDetailView | |
| Template Method | AbstractClass | |
| junit.runner.BaseTestRunner TemplateMethod(): getTest PrimitiveOperation(): runFailed |
||
Acknowledgments
- I would like to thank Alex Binun from University of Bonn, Germany for reporting a missing instance of Decorator design pattern in java.io package and helping me to improve the tool. Version 4 resulted based on his valuable feedback!
- I would like to thank Lei Hu from the Dept. of Computing & Software, McMaster University, Canada for reporting some missing design pattern instances in JHotDraw 5.1
1 comment:
excellent article . another article i suggest is this one
Post a Comment