Yup, the use of the singleton. You will need this at some point in your app...e.g. since it's a 2D game you'll only need one playable area/level at a time...so it's wise that you include it in your design to take care of objects that will only have one instance. You can for example name it the GamePlay class (singleton) and in it have a var named level...you get the drift...also really useful for vars you want shared across the whole app without worrying about accidentally creating new instances.
PS: If you need to access a certain variable in class B within class A and you have no foreknowledge of whether class B is initialized, then always use static variables.
e.g if this is java.Within class B I will have
public class B{
.....
public static String accessFromA = "This is from B";
.....
}
from A, i will access it thus
public class A{
.....
String fromB = B.accessFromA;
....
}On Wed, Mar 24, 2010 at 10:32 AM, Frankline Chitwa <frank.chitwa@gmail.com> wrote:
You know you can never plan ahead for everything. You always makethe major plans like how the app will flow, what conditions to set e.g where to save, e.t.c. However, when adding new functionality or when taking care of some bug or e.t.c, you will obviously have to add more variables. However, its always good to start with the whole concept in mind and budget for known issues/functionality.www.golavish.com - The travel and leisure
On Wed, Mar 24, 2010 at 9:58 AM, Wilson Bandi <bandson67@gmail.com> wrote:Am sure you are an OO programmer and therefore just make a smart use the three pillars/concepts of OO ie polymorphism, inheritance and encapsulation.
Best Regards,
Wilson.On Wed, Mar 24, 2010 at 9:26 AM, aki <aki275@googlemail.com> wrote:_______________________________________________I think I'll re-phrase the question incase it was wrong in some way. Ok, coders out there, do you write Variables on the fly i.e add ones as you write code or do you have a plan ahead for the Variables. Variables can be global, public, private and declaring them in the right portion of code will allow/deny access or functionality. How then do you derive the variables because they will be referenced by different tasks or scripts?
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1fbjAwOUE&hl=en
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
--
Kind Regards,
Wilson Bandi
Mobile: +254-726-786481
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1fbjAwOUE&hl=en
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
--
www.raccuddasys.com - code Development issues
--
www.golavish.com - The travel and leisure
www.raccuddasys.com - code Development issues
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1fbjAwOUE&hl=en
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke