What do we mean by saying that existence precedes essence? We mean that man first of all exists, encounters himself, surges up in the world – and defines himself afterwards.

— Jean Paul Sartre, Existentialism is a Humanism

The more computer science I learn, the more I find myself applying coding concepts to philosophy. I was reading Existentialism is a Humanism, and I realized that variable assignment and function definition could explain the crucial existential concept of “existence precedes essence” in a simple, exact way.

“Essence precedes existence” in code

This phrase is the antithesis of existentialism. Here it is in Javascript:

var myIdentity = { name: "Jeremy"; meaning_of_life: 42; personality: [// set of attributes]; }; function life(identity) { // do stuff with the pre-defined identity, like express it and live according to it }; life(myIdentity);

To people somewhat familiar with computer science, this code can be highly meaningful. The identity is initially expressed in the form of an object. Obviously, a human identity can’t be comprehensively written in code. I arbitrarily chose an object to represent human identity. The object identity , which is outside of the function life , represents the idea that your identity is defined before your existence. Every aspect of yourself, from your name to your favorite activities to your personality, is constructed in exact detail before you are born. Then, when you begin to live, you start to discover this personality that was already laid out for you.

Most who subscribe to this idea say that God builds your identity, or your identity is defined in some kind of pre-existence. Others say that identity is pre-defined by genetics or human nature. These ideas are all fundamentally the same. Basically, they all express the oft-repeated axioms “Life is about finding yourself” and “essence precedes existence.” Someone or something defines your existence beforehand, and then it is passed to the function of life. Sartre explains this best in his Existentialism is a Humanism, so I’ll leave the in-depth explanation to him.

“Essence precedes existence” in code

(function life() { var identity = {}; // I'm born! My parents give me a name. identity.name = "Jeremy Hadfield"; // I discover the life that's most meaningful identity.meaning_of_life: "way of living"; // I slowly develop my personality identity.personality = ["a few preset values due to initial conditions like genetics"]; identity.personality.push("experiences"); identity.personality.push("talents"); })();

This is a self-executing function life in which an empty object called identity is first defined and then various attributes are appended to it later in the function. When certain experiences occur, the attributes are appended to the identity. There is a blank array called personality that has values pushed to it over time. Of course, I didn’t express the reality that in human personalities, values can also be overwritten and deleted.

It’s interesting to note that since all of these variables are defined within a function, they cannot be accessed by any other function. If someone else had another function for their life, they would be unable to take variables from this function. This code demonstrates the existentialist way of living, which is individualist, self-dependent, and self-defining. This is best expressed by the phrase “existence precedes essence.” The object identity first exists, and then it is defined as values are added to it.

This is all a gross oversimplification. I cannot fully express existentialism in a few lines of code, or express all of life as a function. In the end, this post is meant to paint a compelling picture of a more precise way of writing philosophy that can supplement our current literature.

If you want to learn more about Javascript, check out the excellent tutorial on Free Code Camp.