On Sat, 16 Oct 2021 10:48:32 GMT, Mark Sheppard <mshep...@openjdk.org> wrote:

> What’s in a name? I find the method names of the InetAddressResolver 
> interface a bit ambiguous. Typically in this DNS problem space one speaks of 
> lookup to resolve a hostname to its associated addresses and reverse lookup 
> to resolve an IP address to a hostname (or names) associated with it.

I'm not sure that I see an ambiguity here:
Interface has two methods, both are for lookup operations. That is why `lookup` 
word is used in both names. Then we put a description of a returned result 
after operation name: `Addresses` and `HostName` are the results. In cases when 
we want to highlight a parameter type in a method name we can use ‘by’/‘with’ 
prepositions: for instance, `InetAddress.getByName` `InetAddress.getByAddress` 
`ScheduledExecutorService.scheduleWithFixedDelay`.

We can try and apply this approach to the description of DNS operations above:
> lookup to resolve a hostname to its associated addresses 

operation: `lookup` result: `addresses` -> methodName: `lookupAddresses`

> reverse lookup to resolve an IP address to a hostname

operation: `lookup` (we've dropped reverse word here) result: `hostname` -> 
methodName: `lookupHostName`

-------------

PR: https://git.openjdk.java.net/jdk/pull/5822

Reply via email to