Thursday, June 03, 2004

Why isn't there a naming convention for APIs?  

I was working on an API and had trouble picking a name for
a particular operation (which we'll call, say, "getCurrentText"
for sake of argument). TheFullyExplicitName was a little long
and unwieldy and I hve vry strng f3l'ns agst Un*x stle abbrs,
so I wanted to derive a simple text name that fits with the
rest of the API (read, readLine, isMoreNeeded).

So I ferret around on the web and find a few interesting
resources:

Java Collections API Design FAQ

API Design with Java

but no good resource for overall API names.

It seems to me there should be a standard lexicon of API
names. Just as there are standards for names in given languages
(e.g., getX/setX in Java, get/set properties in C#, -p predicates
in Lisp, isX for predicates in Java-like languages, etc.) there should
be standard names we can use for APIs with standard definitions

read/write or read/print

open/close

clear

iterator/hasNext/next

and so on. I guess there need to be two parts to this library:
the semantic list of terms that are common to many APIs, and
standard names that have maximum usage across the API's
semantic contents.

Anyway, just rambling.

Labels:

Comments:

This page is powered by Blogger. Isn't yours?