javanaming-conventionspluralacronym

Java: Naming convention for plural acronyms


I know there had already been similar discussions on such naming conventions. However, I'm having problem with plural acronyms.

public List<Disc> findAllDvds(DiscHolder holder) {}
public List<Disc> findAllDvd(DiscHolder holder) {}

Assuming that I have decided to use CamelCase for acronyms, which of the two is generally more acceptable?

Edit

I am aware this will invite opinion-based answers, but sometimes when you are in doubt, you just need people to give advises and feedbacks.

To add on, the confusing part here is that findAllDvds can imply a new acronym DVDS, and it can be considered confusing.


Solution

  • The first (findAllDvds). The second (findAllDvd) is simply incorrect, "all" implies more than one, but "Dvd" is singular in English.

    Re your edit:

    the confusing part here is that findAllDvds can imply a new acronym DVDS, and it can be considered confusing

    Since the "all" implies multiple, the "s" on "Dvds" reads as a plural, not part of the acronym. If it really were DVDS, the name would be findAllDvdss or similar.

    It's said that in computer science, there are three hard problems: Cache invalidation, and naming things. (Off-by-one errors are just common, not hard.)