What is "to reify" in software?

"To reify" means "to make real". It's an old concept from philosophy. When you name a concept, you can start talking about it. We do something similar in programming. When you take a concept and make it first class, you can begin to manipulate it with the normal programming constructs.


Eric Normand: What do we mean when we say, "To reify"? Hi, my name is Eric Normand. These are my thoughts on functional programming.

I use the term a lot. I think we tend to use it quite a bit in Clojure and in other functional programming communities.

The term is to reify. We say, "Well, let's reify this concept." It's one of those terms that comes from philosophy. It's an old term. Programmers didn't make it up but we did borrow it and kind of adapt it to our uses. You can look it up on Wikipedia. They used it in linguistics and philosophy. Other branches of science have taken it from philosophy.

In philosophy, it basically meant define a term for the thing. Now you can talk about the thing as if it were real. To reify means to make real. "Re," like reality, and "ify," meaning to make real.

In computer programming, it doesn't have a very complex definition. It just means that you represent a thing as part of your data model.

An example is your program might send emails. Let's say you wrote a script that piped the send command to the mail program. It piped the from, and the to, and the subject, and the body. Then it sent an end-of-stream character. Then that happened to send your email. Notice it's this imperative step-by-step view of how to send an email, but it's never represented in the data model.

It's never like a thing you can manipulate. The only thing you do is change what you send to this output stream that is going to eventually send an email. One thing that you could do is to create a new type or new class, whatever your language allows, that represents that email set.

Now you have a collection of them. You can iterate over that collection. You can count the emails before you send them and you can do other kinds of analysis on them. This is reification. This is turning this thing — basically just an action that would happen — into something that you can analyze and use in your programming language.

Just like in a procedural language, you can use an integer, and pass it around, and manipulate it, and analyze it, now, because it's part of your data model, you can take that email send and make it part of the semantics of your program.

This is one of those things that is the secret to languages like Lisp and Smalltalk. This is what they do is they give you a way to reify things. Smalltalk did it really well.

Its main advantage over other languages was, instead of things being like drawing routines for putting stuff onto the screen, you would actually represent the thing, and had a draw method. You could manipulate the thing — change its shape, change its dimensions, things like that. Change its color.

It's much easier to think in that way. This is the whole idea of object-oriented programming being more intuitive. It's that instead of having to somehow change the program so that it now output something different, you just pass in a different thing and it will draw that different thing.

Similarly, in Smalltalk, the methods, the code itself, was manipulable. It had been reified. It's like in Lisp — the code itself is something you can manipulate with the language. That is another form of reification. In Smalltalk, they just went all the way. Everything was reified. Even the class that held the code for the methods, that also was an object that you could manipulate.

Even the inheritance hierarchy was something that you could just manipulate in code. Smalltalk also went a step further and made it so that you could manipulate it with the GUI. That's another story. They wanted programming and drag-and-drop, basically — it's like the items in the menu — to be all the same. You can do it both ways.

Reification, it just means take something and bring it into your data model so that you can get a handle on it. You can use it. Usually, it means it becomes first class. You can run algorithms over it, do analysis, that kind of thing.

My name is Eric Normand. Thanks for listening. Please subscribe and you'll get notified when new episodes come out.

You can also get in touch with me on Twitter. I'm @ericnormand, or you can email me, eric@lispcast.com. This question actually came from an email. Thanks, RJ, for the great question. Yes, I'll see you next time. Bye.