3 ms·
I love chaining, but one verb per line. Instead of something like Me.getFish.skin.debone.flour.salt.fry.eat It would be something like Me.getFish
by Swizec 10y ago
I love chaining, but one verb per line. Instead of something like
Me.getFish.skin.debone.flour.salt.fry.eat
It would be something like
Me.getFish
.skin
.debone
.flour
.salt
.fry
.eat
I find this more readable than doing it without chaining like this:
fish = Me.getFish
fish.skin
fish.debone
fish.flour
fish.salt
fish.fry
Me.eat(fish)
- rb808 10y agopersonally I prefer without chaining, makes much more sense as its what I've always seen until the last ~5 years. The other part you didn't mention is that you have to amend all the functions like getFish, skin etc to return the object which I think makes their signature unnecessarily less clear.
- Terr_ 10y agoYeah, just because something looks like chaining doesn't mean it's really repeated calls on the same object. Even with some static-checking of types, it could also be a copy of the object. While blocky, the repeated thing.do() format is explicit about what object is being operated on.
- maxxxxx 10y agoI find the version without chaining easier to debug.
- girvo 10y agoI don't know, I'd just set a breakpoint in my editor regardless of the form?