Something I’ve always enjoyed about the structure of programming languages–and something that’s been frequently emphasized, thus far, in the Flatiron course–is how programming often reflects the real world (for our purposes here, let’s just take “real world” to mean the non-virtual, non-digital planes of existence). In building-up these digital logic systems, we often resort to organizational and philosophical structures that have held reign in our non-virtual lives, often for generations. This, to me, is fascinating.
One case I’ve been mulling over a lot lately is the notion of
self in Ruby. Of course, the most obvious parallels are quite clear: Ruby is structured so that classes and class instances are their own objects, and these objects are, quite literally, self-aware. This is super useful in a programming sense, but it’s also really interesting in how these objects, at least to a certain degree, share core qualities with sentient beings in the real world.
In my non-programming life, I’m a program director at a yoga studio, where I also teach and train yoga instructors. The yogic philosophy, which by some estimates dates back to before the common era, also emphasizes the notion of self. In yoga, self is dualistic, meaning that there is a self (simply put: your individual body, personality, and existence in this lifetime) as well as a capital “S” Self, which denotes what most people would call a soul–the aspects of “you” that don’t die and are a part of what is often referred to as universal consciousness.
As I was learning about
self in Ruby, it dawned on me that there are some very interesting and instructive parallels between Ruby’s
self and the yogic self/Self. Let’s start with Ruby’s
self at the class-level: it represents a master template that is used to launch an entire digital ecosystem of similar but unique and varied objects. This is not unlike the yogic Self: a universal system from which infinite, diverse, and connected selves are created. Following this logic, a class instance of
self is then similar to yoga’s lowercase “s” self, in that they each represent a self-aware object that is created from an overarching blueprint for a specific purpose and life-cycle.
If we were to get more into the nitty gritty of both Ruby and yogic philosophies these comparisons may not remain so airtight, but, when looking at the broad strokes, aren’t the parallels interesting? Of course, I’m fairly certain that Matz and his crew weren’t trying to imbue Ruby with yogic philosophy when they built the language. But I love how, in this single concept, the structure of a programming language echoes–in this case an ancient–construct in the non-virtual world.