Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #21452

Re: Design pattern: refresh-based or event-based?

From pozz <pozzugno@gmail.com>
Newsgroups comp.arch.embedded
Subject Re: Design pattern: refresh-based or event-based?
Date 2015-07-23 09:00 +0200
Organization A noiseless patient Spider
Message-ID <moq3ca$pt4$1@dont-email.me> (permalink)
References (1 earlier) <87zj2pv8et.fsf@jester.gateway.sonic.net> <mon86l$8vt$1@dont-email.me> <87egk0vhwg.fsf@jester.gateway.sonic.net> <mongbq$vkk$1@dont-email.me> <87615cusao.fsf@jester.gateway.sonic.net>

Show all headers | View raw


Il 22/07/2015 17:26, Paul Rubin ha scritto:
> pozz <pozzugno@gmail.com> writes:
>> As I wrote in another post, one thing is the events triggered by the
>> graphical toolikt (even emwin is event-based) and another is the
>> events generated by the applications, for example from the lower level
>> layer that manages the field bus (remote sensors/peripherals)...
>> Even in this scenario I can decide to update *values* on the display
>> at a regular time base, for example every 100ms.
>
> Yes, it's just not clear to me why to do that.

For simplicity. The code is very simple, a single function to call 
regularly on a time basis that redraw every widget on UI.


> Do you know the idea of Model-View-Controller (MVC)?  It might be
> helpful here:
>
>    https://en.wikipedia.org/wiki/Model-view-controller

Interesting.


> Basically it means you have a data object (the model) tracking the state
> of the system.  The "controller" reads stuff from the field bus and
> updates values in the model, and then the display (the view) shows the
> contents of the model.
>
> It's generally reasonable for the controller posting updates to values
> in the model to also send events to the UI as the updates happen.  In a
> simple system the model can be the state of the UI widgets.  UI
> libraries will typically let you read from the widgets as well as write
> to them.

As I wrote in my original post, the event-based, asyncronous design is 
more attractive and clean for me... but it has some pitfalls and 
additional complexities... so the original question: what is the better 
method?


> You do end up wanting to use some concurrency in these interfaces, but
> if you implement it with message passing and accept a bit of overhead
> from that, you're reasonably safe from the classic hazards of concurrent
> programming.
>
> What hardware and OS are you using?

I think the question is indipendent from the hw. Anyway I'm actually 
using a LPC1788 MCU without a really OS.

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Design pattern: refresh-based or event-based? pozz <pozzugno@gmail.com> - 2015-07-21 10:02 +0200
  Re: Design pattern: refresh-based or event-based? upsidedown@downunder.com - 2015-07-21 11:37 +0300
    Re: Design pattern: refresh-based or event-based? pozz <pozzugno@gmail.com> - 2015-07-21 11:00 +0200
      Re: Design pattern: refresh-based or event-based? Dimiter_Popoff <dp@tgi-sci.com> - 2015-07-22 01:34 +0300
        Re: Design pattern: refresh-based or event-based? pozz <pozzugno@gmail.com> - 2015-07-22 06:57 +0200
          Re: Design pattern: refresh-based or event-based? Paul Rubin <no.email@nospam.invalid> - 2015-07-21 23:02 -0700
            Re: Design pattern: refresh-based or event-based? pozz <pozzugno@gmail.com> - 2015-07-22 09:17 +0200
              Re: Design pattern: refresh-based or event-based? Paul Rubin <no.email@nospam.invalid> - 2015-07-22 00:23 -0700
        Re: Design pattern: refresh-based or event-based? upsidedown@downunder.com - 2015-07-22 10:02 +0300
          Re: Design pattern: refresh-based or event-based? Dimiter_Popoff <dp@tgi-sci.com> - 2015-07-22 19:48 +0300
            Re: Design pattern: refresh-based or event-based? pozz <pozzugno@gmail.com> - 2015-07-23 09:04 +0200
              Re: Design pattern: refresh-based or event-based? Dimiter_Popoff <dp@tgi-sci.com> - 2015-07-23 10:29 +0300
                Re: Design pattern: refresh-based or event-based? raimond.dragomir@gmail.com - 2015-07-31 02:34 -0700
  Re: Design pattern: refresh-based or event-based? Don Y <this@is.not.me.com> - 2015-07-21 03:16 -0700
  Re: Design pattern: refresh-based or event-based? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2015-07-21 14:40 +0200
    Re: Design pattern: refresh-based or event-based? pozz <pozzugno@gmail.com> - 2015-07-22 07:01 +0200
      Re: Design pattern: refresh-based or event-based? Stefan Reuther <stefan.news@arcor.de> - 2015-07-22 18:30 +0200
        Re: Design pattern: refresh-based or event-based? Paul Rubin <no.email@nospam.invalid> - 2015-07-22 10:55 -0700
  Re: Design pattern: refresh-based or event-based? Paul Rubin <no.email@nospam.invalid> - 2015-07-21 08:26 -0700
    Re: Design pattern: refresh-based or event-based? pozz <pozzugno@gmail.com> - 2015-07-22 07:04 +0200
      Re: Design pattern: refresh-based or event-based? Paul Rubin <no.email@nospam.invalid> - 2015-07-21 23:13 -0700
        Re: Design pattern: refresh-based or event-based? pozz <pozzugno@gmail.com> - 2015-07-22 09:24 +0200
          Re: Design pattern: refresh-based or event-based? Paul Rubin <no.email@nospam.invalid> - 2015-07-22 08:26 -0700
            Re: Design pattern: refresh-based or event-based? pozz <pozzugno@gmail.com> - 2015-07-23 09:00 +0200
  Re: Design pattern: refresh-based or event-based? hamilton <hamilton@nothere.com> - 2015-07-21 14:07 -0600
    Re: Design pattern: refresh-based or event-based? Don Y <this@is.not.me.com> - 2015-07-21 13:12 -0700
  Re: Design pattern: refresh-based or event-based? Andrew Smallshaw <andrews@sdf.lonestar.org> - 2015-07-22 00:19 +0000
    Re: Design pattern: refresh-based or event-based? Paul Rubin <no.email@nospam.invalid> - 2015-07-21 18:09 -0700
      Re: Design pattern: refresh-based or event-based? Andrew Smallshaw <andrews@sdf.lonestar.org> - 2015-07-22 21:18 +0000
        Re: Design pattern: refresh-based or event-based? Paul Rubin <no.email@nospam.invalid> - 2015-07-22 23:17 -0700
    Re: Design pattern: refresh-based or event-based? pozz <pozzugno@gmail.com> - 2015-07-22 07:20 +0200
    Re: Design pattern: refresh-based or event-based? upsidedown@downunder.com - 2015-07-22 10:53 +0300
  Re: Design pattern: refresh-based or event-based? pozz <pozzugno@gmail.com> - 2015-07-22 07:32 +0200

csiph-web