Upload
dillian
View
38
Download
0
Embed Size (px)
DESCRIPTION
Alecsandar STOIANOV. Detecting patterns and antipatterns in software using prolog. Introduction. Legacy software. Patterns & Antipatterns. Observer. observerPattern (Project, SubjectN , ObserverN , ConcrSubjsN,ConcrObserversN , UpdateMsN,AttDetMeths,NotifyMeth ):- - PowerPoint PPT Presentation
Citation preview
Observer
observerPattern(Project, SubjectN, ObserverN, ConcrSubjsN,ConcrObserversN, UpdateMsN,AttDetMeths,NotifyMeth):-
observer(Observer,ObserverN,Project),
subject(Subject,SubjectN,Observer,AttDetMeths,NotifyMeth,UpdateMsN),
findall(X,concreteSubject(_,X,Subject),ConcrSubjsN),
findall(Y,concreteObserver(_,Y,Observer),ConcrObserversN).
God Class
This AntiPattern is characterized by a class diagram composed of a single complex controller class surrounded by simple data classes. The key problem here is that the majority of the responsibilities are allocated to a single class.
Results 1
Singleton Decorator Observer Strategy AdapterMe Pinot Me Pinot Me Pinot Me Pinot Me Pinot
jHotDraw 6.0b1
1 0 4 5 5 9 51 51 9 5
Java AWT 1.3
3 3 3 3 4 9 43 54 9 3
Java Swing
1.4
1 0 13 15 49 68 110 96 30 17
Java.io 1.4.2
0 0 3 4 0 13 5 3 0 4
Java.net 1.4.2
0 0 0 1 0 0 0 4 0 0
Apache Ant
1.6.2
2 1 3 4 2 5 64 53 9 13
Results 2
Data Class
Call Super Constant Interface
God Class Interface Bloat
Yoyo Problem(factor =
6)
Poltergeist
jHotDraw 6.0b1
10 72 0 13 25 4 18
Java AWT 1.3
23 34 0 23 27 0 2
Java Swing 1.4
55 223 2 86 48 16 7
Java.io 1.4.2
13 8 1 8 1 0 0
Java.net 1.4.2
9 0 1 2 0 0 0
Apache Ant 1.6.2
33 86 0 63 27 9 25