-
My perspective of Ruby ‘barewords’
First off, this is not meant to disparage anyone’s views on their use or non-use of Ruby barewords’. This is my attempt to codify’ why I like them and use them extensively; I also instruct the rest of my team to use them.
When I wrote Smalltalk code there was no getting to instance variables without an accessor. Period. So it’s kind of engrained in my coding DNA, as it were. Also, I purposely write small’ objects; the surface of their interface is small, just a handful of public methods. The behavior is private. I also try to keep the number of instance variables to an absolute minimum.
But I find that barewords give me a lot of power and flexibility. They allow me to change the internal shape of my object, its internal behavior, without worrying if I’m forgotten an instance variable. They also allow me to change the source of the information my object needs if it’s using a collaborator.
I think what really helps me is intention revealing names, and tests, lots of tests. I’m also strict/stingy with my input parameters.
However I’ve not run into a case where it was an extra chore when reading the barewords’. I’m not saying it won’t happen, just that it hasn’t happened.
Thank you for letting me ramble/share.
Log in to reply.
That really gave me some extra confidence that I can def. stand up in this class as an equal to many of the other great devs in here 