Nick Huemmer

17 February 2023

Mental Models

A mental model is a powerful tool that can help you understand and remember complex concepts. You probably already use them, but maybe don’t realize that you do. I’ve found them to be really helpful when learning code, though they can be applied in many facets of life.

What exactly is a mental model?

Mental models are simplified representations of complex ideas that help us make sense of the world around us. They allow us to make predictions, draw conclusions, and solve problems in a more efficient and effective way. By creating a mental model, we can break down complex ideas into smaller, more manageable parts, allowing us to better understand and remember them.

We use our imagination to visualize how something works. This will help us recall and implement it better.

Creating a mental model involves identifying the key components of a concept and understanding how they relate to each other. For example, when learning how to code, you might create a mental model that breaks down the programming language into different components, such as variables, functions, and loops. For example, a function is like a machine that takes in an input, performs a task, and returns an output. A variable is like a box that stores a value. A loop is like a conveyor belt that repeats a task over and over again until it reaches set point. By understanding how these components relate to each other, you can more easily learn how to code.

Examples of mental models

Memory palaces

the inside of a palace

A powerful type of mental model is a memory palace. A memory palace is a type of mental model that can help you memorize lists of items. It involves associating each item with a location in a familiar place, such as your home. For instance, you could associate the first item on your grocery list with the kitchen, the second item with the living room, and so on. By using a memory palace, you can more easily remember a list of items. This is a technique that many memory champions use memorize long lists of numbers or the order of cards in a deck.

Concept maps

a mind map

Another mental model is a concept map. A concept map is a diagram that shows how different concepts relate to each other. For example, you could create a concept map that shows how client makes a request to an API or how the prototype chain works in object-oriented programming. By understanding how these languages relate to each other, you can more easily learn new languages and understand how they work.

a mind map

A mind map is an example of a concept map. It shows how different concepts relate to each other.

a picture of an org chart

An organizational chart is an example of a concept map. It shows how different departments relate to each other.

The scientific method

A third example of a mental model is the scientific method. The scientific method is a process that scientists use to test hypotheses and draw conclusions. It involves making observations, formulating a hypothesis, testing the hypothesis, and drawing conclusions. By understanding how the scientific method works, you can more easily solve problems and make decisions.

diagram of the scientific method

Mental models in JavaScript

a picture of matroyska

Russian nesting dolls, or matroyska dolls, by Didssph

In JavaScript, we can use mental models to better understand how the language works. One example is using matroyska or russian nesting dolls to explain how closures work. Each inner doll has access to all the outer doll’s variables (they are withing scope) but the big dolls don’t have access to the inner dolls. Also, the outer dolls have memory have persistent memory that the inner dolls can access.

Another example of a mental model in JavaScript is understanding asynchronous code. A mental model for asynchronous programming might involve visualizing a restaurant kitchen, with chefs preparing multiple dishes at the same time, and orders being taken and delivered in a non-linear fashion.

a chef cutting vegetables

Photo by Pylyp Sukhenko on Unsplash

Just as a chef can work on multiple dishes at the same time, an asynchronous program can perform multiple tasks simultaneously. However, the program may not complete these tasks in the same order they were initiated, just as a restaurant may not serve dishes in the same order they were ordered.

The benefits of mental models are numerous. They allow us to simplify complex concepts, improve our problem-solving skills, and make better decisions. Additionally, by creating mental models, we can more easily communicate complex ideas to others.

Mental models are a powerful tool that can help us better understand complex concepts. By breaking down ideas into simpler parts and understanding how they relate to each other, we can more effectively learn, solve problems, and communicate with others. So the next time you encounter a challenging concept, try creating a mental model and see how it can help you gain a deeper understanding.