I’ve decided to knock a bad habit of using too many static constants in my code. A Config VO provides a less coupled but also injectable recipe. To enforce ‘read-only-mode’ the config VO is mapped to an interface.
In Robotlegs, to map to interface we use mapSingletonOf:
The interface enforces the usage of getters only in our ConfigVO class and could for example look like:
What’s needed in our ConfigVO implementation should be evident from the IConfig Interface. Dependency Injection now makes it a breeze to access the ConfigVO from any Model:
public var configVO:IConfig;
Where we type the instance to the Interface!
-(Thanks to RL forum support for clearing out my confusion about this).