Naming interfaces for persistent values
- by orip
I have 2 distinct types of persistent values that I'm having trouble naming well.
They're defined with the following Java-esque structure, borrowing Guava's Optional for the example and using generic names to avoid anchoring:
interface Foo<T> {
T get();
void set(T value);
}
interface Bar<T> {
Optional<T> get();
void set(T value);
}
With Foo, if the value hasn't been set explicitly then there's some default value available or pre-set.
With Bar, if the value hasn't been set explicitly then there's a distinct "no value" state.
I'm trying to optimize the names for their call sites. For example, someone using Foo may not care whether there's a default value involved, only that they're guaranteed to always have a value.
How would you go about naming these interfaces?