Page 1 of 1

Mantis issue 69: fast, exciting but weird side effect

PostPosted: 26 Jul 2011, 02:47
by Braids
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:
  • 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.

Re: Mantis issue 69: fast, exciting but weird side effect

PostPosted: 27 Jul 2011, 21:25
by Chris H.
Braids wrote:the side effect is, forge starts up REALLY fast!
`
I like the quick start up feature.

Re: Mantis issue 69: fast, exciting but weird side effect

PostPosted: 27 Jul 2011, 22:10
by Braids
two votes is a quorum! ship it! :-D

could you check one of my commits? i am not sure if i put the fluffy text in the right place. https://www.gitorious.org/cardforge/cardforge/commit/2e5122c95b4bedd2f54f18c5e39133873d5ca911

Re: Mantis issue 69: fast, exciting but weird side effect

PostPosted: 27 Jul 2011, 22:50
by Chris H.
Braids wrote:two votes is a quorum! ship it! :-D

could you check one of my commits? i am not sure if i put the fluffy text in the right place. https://www.gitorious.org/cardforge/cardforge/commit/2e5122c95b4bedd2f54f18c5e39133873d5ca911
`
Thank you for the contribution. I moved your material. I like to put the fluff stuff just underneath the total number of cards in forge. This places the fluff above the technical Fixes/Features section.

Re: Mantis issue 69: fast, exciting but weird side effect

PostPosted: 27 Jul 2011, 22:56
by Braids
thanks!