0

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

  • Rectangle
  • RectangleRounded
  • RectangleInflated

or (more easy to read in fluent English)

  • Rectangle
  • RoundedRectangle
  • InflatedRectangle

?

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

Thanks.

abenci
  • 8,422
  • 19
  • 69
  • 134
  • [dont ask](https://stackoverflow.com/help/dont-ask): "If your motivation for asking the question is “I would like to participate in a discussion about ______”, then you should not be asking here" and if you're looking for a [discussion elsewhere](https://stackoverflow.com/help/on-topic) "Questions asking us to recommend or find a book, tool, software library, tutorial or *other off-site resource* are off-topic for Stack Overflow" – Damien_The_Unbeliever Nov 21 '18 at 12:26
  • Unrelated note about the [tag:visual-studio]. If you read the description, it says *DO NOT use this tag on questions regarding code which merely happened to be written in Visual Studio.*, so it should not be used in this question. – Richardissimo Nov 21 '18 at 20:54

2 Answers2

1

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.

Peter Macej
  • 4,831
  • 22
  • 49
0

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.

Community
  • 1
  • 1
RUL
  • 268
  • 2
  • 12