The fickle properties file.
This is one area where serious thinking needs to be done. I have seen lot of people cringe over this but yet they keep going on. Biggest problem I find in a property file is APP VERSION and APP CONSTANTS.
Your mate comes gives you a version and you start out code, after few months you have a small functionality to develop and you have to use the same constants. Then few months down the line you have another HOT NEWS, part of the code you have to add into some other part of code and that new code too has got a VERSION. Only thing you can do is bang your head to a wall.
Another annoying thing people do, property.getProperty(AppConstants.SOME_VALUE) lying all around the code. Then they complain if a constant changes due to TYPO or wrong constant name selection, compile the whole thing and build again as compiler puts the String constants all over the place.
Peace!!!!!!!!
To limit the causality of my brain cells, I got close to , make a single (may be singleton, yes yes I said singleton dont frown on me) class file with getters to all properties right there with string constants encapsulated well in that class itself. So if i need a property from properties file, I'll rather say
AppProperties.instance.getRepositoryLocation()
with all the property file stuff encapsulated in that AppProperties class.
One thing I cringe for is AppVersion, all the time we talk about reuse, seniors spend most of time dealing with it in the end what we have is AppVersion, at the max we could have ComponentVersion.
Your mate comes gives you a version and you start out code, after few months you have a small functionality to develop and you have to use the same constants. Then few months down the line you have another HOT NEWS, part of the code you have to add into some other part of code and that new code too has got a VERSION. Only thing you can do is bang your head to a wall.
Another annoying thing people do, property.getProperty(AppConstants.SOME_VALUE) lying all around the code. Then they complain if a constant changes due to TYPO or wrong constant name selection, compile the whole thing and build again as compiler puts the String constants all over the place.
Peace!!!!!!!!
To limit the causality of my brain cells, I got close to , make a single (may be singleton, yes yes I said singleton dont frown on me) class file with getters to all properties right there with string constants encapsulated well in that class itself. So if i need a property from properties file, I'll rather say
AppProperties.instance.getRepositoryLocation()
with all the property file stuff encapsulated in that AppProperties class.
One thing I cringe for is AppVersion, all the time we talk about reuse, seniors spend most of time dealing with it in the end what we have is AppVersion, at the max we could have ComponentVersion.
Labels: java, properties