What is the receiver?  There are two and only two relevant objects:
the word and the collection.
aCollection selectAnagramsOf: aString
aString anagramsIn: aCollection
would be good names.  In a language that did not let you extend system classes,
anagrams(of: aString, in: aCollection)
would be good, but Smalltalk is not such a language.

'findAnagramsCandidates:subject:' is intention-revealing, but is not
good English.
Well, maybe the intentions could be revealed a bit better.
What is the subject of an anagram?  No idea.
What is an 'anagramsCandidate'?  No idea.
What is the difference between an 'anagram' and an 'anagramCandidate'?

<whatever> anagramsOf: aString in: aCollection
<whatever> selectFrom: aCollection anagramsOf: aString


On Mon, 6 Jan 2020 at 03:07, Roelof Wobben via Pharo-users
<pharo-users@lists.pharo.org> wrote:
>
> Hello
>
> In a earlier question I get a remark to think better about naming things.
> Now I did  a challene where I have to find anagrams of a given word in a
> collection,
>
> So I did this :
>
> findAnagramsCandidates: aCollection subject: aWord
>      | charBag |
>      charBag := aWord asLowercase asBag.
>      ^ aCollection
>          reject:
>              [ :word | (word sameAs: aWord) or: [ word asLowercase asBag
> ~= charBag ] ]
>
>
> is my naming here better or can i improved and if so how ?
>
> Regards,
>
> Roelof
>
>

Reply via email to