Dada
|> Structures
|> Algorithms

The Missing Tech Context

Tech discourse will become better the more we take tools, environments, and culture into consideration

Recently I ran into a discussion on a Ruby forum about the "right" way to implement a .double function. One solution used a case block that checked on the object's type. The other one added .double methods to the Numeric, Array, etc. Which one is better?

People with Smalltalk experience will say that adding methods is the proper object oriented solution. And they are right. Right, that is, if we are writing in Smalltalk. If we are writing in another OOP language, this solution may be wrong. A grave mistake, even.

Isn't OOP the same in any language? Our current expectation is that it is. The reality is that isn't. Each language operates with a different context from the others.

Ruby is heavily inspired by Smalltalk. It is essentially a command-line Smalltalk dialect that lacks the GUI and the tools. Let's examine the different contexts.

In Smalltalk we have good development tools. Developer education explains how the language works, how message dispatch works, and how each Smalltalk image is a unique system once you finished your project.

Ruby has a different culture. It has many people who use it to get things done. It is mainly written in text editors. Message dispatch is learned once we are learning about metaprogramming. The language is syntactically more complex. Developers don't expect that base classes will be modified.

So while the Smalltalk developer can easily find where a method is defined in their system, even expecting changes, the Ruby developer will be surprised. We want to reduce those surprises.

An interesting consequence is that if changing Object becomes a common practice in Ruby, then this practice, which today may be considered incorrect, will be fine. We need to be flexible because context changes with time.