The eli4d Gazette – Issue 046: Programming Language Affordance and DHH’s Reason for StimulusJS Creation

Tech Pick (Programming Language Affordance)

I am a huge fan of Sandi Metz. She’s like one of those Zen masters that snap their students out of their current perceptual ruts.

In a recent article (‘What Does OO Afford’) Sandi goes into a great reflection about Object Oriented programming and the affordances that this approach provides. It’s a great and worthwhile post. One section that strikes me is the following:

Just like varying styles of doorknob, different programming languages offer their own unique affordances. Language designers have preconceived ideas about the best way to model reality, and their creations reflect these biases. Thus, programming languages are explicitly designed to “enable” certain kinds of thinking.

I’m talking about something that’s deeper than syntax. Languages have points-of-view: they’re designed to be used in certain stylized ways. The mere fact that code compiles doesn’t mean it’s arranged as the language designer intended.

While it’s possible to warp most any programming language into use by an alternate way of thinking, working at cross-purposes from your language’s intentions is not the most efficient way to write code. Don’t roll this rock uphill. If you don’t understand your language’s affordances, learn them. If your coding inclinations conflict with the designer’s biases, yield.

The above puts language wars in perspective. A language is designed to model reality in a certain way. If it takes off due to significant adoption (whether organic or through environment limitations like JavaScript), then warping occurs as developers try to use this hammer to nail every problem.

Media Pick (JavaScript Framework Choice)

The most recent Full Stack Radio podcast fits quite well with Sandi’s article. It features an interview with David Heinemeier Hansson.

In this interview, he discusses his company’s (Basecamp) release of a JavaScript framework named Stimulus. It’s interesting to learn how he chose Ruby‘s affordances over the those given by various JavaScript frameworks (like React, Vue, etc…). So Stimulus supports this choice by keeping as much of the programming on the server side via Ruby and Ruby on Rails.


Thoughts? Feedback? Let me know: @eli4d on Twitter