It is currently 31 Oct 2025, 14:01
   
Text Size

Singletons and you

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins

Singletons and you

Postby 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.
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

Postby 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
User avatar
Hellfish
Programmer
 
Posts: 1297
Joined: 07 Jun 2009, 10:41
Location: South of the Pumphouse
Has thanked: 110 times
Been thanked: 169 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 39 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 39 users online :: 0 registered, 0 hidden and 39 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 39 guests

Login Form