Controls with Values [was Possible additions to JavaFX to facilitate forms and validations]

Richard Bair richard.bair at oracle.com
Wed Dec 7 10:52:16 PST 2011


> interface HasData<T> {
>  Property<T> dataProperty	
> }
> 
> interface HasMultipleData<T> {
>  ObservableList<T> getMultipleData
> }
> 
> interface HasItems {
>  ObjectProperty<ObservableList<T>> itemsProperty
> }
> 
> (I'd consider naming them DataHolder, MultipleDataHolder, ItemsHolder instead, but that's cosmetics.)

Actually, that is the thing that bothers me here. The HasData is kind of an awkward name, so what would I rather have called it? ValueHolder (or DataHolder, that's fine). But wait! We've already got one of those called ObservableValue! That's where I think the naming is actually quite instructive. Actually what is interesting is that in some sense this is an argument that "Oh dang, you guys should have used the name 'value' or 'data' consistently!", such that instead of having TextField.text, it would have been TextField.value. Had we been so strict, overlaying an interface that essentially redefined the naming convention would have been pretty clean.

Lacking that, I do like "value" better than "data", as I have tended to use the name "data" for "application data" or "domain data". Value also will actually work in some cases (such as Slider). However, I don't like the name HasValue. "Valuable" just made me chuckle. Coming up with a good name is a good indication of whether the concept itself is right (or in some cases English just lacks the right name for the concept).

Dan, can you recapitulate the use case?

Richard


More information about the openjfx-dev mailing list