Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this questionI have a class named SSLXMLRPCServ开发者_如何学Cer. Should it be that or SslXmlRpcServer?
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.
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.
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.
The PEP-8 mentions nothing about acronyms. You would be safest to keep the acronyms uppercased (it's what I see most).
I normally uppercase acronyms. Twisted and a few other libraries do this as well.
As stated already, PEP-8 says to use upper-case for acronym. Now, python zen also says "readability counts" (and for me the zen has priority over the PEP :-).
My opinion in such unclear situation is to take into account the standard in the programming context, not just the language. For example, some xml-http-query class should be written XMLHttpQuery
in a servlet context (w.r.t XMLHttpRequest
).
I don't know your context, but it seems XMLRPCServer
exists and you want to attach ssl to it. So you could choose something like:
SSL_XMLRPCServer
It would emphasized the XMLRPCServer
-without changing it-.
Also, you'd stay close to PEP-8 and follow the zen :-)
My 2 cents
Note: if XMLRPCServer
is not strongly related to your class and is really a standard in the domain, then you need to choose another name, as to not be confusing.
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)
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.
精彩评论