Harry Potter versus Hermione Granger

In the world of Harry Potter, J.K. Rowling constructs a fantastical world under which trolls, muggles, charms, and wizardry coexist. Two characters in particular are of interest to us: one witch Hermione Granger and one wizard Harry Potter

These aforementioned characters exhibit different learning paradigms with respect to their magical studies at Hogwarts (School of Witchcraft and Wizardry). Hermione is characterized as a bookworm devoted to mastering every aspect of her magical studies, whereas Harry is shown to be content in achieving general proficiency. Harry represents the conjurer paradigm, whereas Hermione exhibits characteristics of the scribe.

The scribe seeks to understand every nuance, detail, and aspect of their chosen language. The desire to acquire mastery (such as the impulse to engage in deep debugging techniques or document every aspect of a particular API) characterize the scribe well. The conjurer stands in stark contrast to the scribe: the conjurer ignores complexity and relies heavily upon intuitive leaps.

It is wise, at least in the context of the first couple weeks at Hack Reactor, to approach learning with the mindset of the conjurer. For the purposes of reducing cognitive load, it is important that one’s approach to understanding code should be intuited or conjured, as trying for mastery at an early stage carries too high of a cost (namely time and effort).

Climbing Trees

The Document Object Model (or DOM for short) is the main structure under which HTML operates; it can be conceptualized as interconnected nodes arranged via a tree-like structure. The archetypal method through which these nodes may be traversed relies upon recursion.

Tree-like Structure

An easy way picturing this is to imagine a single node carrying some number of child-nodes. Those aforementioned child-nodes might carry child-nodes of their own, and so on and so forth. In this way, we are able to conjure an image of a tree.

The code snippet as shown below is one example of how one might manage to interact and traverse between the DOM nodes. The function getElementsByClassName collects every element of the DOM that carries a class name equivalent to the one searched for by the programmer. It then returns those elements within an array once the entire DOM has been searched.

Tree Recursion Example

Welcome to the Functional Paradigm

Close to the machine, we find ourselves looking at statements and other general commands written via the imperative style. Machine code, C++, and Java are pretty good examples of this.

Imperative Example

It therefore makes sense that the bulk of languages mimic the imperative style; there is an ease of translation that is difficult to achieve otherwise. JavaScript builds upon the aforementioned paradigm but also manages to append functionalism (via the callback).

Callbacks, at least in the context of Javascript, refer to functions that are passed in as an argument. Advantages to callbacks include fewer lines of code and theoretical improved readability. On the other hand, the cost to callback implementation involves dramatically slower speed performances. In spite of this, heuristically speaking, callbacks tend to be quite useful.

Functional Example

And… Liftoff

I’ve finally decided to begin chronicling my journey into the rabbit hole (known as Hack Reactor). It’s been only two weeks in, but I feel as if a few months have already passed. The learning environment here is really one the best that I’ve ever experienced. The only downside, if you can call it that, is the general intensity of the program. Hack Reactor demands passion and attention to detail par excellence.

I’ll be posting on here whatever interesting tidbits or pieces of information that I’ve acquired along the way. Here’s to that first step in becoming an actual software engineer.