[libvirt] [PATCH v2] Document preferred naming conventions

Daniel P. Berrange berrange at redhat.com
Fri Mar 3 19:16:58 UTC 2017


On Fri, Mar 03, 2017 at 07:57:24PM +0100, Jiri Denemark wrote:
> On Fri, Mar 03, 2017 at 17:47:23 +0000, Daniel P. Berrange wrote:
> > This documents the preferred conventions for naming files,
> > structs, enums, typedefs and functions.
> > 
> > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > ---
> > 
> > Changed in v2:
> > 
> >  - Fix typo
> >  - Add macro docs
> >  - Clarify that $VERB is always last in function/macro names
> 
> Hmm, so what do we do if there is an object, an action, and a subject?

Good question :-)

> Typically accessors which are designed to return some specific part of
> the object. For example,
> 
>     virQEMUCapsGetDefaultMachine
>     \         / | \            /
>        object   |    subject
>                 |
>                 `- action (verb)
> 
> Are we supposed to name such function as virQEMUCapsDefaultMachineGet?
> While it is certainly possible, it just doesn't read well.

Yeah that's craziness in that example at least. Do you recall any examples
where we have object,subject,action, or are we always doing
object,action,subject ?

We could specify object,action,subject, or we could just say either
ordering of action & subject is valid.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|




More information about the libvir-list mailing list