abenci
abenci

Reputation: 8651

API methods family naming rules

Would you call a family of API methods (more easy to find for programmers)

or (more easy to read in fluent English)

?

Where can I find a pros vs. cons discussion about this topic?

Thanks.

Upvotes: 0

Views: 65

Answers (2)

Peter Macej
Peter Macej

Reputation: 5577

Microsoft recommends (and uses in .NET framework) the form: RoundedRectangle.

MS provides very usefull Naming Guidlines document. You can find the following in Names of Classes, Structs, and Interfaces chapter:

CONSIDER ending the name of derived classes with the name of the base class.

Upvotes: 1

RUL
RUL

Reputation: 278

It's hard to find something, that specifically talks about your exact topic, but I found this, which merely addresses your question:

  • ThingAbstract: "Abstract" suffix. Unnatural language. Appears next to ThingInterface in file listings.
  • AbstractThing: "Abstract" prefix. Natural language. Far off from ThingInterface in file listings.

Source: https://www.drupal.org/project/coding_standards/issues/1567920

Beside the mentioning of the naturalness, it talks about the listing order, which could help understanding the structure of a project (alltough subfolders should compensate for that).

Here is another answer on stackoverflow, which states

As for the names of classes, it would be typical to prefix the class name with the specialization [..]

Source: The C# namespace and class/sub-class naming conventions when the top namespace contains the base class and inner namespaces contain sub-classes


I think, it's mostly opinion based and personally I would prefer the second way (RoundedRectangle) as it is more natural to read and therefore to understand. Also I think (and as I read often online), we should try to make the class names as significant as possible.

Upvotes: 0

Related Questions