This is an experiment I am doing about introducing a bit of self-referential stuff in Chapter 13 of "Data-Oriented Programming.
I was inspired by the "Gödel, Escher, Bach" masterpiece. Not sure yet, if it will make it into the official version of the book though. It depends on your feedback.
Throughout the book, Joe — a senior Clojure developer — reveals the secrets of Data-Oriented Programming to Theo and Dave — two fellow developers — who get quite excited about this new paradigm.
In Chapter 13, Dave tests a piece of code he wrote using as a example the book "Data-Oriented Programming" written by your servant.
var yehonathan = {
"name": "Yehonathan Sharvit",
"bookIsbns": ["9781617298578"]
};
Author.myName(yehonathan, "html");
// → "<i>Yehonathan Sharvit</i>"
And that’s how the self-referential fun begins…
Please read this article on a device with a wide screen, like a desktop or a tablet. I don’t think it renders well on a mobile phone.
When Theo comes to Dave’s desk to review his implementation of the "list of authors" feature, he asks him about the author that appears in the test of Author.myName
.
THEO: Who is Yehonathan Sharvit?
DAVE: I don’t really know. The name appeared when I googled for "Data-Oriented Programming" yesterday. He wrote a book on the topic. I thought it would be cool to use its ISBN in my test.
THEO: Does his book present DOP in a similar way to what Joe taught us?
DAVE: I don’t know. I guess I’ll discover when I receive the print book I ordered.
A few days later, Dave walks to Theo’s cube holding a package. Dave opens the package and they take a look at the cover together.
THEO: Wow, that’s-- that’s… odd. The woman on the cover - she’s so familiar. I could swear she’s the girl my grandparents knew from this Greek island called Santorini. My grandparents were born there, speak often of their childhood friend and have a photo of her. But how could a girl from their little island wind up on the cover of this book?
DAVE: That’s so cool!
Dave opens the book with Theo looking over his shoulder. They scan the table of contents.
THEO: It looks like this books covers all the same topics Joe taught us.
DAVE: This is great!
Dave leafs through a few random sections. Hi attention is caught by a bit of dialog.
DAVE: Theo, this is so strange!
THEO: What?
DAVE: The characters in Sharvit’s book have the same names as ours!
THEO: Let me see…
Theo turns to a page from the first chapter. He and Dave read this passage side by side.
DAVE: I remember this situation. It was around a year ago just a few weeks after I had joined Albatross.
Theo’s face turns pale.
THEO: I don’t feel well.
Theo gets up to splash cold water on his face. When he comes back, still pale, but in better control of his emotions, he tries to remember the situation described in the first chapter of the book.
THEO: Was it when I showed you my design for Klafim prototype?
DAVE: Exactly! I was quite impressed by your class hierachy diagrams.
THEO: Oh no! Don’t remind me of that time. The long hours of work on such a complex OOP system gave me nightmares.
DAVE: I remember it as a fun period. Every week I was learning a new technology: GraphQL, Elasticsearch, DataDog, Bigtable, Spring, Express…
THEO: Luckily, I met Joe a few days later.
DAVE: Apropos Joe, you never told me exactly how you met him.
THEO: Well now you’ll know everything. The meeting is told quite accurately at the beginning of Chapter 2.
Dave reads a few lines in the beginning of Chapter 2.
DAVE: The book doesn’t say if it was on Hacker News or on Reddit that Joe you exchanged with Joe.
THEO: I remember it very well: It was on Reddit. In the "r/clojure" community.
While they talk, Dave leafs through the pages of the book, when he comes across a curious passage from Chapter 15…
DAVE: Do you know what déjà lu means?
THEO: No. But it sounds like it’s related to déjà vu.
Dave and Theo sit quietly, pondering the meaning of "déjà lu" and the bigger puzzle of this weird book.
DAVE: That’s it! I think I got the hang of it.
Dave shows Theo the result from Google translate with the "Detect language" option activated.
DAVE: In French, "déjà lu" means "already read".
THEO: Do you think that the author is French?
DAVE: Probably. That would explain some odd turns of phrases I’ve noticed here and there in the way the characters express themselves.
THEO: But of course! At least we have found a point on which we are not identical to the characters in this book.
DAVE: Anyway, A déjà lu must be when you live a situation that you have already read in a book.
THEO: But I don’t think we’ve ever been together at a museum!
DAVE: Me neither. Could this book be telling not only the past but also the future?
THEO: A future that we will already know when it will happen since we are now reading it.
Dave and Theo together:
— A déjà lu!
DAVE: This book tells our past and our future. I wonder if it also tells our present.
THEO: What chapter do you think we would be at the moment?
DAVE: Let’s see. At the end of Chapter 12, there’s a beautiful drawing of the JSON schema cheatsheet we made together last week. It means, that we should now be in Chapter 13.
Dave slowly turns the pages of the book, until he finds the line that tells the present moment.
THEO: Dave! This is freaking me out! I think we should close this book immediately and forget all about it.
DAVE: I can’t. I’m too curious to discover my future.
THEO: You’ll have to do it without me. Joe told us many times we should never mess up with the state of a system.
DAVE: Wait! It’s true that Joe taught us the merits of immutability. But that only concerns the past state of a system. He never said we didn’t have the right to mutate our future!
THEO: You mean that reading beyond Chapter 13 won’t necessarily lock us in a predefined scenario?
DAVE: I hope so!
Hoping to stay in control of their destiny, Theo and Dave start reading Chapter 14 of "Data-Oriented Programming".
Please share your thoughts about this self-referential stuff by replying to this tweet.
Did you enjoy this self-referential stuff in Chapter 13?
Do you think it’s a good idea to include this self-referential stuff in the book?
How would you make it better?