|
Re: [AgileEmbedded] Re:Understanding Model-Conductor-Hardware pattern
On Jan 11, 2007, at 10:03 AM, Michael Karlesky wrote:
> Let me give you an example. Imagine an embedded system that processes
> temperature. The Hardware layer wraps the temperature sensor and the
> timer that triggers temperature reading (the wrapping is to make unit
> testing possible in the first place, of course). The Conductor
> handles timer events and asks the hardware for raw temperature
> values. The Conductor then hands that raw data off to the Model to
> calculate a temperature
I think the something (Hardware or Conductor) might want to hide the
hardware a little more by normalizing the temperature. so the model
deals with degree's C, K, F, R as suitable, and does not have to
worry about the scaling of the A/D values. This lets the model deal
in the problem domain abstractions, making that code able to better
stand the test of time.
> A subsequent, similar process for displaying
> the temperature can be imagined. The logic for handling the hardware
> can be tested apart from the math that processes the temperature.
> This is far better than verifying temperature processing code with
> heat guns and compressed air cans. While it's true you could possibly
> eliminate the Conductor, we've consistently found that isolating
> functionality always yields unexpected gains because of the
> decoupling it provides. So, we offer that segregating hardware
> handling logic (Conductor) from business logic (Model) is the best
> way to go.
>
> We've been talking all about unit testing thus far. An added benefit
> of the MHC pattern is that it can make system testing much easier. By
> testing the hardware and business logic separately, test fixtures can
> be created and hooks made into the Hardware layer that allow hardware
> related problems (either programming misunderstandings or board
> design issues) to be found and solved much more quickly than in
> traditional firmware development.
Do you try to test the model and controller on the development machine?
James
--------
James W. Grenning
Object Mentor, Inc.
www.objectmentor.com
blog.objectmentor.com
--------
.
[Non-text portions of this message have been removed]
|