Thoughts of Clarity from Lessons Learned in Ruby
Connotation & Denotation
What does the symbol # denote to you?Is it a phone’s pound sign? Or a number sign? Or commented out bash command? Or a Twitter/Facebook hashtag!? Depending on your age and experience, this symbol can be called and have meaning for a variety of things. This denotation has ambiguous connotation, but fortunately the context in which it’s used ( e.g. Online, in a phone number, in a .zshrc ) can usually give us a safe definition and monicker for the symbol.
When there are multiple connotations for each denotation, the context becomes a critical factor. Since the definition is dependent on an external context, our functionality becomes arguably impure. ( Functional programmers feel free to squirm)
One could argue that ES2015 shouldn’t care about JSX, but fundamentally differing actions, like spread operators and rest parameters, both new ES2015 concepts, should not share syntax. Enforce clarity and readability with growth.
Seattle Style Ruby
You may have heard of Seattle Style Ruby, which is an arguable topic amongst Ruby developers. But ultimately, the concept that birthed Seattle Style is timeless. Jim Weirich (Big Jim), the creator of Rake, blogged about writing a script to remove all alphanumeric characters from Ruby file to leave behind extraneous characters that MUST contribute to the semantic meaning of the code. Thus Seattle Style ruby was born as a style geared towards the minimization of noise in code, by minimizing these semantic characters.
Source Ryan Davis, RubyConf 2015
Less denotation, less noise.
The biggest thing I miss from Ruby syntax is stupid simple. It’s the concept of speaking in the affirmative rather than negative. You see, in Ruby, wherever you’d type:
Instead you could type:
You may think this trivial, as did I. Modus Ponens is the method of affirming, and though logically no different than it’s counterpart Modus Tolens (method of denying), one is fundamentally clearer and nicer.
It’s like the word non-fiction. It sticks in your throat even after you’ve mastered its definition. For Rubyists this goes beyond code.
Being positive fueled a community for Ruby, and that community is well known for having a supportive and friendly circle. They’ve set the bar high for something I didn’t even know I enjoyed.
A fundamental care of readability and clarity should be evaluated and honed as first priority. This clarity allows us to identify these complications before they happen, rather than vaguely remember them as they bite us time and time again.
As a community member, this starts with you.
About Gant Laborde
Gant Laborde is Technical Lead atInfinite Red (⚙ web and mobile app dev ⚙), published author, public speaker, and mad-scientist in training. Read the writings of Gant and his co-workers in our Red Shift publication . If you’re looking to discuss nerdy tech, he’s all ears. View half-witty half-groan technical tweets with @GantLaborde on twitter.
Takeaway image provided by: http://www.freeimages.com/photo/chinese-take-away-box-1319752