The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Namespaces or Classes

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
Namespaces or Classes Posted: Feb 15, 2006 6:05 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Namespaces or Classes
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

The few, the proud, the brave, who have played with Smalltalk/X may recall that they have a novel approach to Namespaces. Long ago, long before the rest of the Smalltalk community even talked about namespaces, they had implemented private classes. So they just use these as Namespaces. I've tooted this horn before. I think they do it right.

I've got this back burner project I've been noodling about and have been playing with a little bit as of late. We do more-than-the-average locale and internationalization work. Our current UI runs in 17 languages and this list is always growing. I'm tired of creating Locales. I don't like the Locales I create, I make mistakes. I don't like the current Locale model and implementation either.

So there's this thing called Common Language Data Repository (CLDR) and my intent is it codify that. In fact I'd like to take a page from the same book that turned exceptions and announcements into Class based entities.

One of the interesting thing about CLDR is that they use inheritance in their data model to dramatically reduce bloat. For example, there is a generic ENglish locale description. And then there are variants for CAnada and US and other territories. Since most of these modify some minimal amount of attributes of generic english, they inherit from the generic local. There's a "root" that is the base of everything. So one might have a hierarchy that is described as:

  1. root
  2. en
  3. en_us
  4. en_us_posix

Obviously, we throw all of these "classy" locales in a namespace of its own. Then we create a Root class. And an EN subclass of Root. And a US subclass of EN. And Posix a subclass of US. Leaf classes will tend to have minimal overrides of parent methods.

Hopefully, you've seen the problem with this already. It turns out that other languages would have US subclasses as well, in particular ESpanol and HAWaiin. So, for now, I'm stuck making class names like:

  1. Root
  2. EN
  3. EN_US
  4. EN_US_POSIX

If VisualWorks used the same model as Smalltalk/X though..... I'd've been home free.

Read: Namespaces or Classes

Topic: JBuilder is dead Previous Topic   Next Topic Topic: Reading to learn

Sponsored Links



Google
  Web Artima.com   

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