Mantis issue 69: fast, exciting but weird side effect
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
5 posts
• Page 1 of 1
Mantis issue 69: fast, exciting but weird side effect
by Braids » 26 Jul 2011, 02:47
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.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Mantis issue 69: fast, exciting but weird side effect
by Chris H. » 27 Jul 2011, 21:25
`Braids wrote:the side effect is, forge starts up REALLY fast!
I like the quick start up feature.
-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: Mantis issue 69: fast, exciting but weird side effect
by Braids » 27 Jul 2011, 22:10
two votes is a quorum! ship it!
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

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
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Mantis issue 69: fast, exciting but weird side effect
by Chris H. » 27 Jul 2011, 22:50
`Braids wrote:two votes is a quorum! ship it!![]()
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.
-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: Mantis issue 69: fast, exciting but weird side effect
by Braids » 27 Jul 2011, 22:56
thanks!
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 36 guests