W3C home > Mailing lists > Public > public-device-apis@w3.org > May 2010

Property names vs. interface names

From: Max Froumentin <maxfro@opera.com>
Date: Mon, 10 May 2010 15:38:11 +0200
Message-ID: <4BE80C43.6040200@opera.com>
To: public-device-apis@w3.org
CC: Innovimax SARL <innovimax@gmail.com>
So let me ask at large, and summarise the issue.
SysInfo deals with Properties (CPU, PowerSource, InputDevice)
which are named in function calls, e.g. get("CPU", callback).
The callback then receive an object that represent that property,
defined by an interface, e,g,
interface CPU {
   float load
}

Using the same name for the property and its interface is confusing (for 
reasons explained in this thread). So what's a good way of naming them?

Property PropCPU vs. interface CPU?
Property CPU vs. interface IntCPU?
Property PropCPU vs. interface IntCPU?
...

Max.



>>>>> 2) Can it be said explicitely that the name of the Property (the
>>>>> property ID) is the same as the name of the Interface that the
>>>>> onSuccess function will get
>>>>
>>>> No, it's not always true. For instance, property AmbientLight (and all
>>>> the
>>>> other sensors) are based on interface Sensor.
>>>
>>> Uhm...indeed. Ok but there is certainly room for clarification here.
>>> Dunno how for the moment.
>>
>> Perhaps it would be better to call interfaces and property something
>> explicitely different? Like CPUInterface and CPU, respectively (or with
>> better names)?
>
> That seems to be a good direction. Probably, you should implement it
> that way (XXX and XXXInterface) and let the people come up with better
> naming strategy
Received on Monday, 10 May 2010 13:38:49 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:53:43 UTC