From: Erik V. <eri...@hc...> - 2006-07-11 20:24:41
|
> I've noticed that we've got a ton of constants that are duplicated > across our source tree. > > Does anyone object to me creating a single Constants class-file that > holds all of these items and relocating all of our constants into this > central file? I presume you are only talking about public constants. Protected and private ones have only local significance and should stay where these are anyway. Displayed texts should not be constants but be made localisable by defining these in LocalisedText.properties, and retrieved via Game.getText(). For the rest I concur with John: it is generally better to keep constants related to classes where they logically belong to. Perhaps the keys of the localisable texts are an exception, I can imagine putting all these in one class LocalText or such (this is also the kind of constant that will suffer most from duplication). Game.getText() could then be moved to that class. Erik. |