My teammate has this class which contains a lot of Strings
:
public class Config {
/**
* List of status
*/
public static final String IN = "bla*";
public static final String LUNCH = "bla*";
public static final String OUT = "*bla";
public static final String MEETING = "*bla";
public static final String COFFEE = "*bla";
public static final String ON_BREAK = "bla*";
public static final String WORKING = "bla*";
public static final String ON_MEETING = "bla*";
public static final String IDLE = "bla*";
}
The above is just a sample. It also contains Strings
of URLs
and also Strings
of sentences.
What would be the better way to store them?
What I've been initially doing as a refactoring process is I stored all the URLs in an application.properties
file. Then I access them via Spring's @ConfigurationProperties
. (Some URLs
have tokens)
There's also a list of status as you can see above which are made up of an average of 2-10 letters. I've decided to create a Status
enum containing these values.
Am I doing the right thing? Or should I just store all of it inside a json/csv?
Though I'd mainly want to know about where to store URLs
. We're using around 7-10 URLs
. (It's said to be the microservices we're calling, i don't really know about that as I don't have much experience in programming yet.)
Note: I'm not talking about which code will be better, rather I want to know if one way is more efficient than the other. Yeah, it could be based on personal taste. But performance results and future maintenance can say otherwise.
Your peer tells you after reviewing the code.
We don't have code review. GASP Yeah I know. There's only two of us, I just transferred here, and apparently this is the situation. – Rigo Sarmiento Nov 20 '18 at 06:45