[getdns-api] API review section 3.1.2 and 3.1.3

Goyal, Neel ngoyal at verisign.com
Thu Jan 30 09:54:27 MST 2014


On 1/30/14, 11:39 AM, "Ray Bellis" <Ray.Bellis at nominet.org.uk> wrote:

>
>On 30 Jan 2014, at 16:32, Paul Hoffman <paul.hoffman at vpnc.org> wrote:
>
>> 
>>> 3.1.3 also makes sense to me - the verb should come first followed by
>>>the object beign operated on.  This primarily affects the context
>>>methods (i.e. getdns_context_create => getdns_create_context,
>>>getdns_context_set_resolution_type =>
>>>getdns_set_context_resolution_type).  Many code style guidelines follow
>>>this idiom.
>> 
>> Sure, whatever. This helps literally no one after the first few minutes
>>of them learning the API, but it seems like a harmless change.
>
>What about IDEs with autocomplete?
>
>Do people think about the type first, and then what action
>(getdns_context_set ...) or the action followed by the type
>(getdns_set_context...)
>
>Personally, I *think* I would normally do the former - I kind of like all
>of the methods on a type to be grouped lexically.  It's probably also
>more consistent with C++ where the type (or more accurately an instance
>of the type) comes first:
>
>    getdns_context_set_resolution_type becomes context.set_resolution_type
>
>Ray

You bring up some great points and they make a lot of sense now that I
think about it from that angle.  Looking at some other popular pure C
apis, it seems they also follow the type_verb idiom (glib, GTK, cairo,
etc.). I¹m sure there are others that do the opposite.  Admittedly, I am
not tied to either way, but as a coder, I do like your reasoning.  Thanks
for the useful feedback.




More information about the getdns-api mailing list