Search the web
Sign In
New User? Sign Up
AgileEmbedded · Agile Embedded
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Understanding Model-Conductor-Hardware pattern   Message List  
Reply | Forward Message #139 of 464 |
Re:Understanding Model-Conductor-Hardware pattern


--- In AgileEmbedded@yahoogroups.com, James Grenning <grenning@...>
wrote:

> 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.

The intent of the MHC pattern is to allow for maximum automated
testability; it does this by decoupling hardware from code. In MVP the
same thing is accomplished in decoupling widgets from event handlers and
code. If temperature normalization happens in the Hardware layer then
the only way to unit test the normalization is to exercise the sensor
hardware directly and use a debugger to inspect normalized values (one
of the things we're trying to avoid). If, instead, the normalization
code is simply a function in the Model that accepts raw A/D values, then
the vast majority of all the code can be tested apart from the hardware
in a unit test framework (we wrote a very small C-based framework for
just such a purpose). Doing this means we only have to ensure that all
the MCH triad components are "wired up" to pass data back and forth (if
they're not, it becomes quite obvious). It is conceivable that
normalization could happen in the Conductor. This would certainly allow
us to unit test the normalization. However, it violates the basic
architecture of the pattern in that the Conductor is really a conductor
- coordinating events and the transfer of data between the hardware and
the system logic. Temperature normalization fits very nicely in the
Model. I must admit that I don't see how a normalization function along
with a separate temperature calculation function in the Model will not
stand the test of time. Separating those two operations is good
programming practice - as you've pointed out. However, placing one
inside the Hardware layer makes automated testing difficult.


> Do you try to test the model and controller on the development
machine?

There's a variety of ways to run the unit tests (as I mentioned, we
wrote a small C-based unit test library & most recently we've been using
Ruby to auto generate C-based mocks to complement those unit tests).
It's possible to cross compile C code and run the Model and Controller
unit tests on a development machine instead of the target system. To my
knowledge, we've not yet done this. Another alternative is to run the
tests inside an emulator on the development machine; this we have done.
We've also used build scripts to grab a few tests, compile them together
with the production code, transfer that to the target system, run the
tests on the target system, and collect results.

At some point in the near future, we'll release our small embedded unit
test framework, Unity, to Open Source.

We've used our Model-Conductor-Hardware pattern and our unit test
framework on very small systems (e.g 8 bit PICs with 16k of program
memory and 255 bytes of RAM). It works well.




[Non-text portions of this message have been removed]




Fri Jan 12, 2007 3:50 am

mkarlesky
Offline Offline
Send Email Send Email

Forward
Message #139 of 464 |
Expand Messages Author Sort by Date

I just joined this group after seeing a message on comp.software-eng by Mike Karlesky. I followed some links he provided and found an interesting article,...
Thad Smith
thadsmith3
Offline Send Email
Jan 10, 2007
6:22 am

Thad, I'll try to answer your questions as well as I can. We're pretty excited that there's some discussion starting on this topic. Pardon the length of what...
Michael Karlesky
mkarlesky
Offline Send Email
Jan 11, 2007
4:11 pm

... 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...
James Grenning
jwgrenning
Offline Send Email
Jan 11, 2007
5:14 pm

... The intent of the MHC pattern is to allow for maximum automated testability; it does this by decoupling hardware from code. In MVP the same thing is...
mkarlesky
Offline Send Email
Jan 12, 2007
3:50 am

I like the comparison of MHC to MVP and have found that analogy useful before. I agree that you want a very thin layer covering the hardware. I also think...
James Grenning
jwgrenning
Offline Send Email
Jan 12, 2007
4:55 am

... from current website: » Unity – embedded unit test framework for C (released 2008) http://sourceforge.net/projects/embunity/ Doesn't seem to have any...
marktxx
Offline Send Email
Apr 27, 2008
6:51 pm

... » Unity – embedded unit test framework for C (released 2008) http://sourceforge.net/projects/embunity/ Follow the link above and select the 'Code' menu...
Greg Williams
willi297
Offline Send Email
Apr 28, 2008
3:36 am

... That makes sense. ... I can understand that benefit to creating a Presenter in MVP. ... So do two separate modules, business and hardware. ... So do two...
Thad Smith
thadsmith3
Offline Send Email
Jan 12, 2007
2:22 am

... logic ... I think I understand what you mean when you say two separate modules, but perhaps I don't. We think the value of three modules (Model, Conductor,...
mkarlesky
Offline Send Email
Jan 13, 2007
12:48 am

... A thin hardware interface layer, the same, I think, as you use for the H layer, plus the rest in the business layer / application logic. ... I understand...
Thad Smith
thadsmith3
Offline Send Email
Jan 13, 2007
6:47 pm

... the ... understand ... Yes. This is the case. Separating M and C makes things easier to test. The separation ensures that there's no coupling between the...
mkarlesky
Offline Send Email
Jan 21, 2007
3:12 am

In AgileEmbedded@yahoogroups.com <mailto:AgileEmbedded%40yahoogroups.com>, James Grenning <grenning@...> ... The purpose of the hardware layer is to provide...
Rick
rick_clements
Offline Send Email
Jan 13, 2007
8:06 pm

... board.) ... Rick, what you're describing is what we would call unit tests, system tests, and acceptance tests. The MCH pattern makes it possible to unit ...
mkarlesky
Offline Send Email
Jan 21, 2007
3:53 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help