Professional Documents
Culture Documents
Aditya P. Mathur
Purdue University
Performance
Cost
Maintainability
Points of evolution
As a process:
The process by which the architecture of a
software system is established.
As an artifact:
The architecture of a software system
describing system components and their
interactions.
Separation of concerns
Measure of interconnectedness.
Class C1 is coupled to class C2 if C1 requires
C2 directly or indirectly.
Coupling measures the strength of
dependence between classes and packages.
Coupling Interface
complexity
Low Simple
Obvious
High Complicated
Obscure
Relative Percentages
A B C D
A
X 15 35 35 15 D
Y 10 40 30 20 B
C
Z 10 40 30 20
A B C D
A=10%
B=40%
C=30% Application data
Change notification
D=20%
Requests, modifications
September 20, 2001 Software Architecture and Design 24
Observer Pattern [3]
observers
Subject Observer
Concrete Observer
subject
Concrete Subject Update()
GetState() observerState
SetState()
observerState=
subjectState subject getState();
September 20, 2001 Software Architecture and Design 25
Class collaboration in Observer
SetState()
Notify()
Update()
GetState()
Update()
GetState()
class Subject;
protected:
observer ();
};
Note the support for multiple subjects.
class Subject {
Abstract class defining
public:
the Subject interface.
virtual ~Subject;
protected:
Subject ();
private:
List <Observer*> *_observers;
};
September 20, 2001 Software Architecture and Design 28
Observer Pattern: Subject Code [2]
}
void Subject :: Notify (){
ListIterator<Observer*> iter(_observers);
for ( iter.First(); !iter.IsDone(); iter.Next()) {
iter.CurrentItem() -> Update(this);
}
September 20, 2001 Software Architecture and Design 29
Observer Pattern: A Concrete Subject [1]
ClockTimer :: Tick {
Notify();
_subjectAttach(this);
DigitalClock ::~DigitalClock() {
_subject->Detach(this);
If (theChangedSubject == _subject) {
Draw();
}
} Check if this is the clock’s subject.
1. What is design?
2. What is architecture?