[Pharo-project] [ENH]: Zinc - Streaming Download Progress

Camillo Bruni camillobruni at gmail.com
Sat Jul 14 19:09:52 EDT 2012


Notification/Exception vs Announcements is pretty easy to answer in my opinion:

Notification/Exception should only be used when the original action can be modified, 
typical examples are UI dialogs which ask for something.

Announcements can be used when there is no need for feedback.
I would consider the following things be better using Announcements
- inform:
- progress bar


Furthermore I would say each Notification/Exception should trigger an Announcement
as well. Somehow they are the weak form of Notification/Exception because they are 
only an outgoing communication channel. Whereas Notification/Exception allow information
to be injected back..

On 2012-07-14, at 21:12, Sean P. DeNigris wrote:

> 
> Stéphane Ducasse wrote
>> 
>> I did not get it.
>> 
> 
> Besides being hackish, using exceptions to notify progress has other
> drawbacks. For example, if you use announcements, then everyone who is
> interested in receiving them will be notified. With exceptions, even if you
> want to be notified, the exception may get handled before you ever get a
> chance. My whole journey with cleaning SystemProgress started because I was
> trying to get progress notifications, but they were being handled by code
> that I didn't own before I got them. Announcements also allow elegant
> simplifications like e.g. for system progress, the progress bar might be
> just another subscriber to the announcements, so it's really easy to
> enable/disable it.
> 
> 
> Also,
> 	| client |
> 	client := ZnClient new.
> 	[ client
> 		signalProgress: true;
> 		url: fileUrl;
> 		downloadTo: self workspace fullName. ]
> 		on: HTTPProgress 
> 		do: [ :progress | 
> 			"handle progress"
> 			progress resume ].
> 
> vs.
> 
> 	client := ZnClient new.
> 	client
> 		onProgressSend: #progress: to: self.
> 		url: fileUrl;
> 		downloadTo: self workspace fullName.
> 
> --
> View this message in context: http://forum.world.st/ENH-Zinc-Streaming-Download-Progress-tp4639686p4640024.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
> 





More information about the Pharo-dev mailing list