D-Rose Program Design
In writing D-Rose, my intention is to use a homegrown hybrid of
traditional object-oriented analysis and design (OOA&D) and rapid
application development (RAD) techniques, leaning toward an Extreme
Programming (XP) development cycle. This page will collect the design
artifacts that emerge from that process.
XP-proper tends to downplay artifacts, since working code is the
ultimate (and typically the only accurate) artifact. Initially,
anyway, I'm intending to produle some fairly typical design artifacts
(i.e. class, state, and interaction diagrams, to name a few) as I'm
coding, with the belief that these artifacts both document what I've
done, and provide a different view into the system as it exists. It's
this latter reason that I believe will provide the most benefit.
Using these diagrams has already prompted me to refactor in a way I
might not have seen as readily without them.
Anyway, here are some of these artifacts:
Diagrams
|
|
|
Class diagram (169k) |
Inheritance diagram (104k) |
State chart for adding a new rail line (19k) |
Notifications
We're using the Observer/Observable pattern to allow objects to be
loosely coupled to other objects in which they're interested. The
follow is code grepped out of the source that's involved in this,
showing who's registering with whom, and what messages are being
sent. (This could probably be shown in a more clear fashion; one more
to-do...)
Observables:
citymanager.py:36:class CityManager( Observable ):
citymanager.py:48: def reset( self ):
citymanager.py:74: self.raiseEvent( 'CityManager.reset' )
rl.py:33:class RL( Observable ):
rl.py:78: def addStation( self, lat, long, tol ):
rl.py:87: self.raiseEvent( 'RL: Station Added' )
Observers:
map.py:31:class MapDisplay( wxWindow, Observer ):
map.py:36: def __init__( self, parent, id, model ):
map.py:48: self.model.cityManager.registerObserver( self )
map.py:49: self.model.rlManager.registerObserver( self )
map.py:206: def OnObservableEvent( self, event, obj ):
Both:
rlmanager.py:35:class RLManager( Observable, Observer ):
rlmanager.py:47: def reset( self ):
rlmanager.py:54: self.raiseEvent( 'RLManager.reset' )
rlmanager.py:88: def splitRLAtPoint( self, oldRL, lat, long ):
rlmanager.py:99: newRLA.registerObserver( self )
rlmanager.py:100: newRLB.registerObserver( self )
rlmanager.py:178: def addRL( self, lat1, long1, lat2, long2, tol ):
rlmanager.py:206: newRL.registerObserver( self )
rlmanager.py:213: def OnObservableEvent( self, event, obj ):
rlmanager.py:218: self.raiseEvent( 'RL: Station Added' )
|