[CCC DEV] Interfaces within "Plumbing"
Steve Pretty
steve.g.pretty at btinternet.com
Sat Jan 22 17:00:59 GMT 2011
A question has been bugging me about the design architecture of the
plumbing library.
The library uses two forms of protocol for communications between its
"building blocks" There is:
LEVEL - a user defined type with defined literals HIGH and LOW
SIGNAL
If you take the switch example from the plumbing book, it works like:
digital.input --[LEVEL]--> debounce --[LEVEL]--> level.to.signal
--[SIGNAL]--> pin.toggle (converts back to LEVEL internally)
I am curious to understand the thinking behind creating and using these
two different interfaces. To my mind it creates a number of difficulties:
* Restricts inter connectivity of the blocks
* Requires adapter blocks to change between the two message types
* When working with SIGNAL, there is a loss of information - it marks a
change of state - but was it a leading edge or a trailing edge? sorting
this out required careful and error prone initial condition seeding of
the blocks that convert from SIGNAL to LEVEL.
I wonder if there is not a case for applying Occam's Razor here -
eliminate both these entities and use the standard BOOL throughout?
More information about the developers
mailing list