Some examples of testing methods verb prefixes I use: shouldXxx (#shouldOverwrite) isXxx (#isEmpty #isNil hasXxx (#hasContents) canXxx (#canDeleteProperty) usesXxx (#usesDirectTransfer) containsXxx (#containsPlots) definesXxx (#definesGlobals) didXxx (#didRemoveFiles) willXxx (#willCreateNewAssets) I'm in favor of having more symbols available as binary selectors, but I don't see the use of ? and ! as unary selectors other than the technical challenge of making the change, with the added burden of breaking compatibility. In a perfect world no testing is required and everything is solved by delegation, but we all know that sometimes the added complexity is not worth it. Regards, Esteban A. Maringolo On Fri, Sep 13, 2019 at 9:00 AM Tim Mackinnon <tim@testit.works> wrote:
+1 for #shouldXxx I recall I use it a lot too, and #isXxx where that reads better but am struggling for examples.
Tim
Sent from my iPhone
On 13 Sep 2019, at 02:37, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
On Wed, Sep 11, 2019 at 4:10 AM ducasse <stepharo@netcourrier.com> wrote:
On 11 Sep 2019, at 04:07, James Foster <Smalltalk@JGFoster.net> wrote:
Would use of ? and ! in unary/keyword selectors be convention or somehow required? If simply convention, then we should start with renaming testing methods to be named is* or has*. flag1 := anInteger even. ânot good" flag2 := anInteger isEven. âbetter" flag3 := anInteger even?. âhow much better?â flag4 := #(1 2 3) includes?: 2. âhow much better?â
I think that I would use ? mainly for unary message
Now Iâm sure that if you look carefully some people use
include for the action includes for the tests
I took include as an example and this is super not intention revealing.
lineUpBlockBrackets
lineUpBlockBrackets? Now I will rewrite them all as shouldLineUpBlockBrackets or isLineUpBlockBrackets and to me for unary message ? makes it a lot better.
Hi Stef,
I have been facing this ambiguity a lot too. And my workaround, most of the times, was also to prefer the "question" method with #should. #is just doesn't sound right in my cases, but #should does sound good in most of them. I would still like to find a better one, but for the moment, in my recent years, I am stuck with #should.
-- Mariano Martinez Peck Email: marianopeck@gmail.com Twitter: @MartinezPeck LinkedIn: www.linkedin.com/in/mariano-martinez-peck Blog: https://marianopeck.wordpress.com/