The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Declaring Announcements

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
Declaring Announcements Posted: Dec 1, 2005 10:25 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Declaring Announcements
Feed Title: Richard Demers Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rademers-rss.xml
Feed Description: Richard Demers on Smalltalk
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Richard Demers Blog

Advertisement

In Relating Announcements to Classes, I made the point that it would be desirable for classes whose instances announce Announcements (wierd wording) to be able to respond to two messages:

  1. #allAnnouncements which returns the Set of Announcements announced by instances of the class. This would include Announcements announced by superclasses. A Parts-like application generator might be a sender of this message.
  2. #declaredAnnouncements which returns the Set of Announcements announced by the class but not its superclasses. Documentation tools, such as SmalltalkDoc, would be a sender of this message.

An open question is how to know which Announcements are announced by a particular class. In Announcement Reflections, Travis Griggs looked into a dynamic method that looked at all methods of a class and its superclasses and found the class litterals of Announcements. He ended up dissatisfied with this approach because it failed to distinguish between subscribing and announcing Announcements, and because it failed to handle the inheritence hierarchy of Announcements, themselves. These problems could be overcome with a better algorithm, but there would still remain the performance cost of the required searches and analysis.

An alternative approach would be more declarative. Suppose there was a #declareAnnouncements class method, that was used to specify the Announcements announced by the class (beyond those announced by its superclasses). Whether or not instances of the class actually announce them is a separate issue, as is whether this declaration is "enforced" or not.

Here are the results I would expect.

  • Assume that ClassA is the superclass of Class B, which is the superclass of ClassC.
  • Assume that Announcement J is the superclass of Announcement M.
  1. ClassA declares Announcements I, J, K.
    • For #allAnnouncements it answers I, J, K.
    • For #declaredAnnouncements, it answers I, J, K.
  2. ClassB declares Announcements M, P, Q.
    • For #allAnnouncements it answers I, K, M, P, Q. Note that M overrides its superclass Announcement J.
    • For #declaredAnnouncements, it answers M, P, Q.
  3. ClassC declares Announcements J, R, S.
    • For #allAnnouncements it answers I, K, P, Q, J, R, S. Note that J replaces its subclass Announcement M.
    • For #declaredAnnouncements, it answers J, R, S.

An example of #declareAnnouncements is simply

declareAnnouncements
   ^Set with: I with: J with: K

#allAnnouncements would have the responsibility of obtaining superclass Announcements and applying overrides correctly.

Read: Declaring Announcements

Topic: Microsoft and XML Validity Previous Topic   Next Topic Topic: OO vs. Same old Stuff

Sponsored Links



Google
  Web Artima.com   

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