views:

121

answers:

7

I have a class named SSLXMLRPCServer. Should it be that or SslXmlRpcServer?

+1  A: 

I normally uppercase acronyms. Twisted and a few other libraries do this as well.

aaronasterling
+6  A: 

This is a matter of personal preference, but I find the second format much easier to read. The fact that your first format has a typo in it (PRC instead or RPC) suggests that I am not the only one.

Dave Kirby
.NET has an interesting take at it: 2-letter components are uppercased (most notably `IO`; I don't recall seeing any other one in 2 letters, actually), but everything else is Pascal-cased, so `Xml`, `Rpc`, `Ssl`, `Http` etc. Sounds weird, but I the people who wrote it originally just couldn't stand the pain looking at `Io`.
Pavel Minaev
+1  A: 

The PEP-8 mentions nothing about acronyms. You would be safest to keep the acronyms uppercased (it's what I see most).

ikanobori
You mean, it doesn't mention it except for *Note: When using abbreviations in CapWords, capitalize all the letters of the abbreviation. Thus HTTPServerError is better than HttpServerError.* certainly... :) (It should be noted that I disagree with this recommendation.)
dash-tom-bang
A: 

I had this problemlots of time . I uppercase Acronym but I doesn't like it because when you chain them (as in your example) it doesn't feel right. However I think the best things to do is to make a choice and stick to hit, so at least don't you know when you need to reference something how it's written without having to check (which is one of the benefit of coding standard)

mb14
It doesn't feel right until you decide to start doing it. Then you get really irritated by software that jams acronyms together making them impossible to parse.
dash-tom-bang
Except in our case : SSLXMLRPCServer is just really hard to read, and so can't feel right (even if it's the best solution)
mb14
+3  A: 

The problem with uppercase acronyms in CamelCase names is that the word following the acronym looks like a part of it, since it begins with a capital letter. Also, when you have several in a row as in your example, it is not clear where each begins. For this reason, I would probably use your second choice.

kindall
+3  A: 

It should be SSLXMLRPCServer, to match the standard library classes like SimpleXMLRPCServer, CGIXMLRPCRequestHandler, etc.

Adopting a naming convention that differs from equivalents in the standard library is only going to confuse people.

Porculus
A: 

How about SSL_XML_RPC_Server for acronymity and readability?

It's what I often do when I want to avoid camel-case for some reason.

martineau
I think mixing camel case and snake case, is the worth you can do. In my opinion, you should choose one way of naming stuff and stick to it, without exception.
mb14