Re: [Pharo-users] is this better regarding naming thigs

2020-01-08 Thread tbrunz
Richard O'Keefe wrote > Seriously, sometimes it's worth it to write good code and then write > glue code to the required interface. Maybe "most of the time". Or "It's almost always worth it". Why practice bad habits? We should reinforce writing good code -- there's not enough of it out there.

Re: [Pharo-users] is this better regarding naming thigs

2020-01-08 Thread Richard O'Keefe
I should have remembered that, seeing that I've done 41/42 of the Pharo exercisms, and am currently doing the F# ones in my spare time, which I have had very little of lately. I have started using the annotation in such cases to remind me not to fix the code. Looking back at my solution, I see t

Re: [Pharo-users] is this better regarding naming thigs

2020-01-06 Thread xap
richard, fwiw Roeloff mentioned earlier that the message-name was provided by the exercise set he's following, and isn't of his invention: http://forum.world.st/is-this-better-regarding-naming-thigs-tp5109389p5109471.html . he sh/could fwd your note/s to the course-author ;) -- Sent from: http:/

Re: [Pharo-users] is this better regarding naming thigs

2020-01-06 Thread Richard O'Keefe
When I wrote "is not good English", I meant that "findAnagramsCandidates" sounds *horrible* to this native speaker of English. "findCandidateAnagrams" works. On Tue, 7 Jan 2020 at 18:12, Richard O'Keefe wrote: > > What is the receiver? There are two and only two relevant objects: > the word and

Re: [Pharo-users] is this better regarding naming thigs

2020-01-06 Thread Richard O'Keefe
I've always considered "all objects respond to #value" as a bug. It certainly is not portable: it wasn't in Smalltalk-80, or Apple Smalltalk, or ANSI Smalltalk, and it isn't in GNU Smalltalk or Dolphin Smalltalk or VisualWorks. It's a peculiarity of Squeak/Pharo and Smalltalk/X. This is a misfeatu

Re: [Pharo-users] is this better regarding naming thigs

2020-01-06 Thread Richard O'Keefe
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

Re: [Pharo-users] is this better regarding naming thigs

2020-01-06 Thread Roelof Wobben via Pharo-users
--- Begin Message --- Thanks. I have missed that one. Thanks for pointing it to me. Roelof Op 6-1-2020 om 13:13 schreef xap: Here's the permalink to Sven's response (in case it still isn't visible to you): http://forum.world.st/is-this-better-regarding-naming-thigs-tp5109389p5109392.html -

Re: [Pharo-users] is this better regarding naming thigs

2020-01-06 Thread xap
Here's the permalink to Sven's response (in case it still isn't visible to you): http://forum.world.st/is-this-better-regarding-naming-thigs-tp5109389p5109392.html -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Re: [Pharo-users] is this better regarding naming thigs

2020-01-06 Thread Roelof Wobben via Pharo-users
--- Begin Message --- Op 6-1-2020 om 09:34 schreef xap: hi Roelof, i didn't mean to hijack your thread, sorry -- my question was directed at you, then kinda took on a life of its own. That said, Sven had/has responded to your op (original post), no? One additional change I would make: rename "f

Re: [Pharo-users] is this better regarding naming thigs

2020-01-06 Thread xap
hi Roelof, i didn't mean to hijack your thread, sorry -- my question was directed at you, then kinda took on a life of its own. That said, Sven had/has responded to your op (original post), no? One additional change I would make: rename "findAnagramsCandidates" --> "findAnagrams" : it's shorter,

Re: [Pharo-users] is this better regarding naming thigs

2020-01-05 Thread Roelof Wobben via Pharo-users
--- Begin Message --- Hello, Nice to see that someone who ask another question on my question but do i get a answer on my question too. So if the naming is better now. Roelof Op 6-1-2020 om 02:18 schreef xap: "but all objects respond to value..."; thx, Santiago -- that makes more sense, th

Re: [Pharo-users] is this better regarding naming thigs

2020-01-05 Thread xap
"but all objects respond to value..."; thx, Santiago -- that makes more sense, that or: cares only about its receiver/argument evaluable as a Boolean, no matter they started as blocks, expressions, or something else (makes me wonder if a bare-value is a degenerate case of a block ... but don't mind

Re: [Pharo-users] is this better regarding naming thigs

2020-01-05 Thread Santiago Dandois
It's better (conceptually and in performance) to use the inner block, but is not always necessary. The #or: message sends the `value` message to it's collaborator if the bolean is false. Blocks responds to value executing theirs code, but all objects respond to value since it's defined in the Objec

Re: [Pharo-users] is this better regarding naming thigs

2020-01-05 Thread xap
thx Rixhard. looks like or: takes an 'alternativeBlock', i.e. a block. however substituting a parenthesized expression (or what i assume is one) as I did before, in place of the inner block, w/ no other changes has the method continue to work as expected, hence my question. *shrug* i need to rtfm :

Re: [Pharo-users] is this better regarding naming thigs

2020-01-05 Thread Richard Sargent
On Sun, Jan 5, 2020, 15:51 xap wrote: > hi, I'm just starting out w/ pharo and have a question re your code; > specifically, in > > reject: > [ :word | (word sameAs: aWord) or: [ word asLowercase asBag ~= > charBag ] ] > > is that inner block needed? would it be less smalltalk-esque

Re: [Pharo-users] is this better regarding naming thigs

2020-01-05 Thread xap
hi, I'm just starting out w/ pharo and have a question re your code; specifically, in reject: [ :word | (word sameAs: aWord) or: [ word asLowercase asBag ~= charBag ] ] is that inner block needed? would it be less smalltalk-esque to write, say: reject: [ :w | (w = aWor

Re: [Pharo-users] is this better regarding naming thigs

2020-01-05 Thread Sven Van Caekenberghe
> On 5 Jan 2020, at 15:06, Roelof Wobben via Pharo-users > wrote: > > > From: Roelof Wobben > Subject: is this better regarding naming thigs > Date: 5 January 2020 at 15:06:18 GMT+1 > To: Any question about pharo is welcome > > > Hello > > In a earlier question I get a remark to think b

[Pharo-users] is this better regarding naming thigs

2020-01-05 Thread Roelof Wobben via Pharo-users
--- Begin Message --- 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 as