Mantis issue 69: fast, exciting but weird side effect

in my effort to decouple CardFactory from its implementation, i performed a fairly standard set of refactorings. see below for the list.
the side effect is, forge starts up REALLY fast! but if you start to edit a deck, start a quest, or start a game, you then see the progress bar for loading the cards. this only happens once. if you go back to the main screen and choose a different activity, the progress bar does not appear, and it goes at the normal speed. same as before this change.
this sounds like an improvement to me. the progress bar clearly shows that forge is working OK. and the main screen appeared very quickly before that.
is it OK to keep it like this?
here are the more relevant refactorings i made:
edit: what is happening is this. instead of initializing AllZone.cardFactory at program start up, it is waiting until something calls AllZone.getCardFactory(). code doesn't call this until after the user clicks something on forge's starting screen.
the side effect is, forge starts up REALLY fast! but if you start to edit a deck, start a quest, or start a game, you then see the progress bar for loading the cards. this only happens once. if you go back to the main screen and choose a different activity, the progress bar does not appear, and it goes at the normal speed. same as before this change.
this sounds like an improvement to me. the progress bar clearly shows that forge is working OK. and the main screen appeared very quickly before that.
is it OK to keep it like this?
here are the more relevant refactorings i made:
- move static methods from CardFactory into another class. CardFactoryUtil seemed logical. update all references in all java files to those methods.
- rename CardFactory to AbstractCardFactory but don't update references to it.
- create CardFactory interface that has all of AbstractCardFactory's public methods.
- mark AbstractCardFactory as implementing CardFactory.
- create new class, PreloadingCardFactory, that extends AbstractCardFactory.
- move code that loads all cards at once from AbstractCardFactory into PreloadingCardFactory.
- AllZone.cardFactory is now initialized to null and is no longer final.
- add method AllZone.setCardFactory to allow for dependency injection. which is selection of a specific CardFactory implementation at run time.
- change AllZone.getCardFactory so that, if cardFactory is null, it sets it to a new PreloadingCardFactory(...). this establishes the default if the code chooses not to inject a dependency.
edit: what is happening is this. instead of initializing AllZone.cardFactory at program start up, it is waiting until something calls AllZone.getCardFactory(). code doesn't call this until after the user clicks something on forge's starting screen.