DEV Community

Damilola Alabi
Damilola Alabi

Posted on

What I learned about JavaScript and myself from my conversation with Dan Abramov

Well sorry for the clickbait headline but, emails where you send lengthy responses back to the sender serve as conversations no? Ok convince me otherwise.

What I learnt about myself and JavaScript after Dan Abramov’s first “Just JavaScript” course which he sends in sequence of emails consistently from May 29th 2020 at least that’s when I started getting the emails.

While I discovered that there Is more to thinking about JavaScript than just declaring variables and calling methods. For a spatially trained thinker like me, programming comes with a bit of a challenge in that after a degree in urban planning and many years of practicing graphic design definitely relying on a particular context of spatial reasoning to do my work.

Making the jump to how the JavaScript Universe is set up is diving into other to contexts of spatial reasoning which looks to me like is stringing a guitar to play frequencies of a violin, let me explain.

There are 3 contexts of spatial reasoning.

The first context is that of the everyday or physical geographic world of four-dimensional space-time. Variously called spatial perception, environmental cognition, cognitive mapping, and so forth, in this context spatial thinking is a means of coming to grips with the static and dynamic spatial relations between and among self and other objects in the physical environment. The domain of concern is locations defined on the surface and near-surface of Earth, at resolutions between millimeters and hundreds of kilometers.

This is cognition in space and involves thinking about the world in which we live. It is exemplified by wayfinding and navigation, actions that we perform in space. It extends to other everyday activities: assembling a child’s toy from a set of parts using printed instructions; packing the trunk of a car to maximize carrying capacity; and building a dog kennel using tools, a pile of lumber, and a general model of what dog kennels typically look like.

"We might call this context the geography of our life spaces. I have survived on this realm for a long time now."

The second context is built on the four-dimensional world of space-time, but in this case the focus is on a scientific understanding of the nature, structure, and function of phenomena that range from the microscopic to the astronomical scales. It is the world of the structure of the atom, the structure of Earth, and the structure of the universe.

This is where the pseudo scientist in me kicks in, the one that understands the science of interstellar and how jumping space time in Guardians of the galaxy makes sense.

This is how I know that that the information age requires a new method of thinking about work, and why I am learning JavaScript amongst other languages in this season.

This is cognition about space and involves thinking about the ways in which the “world” works.

"We might call this the geography of our physical spaces."

You will be like hey, what has any of this have to do with JavaScript? Or it’s not that deep!!

So I wonder when you see the stories of folks who made a jump from flipping burgers to working in tech, does any of them reveal to you the phenomenal leap their minds had to make to become who they are now?

Even though she wasn't flipping burgers to the best of my knowledge, Sarah Drasner represents to me one of the most inspirational switch to tech, and some times I can see how the previous profession she practiced carved a unique niche in the expression of her specialty.

"Where is the place of such mundane jobs in declaring the Logarithmic -Time Algorithm?"

O(n log n)-“Order N log N”

Algolia probably makes money from applications of this and makes our lives easy, but I am yet to understand how. (I digress)

The answer leads me to the third context of spatial reasoning.

The third context is in relationship to concepts and objects—the focus of our thoughts—that are not in and of themselves necessarily spatial but can be assigned locations via space-time coordinates and therefore can be spatialized. The key premise is the conversion of some data relationship between objects—for example, similarity or dissimilarity, order or sequence, time of appearance—into locations and therefore arrangements of the objects in a space.

This is cognition with space and involves thinking with or through the medium of space in the abstract. It is exemplified by the conversion of linguistic statements into spatially ordered sequences to answer questions, and therefore the process depends on representations that we develop of concepts in space.

This was the question posed in this particular draft.

Read this code:
Let a =10;
Let b =a;
a = 0;

What are the values of a and b after it runs? Work it out in your head before reading further.

"The goal of that exercise wasn’t to introduce you to variables, it was assumed you are already familiar with them. Instead It is to make you notice and reflect on your mental model."-Dan Abramov

To help illustrate this point, I evoke a memorable scene from the shonen anime One Piece that has the world in bits for its intriguing storyline and characters, especially how it mirrors the world in which we are in.

A specific character scene stands outs at the beginning of the anime, swordsman Ronoroa Zoro had a duel with the world’s greatest swordsman in the one piece universe Dracule Mihawk and despite using his most advanced technique he lost terribly, but as a sign of honor Mihawk didn’t finish him off, but rather gave him a chance to get better.

