3 ms·
You just made TWO typos: "display-name" vs "display_name" and "_name" vs "name", automatically counter-argumenting your point. It is also for documentation. Wi
by lanna 1y ago
You just made TWO typos: "display-name" vs "display_name" and "_name" vs "name", automatically counter-argumenting your point.
It is also for documentation. With the declared constants, we know all possible values. With plain strings, how am I supposed to know which values to use?
The benefits far outweigh the marginal cost.
- ramsicandra 1y agoThe -, _, and leading _ are just variations of white space / separator I have encountered. I think it's possible to document all the allowable values in the Javadoc section of the function that takes in string as their argument. In the specific android example, I would put it here. Under projection params where it takes in all the Images.Media.* string consts. https://developer.android.com/reference/android/content/ContentResolver#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal) https://developer.android.com/reference/android/content/Cont... Though, if it's a practice of Java Engineer to document allowable enum like string as a constant, then I can say that's a valid argument.