-1

I was wondering what the naming convention is in instances where you pretty much have to use an acronym in the class name. I read the oracle documentation here but it did not offer much help.

Usually I name classes starting with an uppercase character and uppercase characters for each subsequent word (when there are no acronuyms), but in this case URLfinder is arguably more legible than URLFinder.

I don't want to use UniformResourceLocatorFinder because it is too verbose.

ForeverStudent
  • 2,487
  • 1
  • 14
  • 33
  • URLFinder would be good. some do UrlFinder – jtahlborn Mar 30 '16 at 17:25
  • 1
    OT, and dupe of http://stackoverflow.com/q/2236807/438992, http://stackoverflow.com/q/8277355/438992, http://stackoverflow.com/q/5704737/438992, http://stackoverflow.com/q/20046262/438992, etc. – Dave Newton Mar 30 '16 at 17:27

1 Answers1

2

Neither; it should be UrlFinder.

This also avoids unfortunate names like XMLHTTPRequest, e.g., XmlHttpRequest, when common-sense naming says you have to glom them together.

Stuff in the Java APIs are inconsistent (e.g., HttpURLConnection).

The only way to make it right across everything is to treat acronyms as words.

Also, searched this on the interwebs and found this discussion that says what I'm saying above but better and longer. It mentions things like HTTPSID: is that HttpSid or HttpsId? Only by treating acronyms as words can they be meaningfully distinguished.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302