Appearance Design Pattern Implementation Inconsistencies?
I'm posting because I've been working with the GXT 3 Appearances and I'm seeing a variety of implementation strategies in regards to the resource and instance management within the various types.
With the com.sencha.gxt.core.client.resources.ThemeStyles.ThemeAppearance implementation there is a clean, and IMO, good implementation of the Singleton creational design pattern. The TemeStyles class has a private static ThemeAppearance instance that is initialized at the class level. Then the ThemeStyles.get() exposes the instance and the ThemeStyles.Styles is exposed from the instance. This is great because it allows for efficient resource management and referencing the ThemeAppearance resources from UIBinder etc...
A similar implementation of an Appearance is the com.sencha.gxt.core.client.resources.CommonStyles.CommonStylesAppearance. There is a difference in the singleton design pattern implementation though which seems a bit unfortunate. The CommonStyles.get() exposes only the CommonStyles.Styles type which doesn't allow for API access to the actual CommonStylesAppearance and related resources.
As I dig into the many other implementations of Appearances (and their associated resources and styles etc...) I don't see any real consistency with the implementation details of instance management. In many cases the different constructors simply instantiate via GWT.create() instance based versions of the resources with no consideration (I think) to sharing the resources in a flweight'ish/singleton creational pattern manner.
I'm posting because I'd like to find out if there are plans to clean up and standardize the creational and management patterns used within the GXT Implementations of the Appearances. If they were consistent, it would allow us to plan our use of existing Appearances and extensions of them to be cleaner and more consistent.
Tags for this Thread