简体   繁体   中英

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.

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.)

This is a really opinion based question and could be closed.

However, this should be the correct version:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM