Singletons and you
Post MTG Forge Related Programming Questions Here
	Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
			2 posts
			 • Page 1 of 1
		
	
Singletons and you
 by Max mtg » 23 Oct 2012, 19:19
by Max mtg » 23 Oct 2012, 19:19 
Hey guys, 
Please, don't write those ugly Singeltons.getModel.getGameState in your added code if there already is local variable holding that game or a class member with reference to current game you can use.
And whenever there are more than 2-3 references to Singeltons.getModel.getGameState in a single method, consider declaring a variable to hold the value you are fetching from singletons so many times.
			Please, don't write those ugly Singeltons.getModel.getGameState in your added code if there already is local variable holding that game or a class member with reference to current game you can use.
And whenever there are more than 2-3 references to Singeltons.getModel.getGameState in a single method, consider declaring a variable to hold the value you are fetching from singletons so many times.
Single class for single responsibility.
		- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Singletons and you
 by Hellfish » 23 Oct 2012, 19:23
by Hellfish » 23 Oct 2012, 19:23 
Noted. *Changes last commit*
			So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
		Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
- 
				 
 Hellfish
- Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
			2 posts
			 • Page 1 of 1
		
	
Who is online
Users browsing this forum: No registered users and 28 guests
