I have this abstract class that is used as data repository.
public abstract class AbstractDataSource {
public abstract DataRow getDataRow(Key key); //or just dataRow(Key key)???
}
public class CSVDataSource extends AbstractDataSource {
@Override
public DataRow getDataRow(Key key) { //or just dataRow(Key key)??
//fetch row from file and return dataRow
//....
return dataRow;
}
}
More specific classes (i.e. subclasses of this class) implement methods for different data source, e.g. CSV, ARFF and other formats.
I was wondering if the "get"-Keyword is appropriate here, as the data retrieval is not just returning a variable, but could also require filesystem access or whatsoever.
So should I use the "get"-prefix or not?
Thanks
I agree that using the get
keyword can sometimes seem non-intuitive when there's real logic behind. In your case lookup
or find
prefixes could be good substitues. There's also retrieve
as suggested by @Thomas.
This question might seem off topic at first. But naming is, at least to me, an integral part of good application design.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With