I've been working on a small Java project by myself for a department that does not do a lot of software development but mostly database stuff.
I showed my boss the code I've been writing and he saw that in some classes there were some static variables. He then told me to put the static variables in XML instead to make it "easier."
He left and I did not get to ask him how it makes them manageable. He's going to be gone for a couple of weeks.
I know this might be a pretty vague question but what could possibly be the reasons why he would tell me to put static variables into XML? And how do I go about doing them?
First, I had something like this:
private final static String[] ACCESS_EXTENSIONS = {"accdb", "mdb"};
After he told me about putting static variables in an XML file, I wrote an XML code:
<input_filetypes> <filetype id = "access"> <title>Access Database</title> <extension>accdb</extension> <extension>mdb</extension> </filetype> <filetype id = ....> .... </filetype> ...... </input_filetypes>
But then this resulted to me creating a static String variable that contains the location of my XML file:
private final static String xmlFile = "location_of_my_xml_file";
I also learned about how to use XPath to access data in my XML, but I ended up writing another static code which is:
private final static String GET_ACCESS_EXTNS_EXP = "input_filetypes/filetype[@id='access']/extension";
Now I think I made things worse. I know I should wait for him to get back to clarify, but that is a long time from now, and I think it's best if I start reading up while waiting. I just need ideas on where to start.