You will be like, hey you lost me here, what has this got to do with anything?

A concept which Zoro understood was that Mihawk was strong because he held a good sword, a black blade, Mihawk proves Zoro wrong by fighting him with a pendant version of his sword. Zoro came at him with his 3 sword style "Santoryu".

The appearance of Mihawk at the beginning of Zoro’s Budoshin career, created a relationship between a context and an object, if it didn’t take a black sword to be strong what did It take?

It’s the same thing you will have thought when you read the exercise above.

A transitive question also needed to be answered: Who is stronger, Zoro with three swords or Mihawk with a pendant?

"We might call this context the geography of our intellectual spaces."

Here’s a snippet of Zoro and Mihawk’s battle.

YouTube:

This was how I thought about JavaScript -learn the most complicated weavings of methods and build a program or copy other logic from stack overflow and get the program working. I didn’t understand why certain functions were called the way they were, or why when you refactor all those careful details you crafted disappear completely.

I am referring to specific command in VSCODE that allows you refactor in a single click. Your code doesn’t look like what you wrote afterwards, and I usually undo that and leave the code the way I first wrote it and understood with my copy and pastes. Don’t blame me I am on journey here.

"It broke my mental model of attaining a result."

I understand the purpose of refactoring is optimization and cleaning up to reduce dud variables declared and not used 200 lines after but heck that’s for another day.

Just let this story compile in your head.

So, I went on this long winding journey about spatial reasoning because There’s a particular email about mental models that had me thinking about how I think about JavaScript.

Dan said and I quote:

“You might find that for every familiar fundamental programing concept, (like a variable) and operations on it like setting value, there is a set of deep-rooted analogies that you associated with it. Some of them may come from the real world. Others may be repurposed from other fields you learned first like numbers from math. These analogies might overlap and even contradict each other, but they still help you make sense of what happening in the code.”

This was the reason why I talked about spatial reasoning and to add to another influence how my story and Zorro’s story coincide, here "I am Zoro and Dan is Mihawk."

So, I will tell another scene from the anime one-piece this time, around the time skip.

Now fast forward to a time skip, Ronoroa Zoro had come in contact with and was in possession of a real black blade after fighting an undead Master Samurai.

YouTube:

This is what he thought all along was the secret to being great swordsman which was having black blade that can cut anything. Now in the One-Piece universe a black blade is rare, it is usually forged by Master Swordsmen- like the Wado Ichumonji or Shisui which Zoro acquired from that duel.

For me it was akin to thinking that if I had one more tutorial, I will understand better how-to code, but because my fundamental thinking about how to think about JavaScript hadn’t been examined anything I saw or heard in code snippets went over my head.

I may have been in possession of black blade in the place of good course by a skilled teacher but it just went over my head.

Why did It go over my head you may ask?
Isn’t access to great content important to leveling up your skills
Isn’t that the premise of every online course platform?

Well the answer came form a lesson which Zoro learnt pre time skip where he was cast on an island were the animals on the island could mimic every move they saw humans do, but the humans in that island ended up warring against each other and all the animals learnt form humans was how to fight with the most sophisticated techniques, even so much that, when Zoro encountered them he couldn’t defeat them with his black blade.

YouTube:

Zoro defeated by weakest of the animals on that island crawled back to Mihawk who told him that anything could become a black blade if he knew how to cloak it with Haki.

You will be like stop the press!

What’s Haki? See here, and continue.

YouTube:

That singular shift in the way he thought about black blades after more than 500 episodes changed the way he approached his craft, and that simple technique that couldn’t defeat Mihawk in the beginning defeated and cut through an almost 50ft stone monster, and also cut through a Haki clad Devil fruit villain.

Zoro could cut through anything now, no matter the size or shape. Remember I am Zoro and Dan is Mihawk.

1;07 - 3;08 is me looking at codebase from now on.

It was one of the most amazing powerups you had ever seen in anime fandom.

Here’s a snippet to behold it in all its glory.

YouTube:

But about my thoughts on JavaScript -I was defeated by the simplest logic of JavaScript because I was not thinking about JavaScript in the way I should have, taking into cognizance the mental models that I used to process code I wrote and saw in another codebase.

In other words, how I thought about my learning JavaScript was affecting my learning.

You can sign up for Dan Abramov's emails at https://justjavascript.com/.

Until next time.
Dami, Out!!

Top comments (0)