MISPRINT:<br><br>In the last part when says:<br><br>&quot;The announcement can also know <br><br>
algorithm<br><br>
        self doA.<br>
        self announce: (WorkAnnoucement finished: #doA).&quot;<br><br>shouldn&#39;t go!<br><br>Cheers,<br>Martin<br><br><br><div class="gmail_quote">On Thu, Mar 31, 2011 at 6:53 PM, Martin Dias <span dir="ltr">&lt;<a href="mailto:tinchodias@gmail.com">tinchodias@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br><div class="gmail_quote"><div><div></div><div class="h5">On Thu, Mar 31, 2011 at 5:47 PM, Yoshiki Ohshima <span dir="ltr">&lt;<a href="mailto:yoshiki@vpri.org" target="_blank">yoshiki@vpri.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
  I don&#39;t understand the problem.  Let us say we start from the<br>
example in the method:<br>
<br>
--------------------<br>
<div>&#39;Now here&#39;&#39;s some Real Progress&#39;<br>
        displayProgressAt: Sensor cursorPoint<br>
        from: 0 to: 10<br>
        during: [:bar |<br>
        1 to: 10 do: [:x | bar value: x.<br>
                        (Delay forMilliseconds: 500) wait]].<br>
</div>--------------------<br>
<br>
and your &quot;algorithm&quot; here would be:<br>
<br>
        1 to: 10 do: [:x | &quot;do something here&quot;<br>
                        (Delay forMilliseconds: 500) wait].<br>
<br>
It is already reasonably decoupled to me, but I take that you want to<br>
keep the &quot;algorithm&quot; really prestine and don&#39;t want to have &quot;bar<br>
value: x&quot; call in there, and completely get rid of anything from &quot;do<br>
something here&quot;.  Is this the case?<br>
<br>
  There still have to have some way to tell how much percent of work<br>
done from the &quot;algorithm&quot; to the progress notification mechanism.  In<br>
the possible meta approach (which would not be that hard at all), I&#39;d<br>
make an instance variable for the object that represents your<br>
algorithm state, and the algorithm assigns a value to the instance<br>
variable, and the progress bar displayer that is running in a separate<br>
thread looks at the variable periodically and update the screen.<br>
<br>
  However, in this senario, you would have to have an assignment to<br>
that variable at &quot;do something here&quot;:<br>
<br>
-----------------<br>
        1 to: 10 do: [:x | progress := x.<br>
                        (Delay forMilliseconds: 500) wait].<br>
-----------------<br>
<br>
But is &quot;progress := x&quot; any better than &quot;bar value: x&quot;?<br>
<br>
  Somebody suggested announcements.  So your algorithm would look like:<br>
<br>
-----------------<br>
        1 to: 10 do: [:x | self announce: (ProgressAnnouncement value: x).<br>
                        (Delay forMilliseconds: 500) wait].<br>
-----------------<br>
<br>
And a stepping morph surely does not work.  If something was started<br>
from a do-it in workspace, next time the morph gets #step message is<br>
after the do-it is completed.<br>
<br>
The &quot;bar&quot; block could be stored in an instance variable of the<br>
algorithm object, and your algorithm may do:<br>
<br>
-----------------<br>
        1 to: 10 do: [:x | bar ifNotNil: [bar value: x].<br>
                        (Delay forMilliseconds: 500) wait].<br>
-----------------<br>
<br>
This may be just as good as it gets without complicating anything<br>
else.<br>
<br>
  Note that your algorithm may not be a loop.  It is totally legitimate<br>
to write:<br>
<br>
algorithm<br>
        self doA.<br>
        bar value: 0.33.<br>
        self doB.<br>
        bar value: 0.66.<br>
        self doC.<br>
<br></blockquote></div></div><div><br>What you sent makes me think... <br><br>I am not convinced of this other solution, but with announcements could be:<br><br>algorithm<br>
        self doA.<br>
        self announce: (WorkAnnoucement finished: #doA).<br>
        self doB.<br>
 
        self announce: (WorkAnnoucement finished: #doB).<br>
        self doC.<br>

        self announce: (WorkAnnoucement finished: #doC).<br>
 <br>and the specific observer subscribed to this algorithm knows what percentage corresponds to each selector. And you could easily plug an observer that logs to Transcript.<br><br>The announcement can also know <br><br>

algorithm<br><br>
        self doA.<br>
        self announce: (WorkAnnoucement finished: #doA).<br>
 <br> </div><div><div></div><div class="h5"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
where doA, doB, doC are long running computation.  So, really generic<br>
way to view the progress of something from outside without the<br>
knowledge of where to look at and how to interpret these values are<br>
not going to fly.<br>
<br>
-- Yoshiki<br>
<br>
At Thu, 31 Mar 2011 17:10:58 -0300,<br>
<div><div></div><div>Martin Dias wrote:<br>
&gt;<br>
&gt; Hello<br>
&gt;<br>
&gt; On Wed, Mar 30, 2011 at 4:24 AM, Denis Kudriashov &lt;<a href="mailto:dionisiydk@gmail.com" target="_blank">dionisiydk@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;     Hello<br>
&gt;<br>
&gt;     I have idea about &quot;meta approach&quot; for implementation of progress tracking of arbitrary method execution.<br>
&gt;<br>
&gt;     Progress tracking (progress bar stuff) is really ortogonal functionallity for method execution. And it would be cool<br>
&gt;     if we have framework for describing tracking of method execution stuff (like it progress).<br>
&gt;     This framework should run block of code in background and periodically analize state of this background process<br>
&gt;     stack. And show this state for user. And so this framework allow track execution of arbitrary code.<br>
&gt;     Analizing state can search running loops in stack for example and show user status of loop counters.<br>
&gt;<br>
&gt;     I think it is not very hard to implement. But maybe this approach can&#39;t be implemented when code jitted<br>
&gt;<br>
&gt; I like the &quot;meta approach&quot;... but it doesn&#39;t look easy to implement for me!<br>
&gt; Have you seen something like that implemented? or some paper written?<br>
&gt;  <br>
&gt;<br>
&gt;     2011/3/30 Martin Dias &lt;<a href="mailto:tinchodias@gmail.com" target="_blank">tinchodias@gmail.com</a>&gt;<br>
&gt;<br>
&gt;         Hello<br>
&gt;<br>
&gt;         I have a couple of algorithms and I want to show the progress while they run. I played with the progress bar and<br>
&gt;         it&#39;s okay for my needs.<br>
&gt;<br>
&gt;         The progress bar should be pluggable and decoupled of the algorithms.<br>
&gt;<br>
&gt;         I am writing to you to ask about good designs for my problem. I hope I haven&#39;t expressed the problem in a too<br>
&gt;         abstract way.<br>
&gt;<br>
&gt;         The design I have in mind is a kind of observer pattern: the serialization algorithm publishes information about<br>
&gt;         the run; a specific listener implements the progress bar for that serialization algorithm, interpreting the<br>
&gt;         information published.<br>
&gt;<br>
&gt;         Thanks,<br>
&gt;         Martin<br>
&gt;<br>
&gt;<br>
</div></div>&gt; [2  &lt;text/plain; us-ascii (7bit)&gt;]<br>
&gt;<br>
<br>
</blockquote></div></div></div><br>
</blockquote></div><br>