topic-comment naming of functions/methods

Posted by Daniel on Stack Overflow See other posts from Stack Overflow or by Daniel
Published on 2011-01-01T18:46:45Z Indexed on 2011/01/01 18:53 UTC
Read the original article Hit count: 318

I was looking at American Sign Language the other day... and I noticed that the construction of the language was topic-comment. As in "Weather is good". That got me to thinking about why we name methods/functions in the manner of:

function getName() { ... }
function setName(v) { ... }

If we think about naming in a topic-comment function, the function names would be

function nameGet() { ... }
function nameSet() { ... }

This might be better for a class had multiple purposes. IE:

class events {
    function ListAdd();
    function ListDelete();
    function ListGet();

    function EventAdd();
    function EventDelete();
    function EventGet();
}

This way the functions are grouped by "topic". Where as the former naming, functions are grouped Action-Noun, but are sorted by Noun.

I thought this was an interesting POV, what do other people think about naming functions/methods Topic-Comment?

Obviously, mixing naming conventions up in the same project would be weird, but overall?

-daniel

© Stack Overflow or respective owner

Related posts about programming-languages

Related posts about naming-conventions