In the MVC structure, you absolutely need to have some OOP-based Event structure; Java's Actions/Listeners is a good example, but there are others that better or worse in some situations.

In Java, you have components with Actions (such as PressedAction for a UI button); you have other components that are Listeners that you must explicit connect to those actions. When the action is triggered, each connected Listener is told of this and they can take any necessary steps if they need do. In the above model, for the dynamic display during processing, you'd trigger an "InProgressAction", which then any InProgressListeners, including your progress display, respond to; the process display can be anything that responds to such; maybe as simple as a LED-style light that toggles state on each triggered action; maybe a status line that prints a text-bit that is sent, maybe a status bar that fills to 100%. You could also probably make a more specific FibonaciProgressIndicator that does something more interesting in your case. Since the triggered Actions can send out derivable events, you can overload these with extra that that you might want FibonaciProgressIndicator to respond to, but 'standard' ProgressIndicators have no idea what to do with. So unless you want speciality from the basic classes, there's no need to have strong 'interfaces' between your progress display and the underlying model.

(Another possiblity is a more general Broadcasters/Subscribers model, in which only one event engine class exists, which all broadcasters and subscribers are registered to; when a broadcaster sends out an event, the engine class sends it to subscribers which decide if they want to do anything with it. You can do some further optimization by having registeration flags to indicate which event to look for by subscribers, or what type of events will come in from Broadcasters, but this is a good type to use when you cannot completely encapsulate the event tree for a given operation into a single set of MVC classes. )

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
It's not what you know, but knowing how to find it if you don't know that's important


In reply to Re: How realistic is separation of computation from it's display? by Masem
in thread How realistic is separation of computation from it's display? by princepawn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.