Programming Philosophy

Summarized using AI

Lies

Ernie Miller • November 10, 2016 • Cincinnati, OH

In this talk titled 'Lies,' Ernie Miller, during RubyConf 2016, explores the concept of abstractions within programming, asserting that all abstractions are, in a sense, lies. He discusses how these abstractions simplify complex realities but can also lead to misunderstandings and misrepresentations of truth in software development.

Key points include:
- Personal Journey: Miller shares his unconventional path to programming, revealing his initial aspirations related to video games, dropping out of college, and eventually finding his passion in Ruby and Rails.
- Nature of Lies in Software Development: He emphasizes that programmers often lie unintentionally in their estimations and commit histories, highlighting the difficulties in accurately predicting project timelines.
- Abstractions as Lies: Miller discusses how every abstraction makes something appear simpler than it is, forming a 'tower of lies' through which developers operate. This concept is metaphorically linked to quantum mechanics to illustrate the uncertainty and complexity underlying simple appearances.
- Quantum Mechanics Analogy: He provides a simplified overview of quantum mechanics, illustrating how the debate over light being a particle or a wave mirrors the duality of understanding in programming abstractions—where the observed reality can differ from intrinsic complexity.
- Artist vs. Engineer: Miller argues that developers often act more as artists than engineers. He emphasizes creativity in creating truthful abstractions that allow users to understand and navigate complex systems without needing to grapple with the underlying chaos.
- State Management: The talk touches on state management in applications and how creating processes in programming can lead to clearer and more honest abstractions.
- Inevitability of Lies: Concluding his discussion, Miller argues for creating 'good lies' that enrich user experience and support meaningful interactions, suggesting that effective abstractions can help users suspend disbelief and engage more deeply with applications.

Overall, Miller urges the development community to acknowledge the inherent lies within abstractions and strive for clarity and truthfulness in the products they create, arguing that doing so can lead to more enjoyable and effective software.

Lies
Ernie Miller • November 10, 2016 • Cincinnati, OH

RubyConf 2016 - Lies by Ernie Miller

All abstractions are lies, if they are abstractions at all, and as developers, we live our lives surrounded by them. What makes a some abstractions better than others? This will be an opinionated and empowering look at the value and nature of abstractions, with a jaunt through quantum mechanics and the nature of reality.

You know, just your average, light discussion.

RubyConf 2016

