Main Site Documentation

.NET Micro Framework library and Best Practices


#1

Hi Hi,

I’ve started working on another project for my FEZ Domino and I was wondering if anyone had a template that they used for projects. ie Model-View-Controller.

I am currently work on one, but I’d hate to reinvent the wheel.

Also, I’d like to get your thoughts on best practices when it comes to reading inputs and reacting with outputs. I was thinking of implementing a “Control-Subcontroller-Driver”

[ol]
‘Main’ will start a new thread of the controller.
The controller will start a new thread of all sensors (Subcontroller)
Any components, ie motor, will be created as an instance in the Controller
[/ol]

Let me know your thoughts.
RJ


#2

I love design patterns.
My main concern when it comes to MF is the size constraints and performance. So I guess the main key here is to keep a good balance between “direct” code and fancy patterns.

V


#3

IMHO design patterns only complicates stuff and takes memory…


#4

For sensors that have interupts, I would events if possible.
For sensors you poll, I would setup a single thread to poll many sensors and create a struct to contain the values for each sensor and read that struct in your loop. I guess that may be what your doing. Patterns are good. And we use them whether we know it or not. For example, events are the Observer pattern.


#5

For the UI side of things I tend to use Model View Presenter based pattern. Just means I can keep the logic of creating \ rendering the UI very separate to the logic that is performed for an action. It also doesn’t really require much additional effort or overhead, just makes code a lot clearer and simpler.

http://en.wikipedia.org/wiki/Model-view-presenter


#6

I’m not much of strict pattern type of by programmer, but I love using MVVM in my Silverlight development (got to love the MS vision of .NET everywhere!) - looks very similar to MVP & MVC.

It simplifies things for me -
If I have to change the visuals, I go to the View.
If I need to change some business logic, go to the VM

Plus my code doesn’t become a tangled mess with the data heavy app I’m currently working on.

http://en.wikipedia.org/wiki/Model-view-viewmodel