Can We Have our Cake and Eat It Too?
What The DOM Can Teach Us at The Intersection of Wellness and Tech
The internet used to look a lot like this
and life used to look a lot more like this
Although those were definitely simpler times, I don’t think many of us want to give up the incredibly powerful internet that we wield today and jump back into the shoes and times that our grandparents lived in.
The question is how do we have our cake and eat it too? How can we live in our fast-paced, notification-heavy, digital lives, reap all its benefits yet not be overwhelmed by it?
Taking a step back and learning about some fundamentals of how the web works and some easy-to-follow programming insights can serve us with some much-needed breathing room and perspective.
To begin by way of analogy, let us revisit the classic tree falling in the forest question. If a tree falls in the forest and there is no one there to hear it, does it make a sound?
The general consensus is that it making “sound” depends on the definition of “sound”. If we define sound as the vibration of airwaves reverberating through the air in the vicinity of the treefall, then yes, it is making a “sound”. However, the fact remains that only an eardrum or a recording device (passing it to an eardrum) can take those airwaves and make them something meaningful. Turn soundwaves into music, art, communication, and expression.
Browsers like humans are similarly magical. They take lines of seemingly meaningless “dead” code and transform them into something very much alive and responsive. This magic happens in something called the “DOM” or the Document Object Model, and it is visible and accessible to all in the developer tools in each browser (gif below showing you how to access it). The DOM takes the “document” of code it receives from the hosting server and displays the page to the browser’s “window”.
The Browsers’ evolution mirrors our own. We are continuously giving meaning to our surrounding experiences through our attention and senses, and thus rendering our “document” to our awareness. We likewise have learned to respond to ever-increasing “events” and stimuli in our lives that thereby create additional elements of thought, feeling, and emotion in real-time.
Sometimes people and situations really press our buttons and create a train of thoughts, emotions, and anxieties rushing into our DOM at Fibre-optic speeds. Like browsers this flood of stimuli can overwhelm us with mental error messages and without proper care can make us and web applications crash.
The Browser’s error messages are found in the “Console” section of the developer tools.
As a programmer these messages are invaluable. They usually tell you exactly which line of code is responsible for the issue and give you the browser’s best guess for what’s wrong. Likewise, people usually have a good hunch about what triggered them and some clues as to why if they would only take a few moments to reflect on their internal world and mental “console”.
The real magic though is not in receiving messages from the console but in sending messages to it through the console.log command.
Console.log is a web developer’s best friend. It sends a message to the console as soon as that line of code is hit by the DOM reading (parsing) through the “document”. When a browser event such as a “click” occurs the console.log placed within that function can send a message confirming certain variables or just letting the developer know that the function works.
Likewise, in the human realm. In addition to being mindful of our internal elements and error messages, we can place intentional console messages for ourselves when certain events trigger us. For example, if one notices that a particular social situation triggers anxiety, resisting those unpleasant feelings head-on, or on the opposite extreme, ignoring them entirely and allowing them to ruminate and “loop” over and over are both recipes for error messages and a possible crash.
Instead, an alternative approach would be to allow those elements to surface because they are valid and tell you something about your experience. By taking notes in your mental console.log( “I am feeling insecure about xyz right now” or “oh, there is that weird feeling again”), you can cultivate extra space and perspective for similar triggers in the future.
In conclusion, our hectic minds and lives have more in common with the internet and our browsers than what initially meets the eye. We all need our strategies on how to best navigate a healthy relationship with the internet and our devices.
However, by recognizing that we are responsible for our internal “DOM” and have access to our inner “developer tools,” we can keep our systems running smoothly, smile more and maybe, just maybe in this fast-paced world have our cake and eat it too.