My team is working on an android app. A co-worker and I have different ideas on how to load constant data.
To clarify, the data we are going to use
- are
100 × (n × 〈integer-integer pair〉) where 10 < n < 20
; not so many, are rarely going to be edited in the future,- are supposed to be literally constant unless any single value is wrong,
- are that the end users never need a direct acceess/modification to.
She suggested we put them in an XML, load & parse it during runtime in the name of "maintenance".
The data is actually light so XML parsing is not a big deal. However, doing unnecessary runtime tasks only to not mess up the code doesn't make sense to me. I'd rather write a simple program to read the raw data and spit out code to paste in.
input:
0 253
1 5150
2 6666
1 8126
3 11949
…
output:
arrays.add(new Pair(0, 253));
arrays.add(new Pair(1, 5150));
arrays.add(new Pair(2, 6666));
arrays.add(new Pair(1, 8126));
arrays.add(new Pair(3, 11949));
…
She is more experienced than me by a decade so I might be ignorant.
Can her approach ever be a good practice even though the data is not accessible from the user?