00:00:15.340 So, this is a good start. Turns out, we're already two minutes past time. Awesome!
00:00:21.260 I have a lot to cover. My name is Ernie Miller, and I work for a company called Carosone, which is based out of Seattle. I'm based out of Louisville.
00:00:26.570 I've been giving talks for a while now, but every time I get on stage in front of you lovely people, I start to feel like a liar. The truth is, I got into programming because I liked video games and started programming at the age of six.
00:00:41.510 Naturally, I decided I wanted to make video games, so I was going to major in computer science. Anyone else here who did the computer science thing? Great! Good for you; that's very cool. I ended up taking a somewhat different route to a career in programming.
00:00:58.580 I dropped out of college to go full-time in my tech support job at an ISP. My intention was to work my way up from there. I had heard there was going to be an opening in the systems administration department, and I wanted one of those jobs.
00:01:12.290 I figured I could probably start writing code from there. So, I landed that sysadmin job, and as you might imagine, I started out writing Perl, which was quite popular with the sysadmins in that day.
00:01:23.240 By the way, I wrote a real program that actually runs and prints the text of '99 Bottles of Beer.' I wrote other languages in the meantime, but when I found Ruby, it felt like a natural transition for me, especially since people had started to hear about this 'Rails thing,' and Rails was becoming really popular. I thought I could finally pretend to be a respectable programmer and write some web applications.
00:01:50.630 But deep down, I felt like a fraud because, truth be told, sometimes I still feel like the real programmers are the ones who finish their CS degrees. And while we're talking about truth here, to be honest, this isn't even the talk that I wanted to give to you today.
00:02:07.520 That talk started life about a year ago when a friend of mine named Terrence asked me to submit a talk to 'Keep Ruby Weird.' I voiced my concern, as I thought I had a right to do, about preparation time and all of that, and he responded with what I can only assume is the conference organizer equivalent of a used car salesman’s 'let’s take the car for a test drive; there’s no obligation.'
00:02:32.840 So, Terrence knew exactly the kind of talk I wanted to give, and he knew I found the whole idea pretty scary. A couple of years ago, I opened my mouth at RailsConf about this idea I had to build a 'choose your own adventure' game. Basically, it was a talk/game hybrid where the audience would be able to vote on which way the talk would go.
00:02:50.780 I knew that if I mentioned this to somebody, I was going to be screwed, that I was actually going to have to do this talk. The problem was, I had no idea how I was going to build this thing. I spent most of my programming career writing web applications, and this was more like a game, or really a multiplayer, network-driven game than a presentation application. But it didn't really matter because I hadn’t written either of those things before.
00:03:22.640 So I gave in and wrote a proposal, but I put this giant caveat in the middle of it, thinking I might get out of it. Unfortunately, they accepted it anyway. So, before I accepted the invitation, I spent some time hacking together this amazing and incredible tech demo that you see before you right now, using Elixir, Phoenix, and React.
00:03:35.210 At the time, I wanted to make sure I could get a presenter, a desktop client, and a mobile client all working at the same time, and obviously, as you can see here, it had a long way to go. But what I was able to hack together that weekend felt almost too easy. I often tell people that the right technology feels like a cheat code.
00:03:59.000 You can judge a technology by the things that it makes feel like cheating. Another way of putting it, at that point, I figured, well, obviously, I've chosen the right technology. But in the back of my mind, I was thinking maybe I'm really cheating; maybe I just haven’t run into where this is all going to break, and I'll find out later because it couldn't possibly be this straightforward.
00:04:21.590 Anyway, I had about eight weeks to try to turn my simple tech demo into a full-fledged presentation application, and of course, this was on my spare time. I had to build way more slides than I normally would build for a presentation because of the 'choose your own adventure' nature of it. This was all for a talk of a type I had never written before, using a tool chain that hardly existed, and it also had to keep running under the load of a room full of people who I knew were going to try to break it. So, not a big deal at all, just kidding—it was a really, really, really big deal.
00:05:09.290 I was stressed out beyond all belief, and I felt like if this didn't work out, I would have lied to my friends. But to be fair, as a software developer, I’m pretty used to lying. It’s sort of our business.
00:05:25.610 Before you say, 'well, there has to be an intention,' it’s not like I intend to lie. I’m fully aware that if it’s going to be a lie, it’s got to have some intent behind it. You don’t intend to lie when you estimate to anyone.
00:05:43.730 But let’s just talk about that for a second and really think it through. Let’s assume the best-case scenario here. You pick some work off the queue, you start working on it, and once you’ve gotten into it a bit, somebody comes by and says, 'Well, how long do you think it's going to take?' You might have some general idea because you’ve started working on it, but you can’t really say for sure.
00:06:02.480 More often than not, someone’s asking you to give them that estimate too. They’re asking you how long it’s going to take before you’ve even dug into the work to understand what’s involved. So, you basically make something up. You might have even learned it's best to pad things a bit because you know someone’s going to hold you to this estimate you just gave, and you want to make sure you deliver under-promise, over-deliver, right?
00:06:31.280 Maybe you’re sitting here saying, 'Not my shop! We’re enlightened! We’re agile! We don’t estimate in units of time; we use points!' I love stock photography! So the idea with points is you’re not estimating in time; you’re estimating in difficulty as it compares to some other things that you might be estimating. Everyone just agrees to pretend that you’re not really thinking about how long it’s going to take you individually to implement this when you give them that value.
00:07:12.000 Now, when you estimate, even if you’re intentionally not misleading somebody about how long it’s going to take or how hard it’s going to be, you are lying. You’re lying to yourself. You’re telling yourself that you’re going to be able to accurately predict the future, and I hope it’s not a surprise to anyone in this room that you actually don’t have that superpower. You can’t predict the future.
00:07:35.080 We’re going to come back to that in a bit, but for now, I’d like to move on to something different.
00:07:42.320 So, Git commit histories are another area where we kind of play fast and loose with the truth. What’s Git? Well, it's a distributed version control system. But what’s a version control system? Well, it's a tool primarily concerned with keeping track of history. You know, that record of all the stuff that’s happened—the immutable list of events that have occurred up to this point.
00:08:06.780 If you’re setting out to change the past, then you’re probably going to fall into one of two buckets. Either you’re Marty McFly: stuff somehow got all screwed up, and you're the good guy just trying to set things right, or possibly you’re the original Terminator, and you're subservient to the will of machines and are working to ensure humanity's demise.
00:08:35.110 Whether you're doing it because of choice or because of your programming is irrelevant at that point. Now, from the point of view of the altered timeline, it’s impossible: no history has been changed. Let alone the motives for changing it or whether or not they were for good or evil—that’s just gone. It’s not there.
00:08:56.580 Now, maybe you think this is an unfair analogy. So, let's look at it another way. Do you know how Git is implemented? It uses what’s called a hash tree, sometimes called a Merkle tree. I’m not a CS grad, obviously, so I had to look that up. According to Wikipedia, hash trees are for verification of data shared between multiple computers, and more importantly, they’re specifically created to ensure no one is lying.
00:09:12.490 So, we’ve got this incredibly powerful tool built on algorithms designed to ensure consistency, and then we lie to it. We lie to it a whole lot, actually. And look, I mean, I understand there are absolutely tons of Git workflows that can work well, and there are plenty of situations in which these commands are reasonable or even advisable. But lots of them are just plain abusive and people usually tell me this is completely justified because they want their commit logs, their commit history to be clean, so they tell a story.
00:09:49.650 I agree; I’m a huge fan of commit logs that tell a story. It’s just that I prefer that story to be nonfiction. It’s valuable to know how things became the way they were. It's also sometimes unflattering or confusing, but I’d rather know what we tried that didn’t work so we can learn from history the next time something comes around.
00:10:04.150 Look at it this way: every time you have to force push to a remote with Git, it’s actually trying to tell you, 'Hey, you're lying to me!' and you’re saying, 'I know it’s okay; don’t worry about it; it’s for your own good.' I hope you’re really, really sure about that.
00:10:29.000 So, maybe we can be forgiven for lying so freely. I mean, we’re surrounded by lies, and every abstraction is a lie, if it’s an abstraction at all. The entire point of an abstraction is to make something seem simpler than it really is underneath the covers.
00:10:46.630 So as an industry, we've built this really impressive tower of abstractions, or if you will allow me, a tower of lies. We do our daily work atop this tower, and every story in this tower is a story that someone thought was worth telling for our own good, based on their opinions.
00:11:05.360 You might guess—especially if you know me—that I have opinions about some of those lies. Actually, scratch that; I actually have feelings about some of those lies. But because feelings are hard, I want to talk to you first about something simpler. Let’s talk about science instead, specifically something easier than feelings: quantum mechanics.
00:11:26.500 Let’s talk about quantum mechanics for a second. Anyone know what this equation is in the room? Hey, there are some hands! Awesome! So, for those of us like me who didn’t immediately recognize this formula, let’s start with something simpler. Does anybody know what this is? This is a pebble—also known as a very small rock, yes, that's true.
00:11:55.450 So if you drop this pebble into a still pool of water, you’re going to get little waves or ripples. If you drop two pebbles next to each other, you’re going to get two sets of waves, and those ripples are going to create a pattern that you see here where they intersect. Way back in 1678, this guy named Christian Huygens—it's hard to pronounce these foreign names, just bear with me—was telling people that they thought light was a wave just like those ripples.
00:12:24.360 He published this idea way back in 1690 in something he called his treatise 'Sunlight.' But waves need to be in something or on something, so what was light really going to be a wave in exactly? He made up a hypothetical substance called the luminiferous ether. And yes, luminiferous ether would make a great name for a rock band!
00:12:55.690 The problem for Huygens was this: this guy was kind of popular back in the day. Maybe you’ve heard of him? He’s kind of a big deal. Newton also wrote his own treatise on light, claiming that light was a particle. Since Newton was a bigger deal, nobody really paid much attention to Huygens at all. But there were some people who thought Newton was wrong, and Thomas Young was one of those guys.
00:13:25.050 In the beginning of the 1800s, he delivered a series of lectures to the Royal Society outlining a wave theory of light and introducing a new fundamental concept known as the principle of interference. This is a sketch that he drew; you might notice it looks a lot like the ripples we saw earlier in the way they created that pattern.
00:13:40.900 If you had two slits—the left and right A and B—in a wall and then created ripples on the other side of those slits, when they went through the openings, they would produce this pattern that he called interference patterns. If light was a wave, he predicted we should be able to see something like that if we shone light through two holes the same way we made ripples in water. In 1803, he performed that exact experiment we now call the double-slit experiment, and he saw exactly what he predicted—an interference pattern.
00:14:09.990 The really cool thing about his experiments was that they were super easy to reproduce; anyone could do it. But even a century after their origin, Newton's particle theories had so much inertia, momentum, and prestige that Young's findings didn’t draw much interest at all. Some were even ridiculing him, saying: 'How could you possibly be right? You're just going against what Newton says!'
00:14:27.610 It’s funny, scientists can be pretty petty when someone has the 'wrong opinion.' Not at all like programmers! So in part, he had a lot of trouble getting traction with his ideas because he was busy going out and demonstrating in the real world how they worked. By 1817, however, there were enough experiments from others corroborating Young’s theories that they gained critical mass.
00:14:44.450 Newton's particle theory was thrown out for a while, and classical wave theory went on to allow the invention of radio and radar among other things, but it still failed to explain certain things, including the ozone layer which protects us from short wavelength ultraviolet light. Yet, if waves pass into or out of a medium, they return to their original frequency, their original wavelength once they come back into the atmosphere.
00:15:01.190 So if light was a wave, it would pass through the ozone layer and then return back to its short wavelength, thus frying and killing us all—but that couldn't quite work. To understand why this works, we have to take just a tiny step back to a couple of millennia ago.
00:15:15.860 This cheery guy here is Democritus, and he’s also known as the 'Laughing Philosopher.' He’s usually credited with developing the philosophical theory of the atom, or atomism, in the 5th century BC. He said that the universe was made of tiny indivisible, indestructible particles that he called atoms, after the Greek word for indivisible, 'atomos.' Philosophical atoms supposedly came in an infinite variety of shapes and colors, so they could be combined in different ways to make all the things that exist.
00:15:53.600 Now, this idea survived for millennia, and in fact, when chemists and natural philosophers in more modern times discovered some tiny particles that were apparently indivisible, the natural name for them was atoms. The idea had survived all this time, but it turns out that atoms don’t actually come in infinite varieties—at least not as far as we know—and in fact, there are so few, relatively speaking, that it was straightforward to create a table of all the ones that were discovered, and even to predict the kinds that we hadn’t discovered yet. We call that the periodic table of elements.
00:16:36.940 Now, the other difference between atoms as we understand them and their philosophical counterparts is that it turns out atoms aren’t indivisible. They are made up of even smaller parts. At the end of the 19th century, a guy named J.J. Thomson, a physicist at Cambridge University, was conducting experiments with a cathode ray tube. During the course of these experiments, he discovered that cathode rays were actually streams of negatively charged particles that he estimated were about a thousand times smaller than a single atom of hydrogen. In other words, he discovered what we now know as the electron.
00:17:25.870 He went on to propose that these atoms we thought were indivisible were, in fact, divisible and that electrons were the building blocks of the atom. So we call these tiny particles like electrons elementary particles, and the electron was the very first elementary particle we discovered, but it wasn’t going to be the last. This is all well and good and kind of interesting, at least to me—hopefully you’re sticking with me so far—but how does it actually relate to the discussion we were supposed to have? Oh wait, wasn't this thing going to be about quantum mechanics or, no, that wasn’t even right either; it was supposed to be about lies. I think that was the talk title.
00:17:49.610 So in 1900, a theoretical physicist named Max Planck suggested that radiation is quantized or can only exist in discrete amounts. So you can have one quantum of radiation, you could have two quanta, but not one and a half quanta of radiation. That doesn’t—that’s not a thing right? Most scientists didn’t take him seriously, but this guy did.
00:18:10.250 In 1905, Albert Einstein suggested that electromagnetic waves, of which light is just one, could only exist as discrete or physical wave packets. He called those wave packets 'in at least one such case' the light quantum. Now, Einstein was very careful to avoid calling these wave packets particles, but still, I bet Isaac Newton would have felt pretty smug if he’d still been around.
00:18:29.750 The existence of these light quanta, which we later came to call photons, would be confirmed 17 years later by a physicist named Arthur Compton. He performed an experiment that showed that x-rays could be scattered by electrons, and so we knew electrons were particles. So, if we could scatter x-rays with particles, then it’s like colliding two balls into each other. If they affect each other, they must both be particles.
00:18:51.540 But wait, we already established that light behaves like a wave. So which one is it? So when we shine light through two slits, like that double-slit experiment earlier, we see the interference pattern we would expect if light is a wave. But if light is a particle, and we know it is thanks to Einstein and Compton, then we should also be able to send just a single photon through those holes.
00:19:24.050 Now this thing here (indicating a piece of equipment) is a photomultiplier tube, and it's a device so sensitive that it can detect the impact of a single photon. If we put it in an extremely dark place and we shine an extremely faint light through those same two slits, we can tune things until the photomultiplier tube is only picking up a single photon at a time, and then we can check to see where those photons landed.
00:19:49.380 As the photons are fired through the slits, they appear to be a pretty much random distribution. But if you track them over a long enough period of time, something really cool happens. Even though the photons are arriving one at a time, the same interference pattern we saw earlier appears. Now how is that even possible? What’s the photon interfering with, or being interfered with?
00:20:16.490 The answer lies in something called wave functions. Now these are basically the heart of quantum mechanics. A wave function tells us the probability that a particle is going to be observed in a given position at a given time, and we don’t actually know what these are, what they're waves of or what they’re waves in. I only hope they’re halfway as cool as luminiferous ether whenever we do figure that out.
00:20:37.620 Werner Heisenberg and Niels Bohr were physicists that actually pioneered quantum mechanics at the University of Copenhagen in the 1920s, and they had an interpretation of quantum mechanics that seemed to work called the Copenhagen interpretation. Today, it says that the wave function doesn’t actually have a physical nature at all and is comprised of pure possibility.
00:21:01.490 A particle that traverses the double-slit experiment exists only as a wave of possible locations that encompasses all the possible paths that it could take. It’s only when we detect or observe the particle that its location and the path that it took to get there are decided. We call this wave function collapse—that’s what occurs when you detect it.
00:21:29.000 Prior to the collapse, it’s meaningless to try to say anything meaningful about the particle because it’s as though the universe is allowing all these possibilities to simultaneously exist. We call this state a superposition, and it holds off on choosing until the very last instant when we measure it.
00:21:51.391 Not only that, but those different possible paths, the different realities, they all interact with each other in such a way that the interactions increase or decrease the chance that the next particle is going to land in a particular place. And that interaction we see as an individual particle eventually creating this full-on interference pattern. This pattern is real, even if most of the paths that were taken to produce it never happened.
00:22:13.270 In the Copenhagen interpretation, the final choice of the experiments in the universe is random within the constraints of these functions. However, quantum mechanics does produce accurate predictions of reality and is consistent with the Copenhagen interpretation. But there are lots of other interpretations, and one other we’re going to talk about today seems to work too.
00:22:50.180 If you’re still with me, take a deep breath. We’re getting close to wrapping up all of this science stuff before getting into the feelings because you know it is a Ruby conference after all, but it’s going to get a little bit weirder before we finish.
00:23:04.749 So, this is Erwin Schrödinger. He was an Austrian physicist, and you’ve probably heard of him. Remember this thing? This thing is known as the Schrödinger equation, and it’s a partial differential equation that describes how the quantum state of a system changes with time. He formulated it in 1925 and won the Nobel Prize in 1933.
00:23:28.590 He was following the writing and experiments of Albert Einstein, Boris Podolsky, and Nathan Rosen—three researchers that had some real issues with the strange nature of quantum superpositions, specifically having real issues with the idea of wave function collapse, as proposed by the Copenhagen interpretation.
00:23:52.180 They described this thought experiment which became known as the EPR paradox, and they published a paper in 1935. The short version of it is that if any particle’s position is unknown until measured, suppose for a second that two particles interacted with one another in some way, and you knew the nature of the interaction; then, in theory, you could predict the position or the second measurement of a particle if you knew the measurement of the first one.
00:24:16.900 This concept was going to later be called quantum entanglement, and they claimed that if the outcome of a measurement can be predicted, then there’s something else at play here—some real-world thing, an element of reality that must describe it because you can’t predict the unpredictable.
00:24:45.000 So they said, in short, the Copenhagen interpretation was correct but could not possibly be complete. Schrödinger agreed, and over the course of extended correspondence with Einstein about the EPR paradox, he came up with the thought experiment you’re probably going to know me for.
00:25:05.070 Now, I’m going to ask you to forgive me when I ask you to forgive this particular illustration. This is not an accurate illustration of the Schrödinger’s cat experiment, but it’s not as morbid! Schrödinger proposed a scenario with a cat in a locked box, which had a tiny bit of radioactive substance in it.
00:25:24.000 It also had a Geiger counter and a mechanism hooked up to the Geiger counter so that if there was a single atom of radiation detected by the Geiger counter, it would smash a small flask of poison and kill the cat. You can see the cat looks a bit annoyed. I’d be annoyed too.
00:25:44.940 According to him, the Copenhagen interpretation implies that until we make this observation, the cat remains both alive and dead until the states are observed. You might say, 'But that's impossible!' I promised someone I wasn't going to laugh at this slide, but it's my favorite slide.
00:26:10.420 So Schrödinger wasn’t actually promoting the idea of alive and dead cats as a real possibility. He was doing this to show how absurd that notion was; it just didn’t make any sense, and that was the existing view of quantum mechanics—it’s like something’s got to change.
00:26:26.540 Years later in Dublin, in 1952, he gave a lecture during which he was warning the audience that what he's about to describe might seem ludicrous. It was when his equations seemed to be describing several different histories; they aren’t alternatives but are all actually happening simultaneously.
00:26:46.020 This was really the earliest known reference to what later became known as the many-worlds interpretation of quantum mechanics. The many-worlds interpretation would be more formalized by Hugh Everett in 1957, and he called it the relative state formulation because that sounds scientific.
00:27:05.390 But the claim is that it isn’t just tiny particles that have a wave function; everything, everything that exists has a wave function of possibilities. Everett’s thesis introduction is kind of dense, so I'm just going to read it out loud for a second.
00:27:28.510 'Since the universal validity of the state function description is asserted, one can regard the state functions themselves as the fundamental entities. One can even consider the state function of the entire universe, and in this sense, the theory can be called the theory of the universal wave function since all of physics is presumed to follow from this function alone.'
00:27:50.990 That’s quite dense, but in an early draft of his doctoral dissertation, he explained it in a way that makes a little more sense as an analogy. One can imagine an intelligent amoeba with a very good memory. As time progresses, that amoeba is constantly splitting. Each time, the resulting amoebas have the same memories as the parent amoeba. So it does not have a life line but a life tree.
00:28:06.740 This is an excerpt from a letter that Einstein wrote to Schrödinger over 15 years after they started corresponding. Einstein never really stopped being frustrated with the ad hoc nature of wave function collapse that the Copenhagen interpretation proposed. It felt like a cop-out.
00:28:26.840 It surely did to Everett as well. His relative state formulation seems to suggest that the more real thing is the state functions themselves, and then all of physics emerges from those state functions.
00:28:43.480 So those functions that we can’t see—that we just map—are the more real thing. It’s still impossible to deny the usefulness of the Copenhagen interpretation, or if you’ll allow me to call it the Copenhagen abstraction, this makes sense of things. Reality or truth then becomes a question of perspective; how much reality is enough?
00:29:04.330 Alright, deep breath—we got through the quantum mechanics stuff. Congratulations! You all now know much more quantum mechanics than you did walking into the room. Hopefully, that gives you a context.
00:29:26.800 A while ago, I told you that estimates are lies, and I still do believe that to be true. Taking estimates individually, they are wildly inaccurate. We don't know how accurate our estimations are going to be in advance, and we have no way of knowing for sure how long it will take until the deed is done when we deliver the finished work.
00:29:57.290 But the funny thing is, estimates tend to be wrong in ways that offset each other. There are easy things that turn out to be hard and hard things that turn out to be easy. A pattern emerges that you can start to base larger-scale predictions on, so you end up with this paradoxical result that estimates can work really well, so long as we can all agree to accept that ad hoc principle that they don’t actually work at all.
00:30:29.990 Or maybe things are more like they are with Git. Maybe there’s some objective notion of truth, but that truth, like the biggest Git repository you’ve ever seen, branches off into an infinite number of directions. The state that we observe is just the head of our current branch.
00:30:54.970 Is it any wonder then that there are intelligent people asking whether or not we are actually living in a simulation? And it’s not just one isolated individual either; there are all kinds of voices asking this question, and some seriously smart people think it’s almost a certainty. Others say it’s completely ridiculous. It’s disturbing to some, and it’s easy to dismiss this stuff as the stuff of science fiction or completely irrelevant since we can’t yet figure out any way to prove or disprove it.
00:31:21.170 But let's not forget that 5th century BC Greek philosophers had very limited powers to observe, and yet somehow managed to come up with the idea of the atom, which panned out to be pretty true. How many of you have seen 'The Matrix?' There are actually some hands that did not go up, but I am fairly sure that 17 years is way past the statute of limitations for spoilers—feel free to plug your ears if you disagree.
00:31:45.320 Central to the plot of 'The Matrix' is the idea that most of us are living in a simulation called the Matrix while our real bodies are hooked up to machines generating power for artificially intelligent machine life. Some humans have been unplugged, and they can enter and leave the Matrix at will, fighting those machines in a real world that, by the way, is hellish by comparison.
00:32:07.530 I want to show you one of the most memorable clips from that movie for me. Cypher, the guy on the left, has been unplugged for nine years and is meeting with an agent of the machines. I just want you to watch this for a second.
00:32:32.000 'Do we have a deal, Mr. Reagan? You know, I know this steak doesn’t exist. I know that when I put it in my mouth, the Matrix is telling my brain that it is juicy and delicious. After nine years, you know what I realized? Ignorance is bliss!'
00:32:53.370 To be clear, the situation in the Matrix is not quite the one that's posed in the simulation hypotheses, and that’s what makes it especially interesting to me. In the simulation hypothesis, there’s not a real version of you at all. Depending on our perspective, the simulated version of you is the real one. But what Cypher is asking for is fundamentally different.
00:33:17.170 He knows the version of him that exists in the Matrix isn’t the real one, and he says, 'Ignorance is bliss.' He wants a deal that will plug him back in and make him forget that it’s not real. He wants to make the simulated reality his reality again, and that brings us back around to the point of abstraction.
00:33:41.000 Okay, all that out of the way! Let’s talk about those feelings I mentioned. It’s been said that science is the search for truth, and a lot of you said that you had computer science degrees. Do you spend a lot of time searching for truth, or looking for code examples on Stack Overflow? That does not count, by the way.
00:34:11.420 You might say, 'Well, it’s really an applied science,' or 'I’m a software engineer; it’s an engineering discipline,' and that's fair. I mean, there are very good cases to be made for applying engineering principles to software development. But then we’re not really—we're just going from searching for truth to applying truth, which is different.
00:34:34.520 For some reason, we shy away from labeling ourselves as artists, but I feel that we spend a lot more time being artists than we do being engineers or scientists. And there shouldn’t be any shame in that. Now, artists move beyond searching for truth or applying truth; they actually express truth, and some might even go so far as to say they create new truths. That’s what we actually try to do with abstractions.
00:34:55.880 Now, I still believe that abstractions are, by their very nature, lies. But when we work with code, don’t we strive to create things that feel somehow true, that feel consistent? How do we do this as artists? Well, the first thing that we do is we try to aid the suspension of disbelief. Performance artists do this all the time, so the lie is for your own good. It’s something that’s supposed to give you some enjoyment or reduce your suffering in some way.
00:35:39.840 When a magician pulls a rabbit out of a hat, you don’t have to really believe he has magical powers. You just have to be able to suspend your disbelief just enough to enjoy the show. This just needs to go so far as to enable enjoyment—it’s that informal contract between the audience and the performer.
00:36:04.910 Our audience should be left wondering, you know, how did they do that? It does absolutely no one any good if having seen a magic act we’re so convinced magic is real that we go home and try to saw our partner in half, for instance! It’s the context in which an abstraction is framed and from where we perceive it that influences just how truthful it’s going to feel.
00:36:35.400 For instance, if I show you this code, you don’t assume that I create an instance of a person with a name or email or created a copy of myself. The object represents just a small, shallow slice of what I am—specifically, my name. I can count on you as programmers to share that context. Earlier this year, I gave this presentation, I talked about the beginning, and I gave it at Ruby on Ales in Bend, Oregon. Those organizers gave a surprise to all the speakers, and this is the one that I got—it’s me with my cat, Esther.
00:37:05.890 Now, when I say this is me, you understand this is an artist’s interpretation of me portraying what they think I look like. That’s one part of me; I didn’t have to tell you that. And this is me too—again, you make the leap that this is me when I was younger and also that I was a huge dork—you’re right on both counts!
00:37:30.760 How do you know me from Twitter? If somebody says 'Ernie Miller' to you, you might think this is how you picture me? What isn’t me? Well, it’s still just a photograph. It’s an abstraction that represents me, but even when we go back to the painting, the portrait, that distinction seems almost silly, right?
00:37:55.800 That’s because of a shared understanding, a shared context we have about pictures that’s been ingrained over the course of millennia—from the very first cave painting—it’s sort of elemental. We’re able to build on top of that shared understanding to express or create things that feel true.
00:38:20.690 So once we believed water, fire, earth, and air were the elements and everything was made from them. Now we know about atomic theory and the elements in the periodic table, but we also know that those don’t exist without even something more elemental—the elementary particles. But given how useful it is, even on its own, the periodic table is not going anywhere.
00:39:07.530 The jumping complexity between the elements and elementary particles…remember, by the way, that we still don’t actually understand how these particles work. The periodic table is still really useful as an abstraction.
00:39:23.910 So how does any abstraction achieve that feeling of being true? What does it really take for it to become elemental? It does so by being pervasive, persistent, and practical. So elemental abstractions have been everywhere; they have been for a long time. They might be made of more elementary things, but they’re useful in their own right.
00:39:50.540 Even without understanding what’s underneath, modern web applications like the ones you’re probably building are compounds of really four elements: HTML, CSS, JavaScript, and state. You could be forgiven for swapping state for SQL or something like that, but really it encompasses whatever gives the actions in your application some impact on the system.
00:40:13.940 There was a long time during which I had these sort of partially formed feelings about certain abstractions that I struggled to explain. As developers, we tend to talk about things like leaky abstractions or violations of the principle of least astonishment, but those words are just proxies for what we’re really feeling.
00:40:33.260 In the first case, it's a suspension of disbelief; this belief has been broken because we were forced to understand how things worked under the hood. In the second, we already had some context for how things worked, and the abstraction broke that reasonable expectation we had based on that context.
00:41:03.920 And that’s when it actually dawned on me: there was a reason I had such strong feelings about these abstractions—I was a naive young Rails developer. I was attracted to shiny things, like we all were when we were naive young Rails developers. They lured me in with promises of a better world.
00:41:35.170 They told me they were going to lie to me for my own good and make things better. But it turns out that road could only end in heartbreak because they were lying to replace something elemental. Who knows what that logo is? How many of you are familiar with Haml?
00:41:50.780 How many of you like Haml? I’m sorry. So when Haml came along, I took one look and I was like, 'Yes, please!' It looks so clean! Look at it; look how climbing it looks—how elegant! But while Haml will generate valid HTML, valid HTML is not valid Haml. You can try funneling it through and see what happens.
00:42:08.260 It was the same thing with Sass. Whenever Sass was first coming out, it looked so pretty; it’s got variables and nesting and mixing. Those are all things that I had longed for in CSS for ages. I was like, 'Sign me up!' But once again, valid CSS is not valid Sass, forget you ever knew CSS.
00:42:22.970 What about CoffeeScript? Any fans of CoffeeScript? A few? Look how pretty it is! It hides JavaScript, and if I squinted, it almost looked like Ruby, and I loved Ruby. So, you’re probably seeing a pattern. All of these things attempt to stand in for something that we can’t escape.
00:42:40.390 When we debug our applications in the browser, there’s still HTML, CSS, and JavaScript. There’s no amount of source mapping that’s going to change the reality that lives underneath. So we’ve got these abstractions that stand in for something elemental, but they ask us to forget what we already knew, even though the browser is not going to forget it.
00:43:06.200 And there’s got to be a better option. I personally think a better abstraction to replace HTML is just embedded Ruby. It gets it right; it’s a plain old HTML file. It is still perfectly valid, if incredibly boring. Embedded Ruby only triggers the Ruby interpretation whenever you ask for it with special tags that aren’t HTML tags.
00:43:33.780 That part’s important; we’re extending, not modifying. SCSS gives you all the good stuff in Sass as a superset of CSS, and the same thing with ES6 or 2015 or whatever the heck they're calling it this month. It extends what you already know to be true, so it feels natural.
00:43:58.490 But that’s only three of the elements. What about state? So, back to the beginning, you may remember I was mildly stressed out by having agreed to do a talk in eight weeks, and I didn’t have a working application. I punted on a lot of things for that proof-of-concept stuff, like loading a real slide deck. I was hard coding slides in there—it was horrible.
00:44:28.750 Being able to have some speaker notes, actually rendering attractive slides— as you might remember, they weren’t terribly pretty before and had to be written in markdown. Even having all of that said, the application continued to be a breeze to build.
00:44:52.580 I got the basic presenter UI laid out completely, connected with slide preview notes and connection info. I got slide loading and voting functionality built out; then, I got it rendering properly on several browsers. To tell the truth, the hardest thing about this application was getting the CSS to play nicely.
00:45:09.430 The fact that you probably can’t tell the difference between those two screenshots is a testament to how stubborn I was. Actually, as I started building the talk, I was like, 'It would be nice to reuse this voting thing to vote on general bar chart-like pulls instead of branching votes.'
00:45:28.590 It turned out to be something I could do in a couple of hours, and oh yeah, maybe images should have captions—okay, I can add that; that’d be fine. When I use images, I need to find a way to include attribution because, turns out, people like to be attributed for their work! I also like to use quote slides, and that would be great if that just worked.
00:45:55.740 And you know, then I’m building part of the talk discussing abstractions, and I’m thinking about how distracting chat applications are going to be. Everybody’s already connected to the server, so why not make a slide that’s literally a standalone chat application so that everyone in the conference can talk and be distracted during that part of the talk?
00:46:18.750 I was later told by someone who attended the talk that this was the most beautifully over-engineered talk they’d ever seen. I took this as a compliment because it was a pleasure to build! So why not? I’m not overstating when I say that I had more fun and joy building this application than anything that I’d built in the past.
00:46:44.130 For the most part, I didn’t even feel like I was building a web application; it was just like building an application! It felt like using an application. I think it’s because I managed to avoid dealing with all the pain caused by one lie that we’ve been living for so long—we started to think it’s true.
00:47:05.270 You can totally fake this, but building a stateful application on the back of a stateless protocol is kind of weird, and we’ve spent decades figuring out better ways to fake it. But the fact is traditional server-rendered web applications are a huge hack; I’m surprised they work at all.
00:47:36.150 I mentioned before that I had gotten into programming through systems administration. As a sysadmin, when I SSH into a server, I was starting processes that forked other processes. Whenever I was in an active SSH session, did I have to stop and resend some credentials manually to tell the SSH server: 'Hey, this is me, like I’m still me?'
00:47:56.780 In HTTP, we do all the time with cookies, sessions, and all kinds of things that sound familiar. The elemental abstraction for state is a process, and I think this is a big part of why we generally say that threading is so hard.
00:48:25.430 It’s as though Erlang—by extension Elixir—said, 'You know what? We can’t really get away from dealing with processes, so let’s just call it what it is and try to make it as lightweight and honest as possible.' That’s like serious judo right there.
00:48:45.290 I think that’s why I found this application such a joy to build. There’s something truly special about an honest abstraction. Pretty much everything in the app came down to processes and messages.
00:49:03.300 From the moment the React application had connected via the Phoenix web socket, it was just another process of the system as far as we were concerned. Communicating via socket processes, whether they represent an attendee or the user, provided them the right.
00:49:27.390 And really everything, even in the React side, was just messages. There were actions dispatched, but they were messages, vice versa, and whenever they were sent, they’d get translated back and forth through the web socket.
00:49:51.090 Since the UI was just the result of a function applied to the current state of the application, everything was very consistent and felt really honest. That’s what I really love about Ruby right now: we’re planning to bring some capabilities to Ruby Guilds, at least as they've been described so far.
00:50:10.470 I checked with Co-Ag, to make sure this slide was not inaccurate—they almost feel like many processes that have their own sort of state in the Ruby process. So where things need to happen in parallel, we can wrap them in a guild.
00:50:30.400 When they don’t, and when the guild just needs access to object states, those objects can just live in that guild. And you get away from all that extra ceremony. We kind of get the best of both worlds.
00:50:50.100 Let's ignore for a second how we’re going to split out those user socket processes; I think we’ve still got plenty of time to figure that one out. I’m just happy we’re going to have some new tools that will help us tell more helpful lies.
00:51:07.940 That’s what a good abstraction does: it helps us suspend disbelief. It helps us treat a lie as something true. And I don’t want you to miss the really important bit here. The real power of an abstraction lies in its ability to affect perspective.
00:51:27.360 It lies in their ability to free our minds to think about something else. Every day, every line of code you write has the opportunity to create this kind of perspective shift for the people who use it. So make your lies great ones, and may your users always feel that ignorance is bliss.
Explore all talks recorded at RubyConf 2016
+82