DEV Community

Cover image for Do You Know Mental Models in IT?
Thorsten Hirsch
Thorsten Hirsch

Posted on

Do You Know Mental Models in IT?

It's been 17 years since I started working in my 1st real job. It was in a bank and it was introduction week. There were 50 other students in the same situation as I and we were all sitting in an awe inspiring room full of ornaments. We were waiting for the next speaker. An elderly man entered the stage. The experience of decades could be seen in the wrinkles in his face. And I will never forget what he told us:

No matter what kind of business department you will work in, always remember that it's all about ledgers.

So this old banker's mental model was the ledger. Actually he was using the T account representation of a ledger in his presentation. And he explained, that no matter what kind of financial business he was working on, he always transferred it on ledgers in his mind. Retail credit, cash transfer, trade finance, lending, money market, funding, ... you name it. By applying all problems on ledgers he could easily understand the business of each and every department in the bank.

Are there Mental Models in IT?

After reading James Clear's article about mental models (and Richard Feynman) I asked myself what mental models we have in IT. What abstractions can we use to reason about any kind of problem we're confronted with? Whenever I reason about a new system I instantly think about its data modelling, so I guess these 2 might qualify as mental models in IT:

  • Entity Relationships (ER)
  • Object Oriented Programming (OOP)

Are design patterns a mental model? I don't think so. Each pattern suits a special problem, so a pattern is by far not generic enough to work as a mental model. And what about the sum of all patterns? No, I think trying to find patterns is just human behaviour.

What about Functional Programming (FP)? Since I'm not proficient in FP I don't know if it can work as a mental model. Does it?

Top comments (3)

mlapierre profile image
Mark Lapierre

What abstractions can we use to reason about any kind of problem we're confronted with?

Design patterns are definitely an abstraction we can use to reason about a problem.

The phrase “mental model” is an overarching term for any sort of concept, framework, or worldview that you carry around in your mind.

That's the definition James Clear gave. It's a term with a very very broad meaning, but that doesn't mean it can't apply to something specific. If you can hold and examine it in your mind, it's a mental model. Design patterns fit into that. Even each specific design pattern (which is what I think you're objecting to) can usefully be seen as a mental model. For example, the Builder pattern can be a mental model of how to create instances of a class with different properties without having constructors for every possible combination of parameters.

Mental models are useful to help you examine and manipulate something in your mind, so when you can use them to better understand the thing they model. All of that definitely applies to individual design patterns. The Builder pattern allows you to better understand how to create instances of a class without an explosion of constructors. You can imagine how adding a method that you optionally call can be better than adding another overloaded constructor.

Functional Programming works as a mental model of how to write software as a collection of functions passing data. It can help you understand computation as isolated operations with specific inputs and outputs, as opposed to mentally modelling computation as encapsulated units of data and behaviour that manipulate each other (which is one way to describe OOP).

joshcheek profile image
Josh Cheek

I don't think there is a model that works in all situations. Computation is too abstract for that. I do think there are a number of candidates that will get you really far, eg I think having a model of the machine is incredibly enlightening and simplifying (CPU, registers, alu, memory, devices), but note that there are other types of machines, as well (eg stack based). I also definitely create mental models for languages I use. You can get really far with something like an ER diagram, but at some point you're going to care about implementation nuances, and they'll totally violate the mental model. Crazier still, some ideas must be considered independently from implementation details. Eg llvm allows a language to Target many very different backends, and it may have completely transformed your code along the way. Another argument that there aren't: the definition of computation is "anything that a Turing machine can do (aka Turing complete)", but there are infinitely many different models which can do this, and they can be very very different. Eg the lambda calculus, which is completely immutable, yet a Turing machine makes heavy use of mutability. Or combinatorial logic, which is the lambda calculus, but you're given a fixed set of predefined lambdas and can't make new ones. Heck, even CSS and Conway's Game of Life have been shown to be Turing Complete at this point. Oh, and we're on the brink of quantum computers, which violate ideas like determinism, correctness, and discrete states. So, no, I don't think programming has a single holistic mental model, but yeah, thinking about entities and relationships will get you really far.

temmyraharjo profile image

I only thinking about Technical Debt for this one.