Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

There is a word which I can never remember... it expresses a design goal that API calls (or functions or methods or whatever) should be as similar as reasonably possible in their argument patterns. It may also extend to naming as well. In other words, all other things being equal, it is probably bad to have these three functions:

deleteUser(email)
petRemove(petId,species)
destroyPlanet(planetName,starName)

if instead you could have

deleteUser(userId)
deletePet(petId)
deletePlanet(planetId)

What is the word for this concept? I keep thinking it's "orthogonal" but it definitely isn't.

Its a very important concept, and to me it's one of the biggest things that makes some APIs a joy to work with (because once you learn a few things you can pretty much use everything without looking at doco), and others a pain (because every function is done inconsistently).

share|improve this question
2  
"Orthogonal" might be the word to use if you had several different actions, and several different object types, and the API allowed any action to be performed on any object type. –  Mike Seymour Mar 11 '11 at 0:40
3  
Consistenciness –  JeffO Mar 11 '11 at 1:31
    
@mike, you might be right that this was how the word "Othogonal" got into this slot in my brain... still, I have this recollection that there is a fancy word just for this concept... –  joe larson Mar 11 '11 at 17:44
add comment

10 Answers

up vote 17 down vote accepted

If I was talking about that concept, I'd just call it "consistency." For example, I hear a lot of complaints about API X or library Y having an inconsistent interface that makes it hard to work with.

share|improve this answer
1  
I'm calling this the answer for the time being, though I really think there is a fancy academic word for it... on the other hand, common words are probably better anyway –  joe larson Mar 11 '11 at 17:45
add comment

There are many words that could fit your query. My guesses are:

  • "Uniformness"
  • "Homogeneous"
  • "Consistency"
share|improve this answer
add comment

Thesaurus.lookup('consistent');

Also, please, stop trying to find fancy academic words to describe simple concepts, your goal should be to communicate with clarity and be broadly understood, instead of trying to sound smart.

share|improve this answer
add comment

The main difference between your two examples is that one fits better into an English sentence and the other does not.

I want to delete the record. --> deleteRecord()

Can you add me as a user to the list? --> addUserToList()

Process that data before you clock out! --> processData()

It's awkward to do the reverse:

recordDelete() --> I don't want you to record delete? Huh?

userAdd() --> How do you use these two -- in order -- in a sentence that makes sense?

dataProcess() -> This is a noun. This is why it doesn't work. They're all nouns! Methods should be verbs.

When thinking about naming conventions for methods, just try using it in a sentence. After all, it's how we communicate, so if you use those concepts in your methods, it will be easier to stay consistent and readable.

share|improve this answer
    
"I have a new user to add to the system." :-) –  Brian Mar 11 '11 at 3:28
1  
@Brian that is a statement, not an action or behavior. This is why methods are better named as verbs (or verb clauses) as they fundamentally represent execution, not declaration (and similarly why classes are better named as nouns). –  Les Hazlewood Sep 21 '13 at 4:25
add comment

Consistent signature for API calls

share|improve this answer
add comment

I usually hear it called standardization or sometimes standardizing.

Edit Oh there have been other times where it was referred to as the 'naming convention'.

share|improve this answer
add comment

I am not familiar with an official term, at least not from the research literature (I come from an API usability research background). As in many things in usability, there are different terms. The most common ones are "consistency", though I have seen "symmetry" thrown around. Symmetry is not a good match, IMHO, since it refers to a specific subset (e.g., symmetry in arguments).

share|improve this answer
add comment

Symmetrical?

Consistent?

Lots of words mean "Similar".

share|improve this answer
add comment

I like the verb/object naming for methods:

AddUser(user) adds a user to the present object. DeleteUser(user) deletes a user from the present object.

Keep the # of verbs short. Don't use "Remove" or "Erase" when you could use "Delete". One reason for this is that when you use an IDE and want to add something to an object, you just type "a" and look in the Add* methods to find the one you want. Beats looking for Add*, or Append*, or what have you.

There was a recent post about designing APIs. Read it.

share|improve this answer
add comment

Not sure of the word you're looking for, but it seems to include the concept of "parallelism" - the same rule you want to follow when making a list, where you want to be sure all points start with the same part of speech and the verbs are all in a consistent tense.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.