> On 5 Jan 2020, at 15:06, Roelof Wobben via Pharo-users 
> <pharo-users@lists.pharo.org> wrote:
> 
> 
> From: Roelof Wobben <r.wob...@home.nl>
> Subject: is this better regarding naming thigs
> Date: 5 January 2020 at 15:06:18 GMT+1
> To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
> 
> 
> 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 ?

It is good.

Possible alternatives: aCollectionOfWords instead of aCollection, I would even 
dare to use words/wordsCollection and word, since I am not a big fan of the 'a' 
and 'an' prefixes. Also the argument to the reject block is often called each 
or eachWord, but this is more of a tradition, word is OK too (but it would then 
conflict with naming the argument word).

> Regards,
> 
> Roelof
> 
> 
> 
> 


Reply via email to