Thread: Naming convention

Naming convention

From
Alvaro Herrera
Date:
Hello hackers,

What's the naming convention for new functions/variables?  I've seen
this_way() and ThisWay() used without visible distinction.  I've used
both in previously submitted and accepted patches...

Does it matter?

-- 
Alvaro Herrera (<alvherre[a]atentus.com>)
"La libertad es como el dinero; el que no la sabe emplear la pierde" (Alvarez)


Re: Naming convention

From
Tom Lane
Date:
Alvaro Herrera <alvherre@atentus.com> writes:
> What's the naming convention for new functions/variables?  I've seen
> this_way() and ThisWay() used without visible distinction.  I've used
> both in previously submitted and accepted patches...
> Does it matter?

Consistency?  We don't need no steenking consistency ;-)

Seriously, you can find a wide range of naming conventions in the PG
sources.  It might be better if the range weren't so wide, but I doubt
anyone really wants to engage in wholesale renaming (let alone getting
into the flamewars that would ensue if we tried to pick a One True
Naming Style).

I'd suggest conforming to the namestyle that you see in code closely
related to what you are doing, or at least some namestyle you can find
precedent for somewhere in the backend.  Beyond that, no one will
question you.

My own two cents: pay more attention to the semantic content of your
names, and not so much to how you capitalize 'em.  FooBar() is a useless
name no matter how beautifully you present it.
        regards, tom lane