The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Announcements In Private

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Announcements In Private Posted: Dec 9, 2005 12:59 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Announcements In Private
Feed Title: Travis Griggs - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/travis-rss.xml
Feed Description: This TAG Line is Extra
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Travis Griggs - Blog

Advertisement

Converting triggerEvents: to Announcements is kind of fun.

In 2 recent cases, I've noticed a pattern. Formerly, the triggerer triggered just one kind of event. There's no real data of interest to go along with the event. Observers just no they need to resync with some aspect of the triggerer.

So I take the event names (#colorsChanged and #pagesChanged) from these two sites and turn them into Announcement subclasses. That's pretty much it. I change the triggerEvent: sites to announce. Rework as necessary the subscriber sites. One of the things that seems worrisome to me is that I'm starting to see all of these Announcement classes in my browser, and cluttering up my namespace(s). The Announcement's "name" is pretty much coupled with the object that produces it.

One thing that I hope will happen soon, is an icon for Announcements in the browser. It might be time to resurrect ExtraIcons. :)

That makes the browser situation a little better, but not the namespace situation. What I *might* want is to scope the Announcement subclass to the guy that produces it. This is not "officially" supported, but I kind of got it to work with a little playing:

SterlingUI.ControlConsole defineSharedVariable: #PagesChanged
	private: false
	constant: false
	category: 'shares'
	initializer: '| class | class := (ClassBuilder new)
		superclass: Announcement;
		environment: Smalltalk;
		className: #PagesChanged;
		instVarString: '''';
		beFixed;
		reviseSystem.
		class environment: SterlingUI.ControlConsole.
		Smalltalk removeKey: #PagesChanged.
		class'

Basically, create a class, as a result of a share initializer, and then adjust it's environment. Now I can refer to it from afar as ControlConsole.PagesChanged. I *might* shorten it up to just be Changed then.

For a while now, I've been kicking around the idea that it would be nice of Classes could be namespaces for other classes. Private classes as it were. There are a number of rationales one might have for wanting to do this, but in this case, it is simply to manage/control the scope of the name pool. Similiar analogs hold true for Exception classes. There are many Exception types that really just exist for one associated class.

An alternate is to keep the Announcement types abstracted. One might argue, that I should create an Announcement type called AtomicChange, and just reuse it in multiple classes (why not just use Announcement directly? good question for the student). I'm not sure what I think of this. It doesn't communicate as clearly. Maybe, for example, it will be possible to create the Universal Added announcement, and the concept can be reused amongst anything that wants to announce that it "added something".

Read: Announcements In Private

Topic: So, so unclear on the concept Previous Topic   Next Topic Topic: Shorter Publishers Council:

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use