r/computerscience • • Nov 09 '19

Code is magic

I just had a wonderful realization and I thought I might share. To preface this, I always wanted to go to Hogwarts as a kid and learn magic. I became somewhat disenfranchised with the world as I grew older, but I have recently begun to rekindle a sense of wonder and excitement for the world.

A big part of that has been learning to code. I was thinking about this the other day, and I realized that I have essentially been learning magic by any standard throughout history, and for some reason I take that for granted!

Through a high-level language, we manipulate electrons in order to create symbolic information patterns that can accomplish real tasks - to anyone from any other time in history, if they could see us they would think we were literally witches and wizards.

At Hogwarts the students learn to predict the rough future through magic. I can do the same with data analysis, game theory, and machine learning networks. They can see things from the other side of the world - I just finished coding a security cam for my dorm. They can imbue non-living matter with sentience - robotics. They can manipulate life - bioinformatics - if I had access to the right tools I could literally breed glowing animals. Artificial intelligence adds an even cooler aspect to this given we might soon be able to create sentience from non-sentient matter! Even the bad powers, killing people, controlling people etc are real - consumer programming, psychometric targeting through the internet, drone strikes, malicious hacking, etc.

By extension, everything we are exploring in modern science is really magic. We don't really know how this stuff works or why it works - if you look at the physical constants of the universe they seem somewhat arbitrary. While we do have a good sense of the relational properties between things in reality, we don't know why they are what they are - like electrons! We know the rules that dictate their interaction with other things in reality, but we don't know why they exist the way they do, where they came from, or for that matter where any of this really came from! Somehow through all these layers of abstraction, from basic properties of atoms and forces, to high-level symbolic computation, we manage to actually do stuff, and that stuff is no less absolutely amazing! I don't think it's hyperbole to say that we're all doing real magic.

162 Upvotes

47 comments sorted by

21

u/Finallyfreetothink Nov 09 '19

I love this post. I started programming on an apple IIc in 1984. BASIC and then assembly. Fell in love.

Yes...it is magic.

2

u/[deleted] Nov 10 '19

Yes, I'm starting to fall in love now with python... Not sure how healthy it is though, on more than one occasion I've coded for 10 hours straight! :)

2

u/Finallyfreetothink Nov 10 '19

I hope you watch Silicon Valley. Fantastic show. Hyper real. And they do that all the time.

You get in the zone...

I wish my work let me focus on one project at a time. Hard to get into that place.

0

u/[deleted] Nov 10 '19

[deleted]

13

u/Finallyfreetothink Nov 10 '19

So eloquent. Thank you for telling me I didnt fall in love. What would I do without someone to interpret my feelings.

Dick. Go fuck yourself.

4

u/satanikimplegarida Nov 10 '19

I HATE magic. With passion. Of a thousand suns.

Let me explain what I mean about that. First of all, it trivializes the monumental efforts of countless scientists and engineers who spent countless hours and laid down the foundational work of which we now benefit so much. Secondly, saying something is magic absolves you from what I see as your responsibility to actually understand what's going on behind a system, an algorithm and so on. Computer science can be understood. There is nothing 'magical' about it.

All in all, in my (apparently not-so-humble) opinion, I think that this is not a sound mindset, at least not for a scientist.

As a bonus, here's Jonathan Blow's presentation about preventing the collapse of civilization. He's theorizing that our superficial understanding of science will be problematic for the human species, since 'stressors' could wipe out vast swaths of knowledge in an instant. Enjoy.

https://youtu.be/pW-SOdj4Kkk

3

u/[deleted] Nov 10 '19

The way I conceptualize it, saying it is magic isn't supposed to trivialize the work of scientists or engineers, instead it's meant to lend an element of wonder to what is often considered boring and monotonous. Also, I don't think that saying it's magic should absolve you of responsibility to understand how it works - I think if anything that is further motivation to understand it! We don't really know why anything is the way it is though, just why things relate to each other the way they do. I'll give an example: When you touch a table, why doesn't your hand just go through the table? It's because there is electrostatic force generated between the particles in your hand and the table right? Yes, but what are those electrons made of, and why do they exert force on each other? Well we can describe the force mathematically, and we think the electrons are sort of probability clouds that have something to do with leptons, and we can describe the behavior of those mathematically as well, but what are they made of? What I mean to say is that it seems we have found mathematical relationships between things in reality and we equate that to "understanding", but it really isn't. Unless it is mathematical relationships all the way down, and reality is simply information, but then one must ask why the information is structured the way it is, why it holds the way it does, and whether the patterns we find in it like symmetry are there because "something" chose for them to be that way, or because they simply are. So, going back to my original point, I don't think we fundamentally understand what anything really is, we have just found ways to mathematically described the things we have defined as being "real", but we do not know what gives them "realness". Somehow, through are descriptions of these relations however, we can build devices and languages which allow us to interface with reality in ways would be considered magic to anyone else in history, and I would add that they are magic, or at least they will maintain that status on a fundamental level until we discover the origin of truth for our universe. I think if we ever discover that it will be so wonderful that the only conclusion will be wonder at the beauty, and I suppose magic of our reality.

2

u/satanikimplegarida Nov 11 '19

Piecemeal answers to points in your post:

  • Magic is by definition non-understandable, as it is not real, and that is my whole point about framing computing science as magic; CS is the complete opposite of magic; structured, algorithmic, disciplined, observable & testable, abstract, pure, a world of ideas. It may be HARD, but it is also understandable. Magic absolves you of understanding, something happens but there's no reason behind it.

  • I find the hand-through-table trope to be fun the first time you hear it, then it gets boring, and then it's straight up misleading. The reason for this? It ignores scale, and in CS the equivalent is the abstraction level. Emergent properties of things at larger scales are as real as everything else ; my hand not going through the table just exposes an incomplete understanding of the micro-scale world, and does not affect our understanding of the human-scale world in any meaningful sense. Using an appropriate abstraction level for conceptualizing is one of the most critical skills you can have.

  • If you want to discus subatomic particles, chaos theory and determinism, and by extension free will, feel free to feel 'a sense of wonder and awe' as all these things skirt the limits of humanity's knowledge. But that's not about what CS is about.

p.s. I might have gotten off the wrong side of the bed this morning. But I did tell you that I HATE magic. ;)

2

u/[deleted] Nov 11 '19

Hmm... In the spirit of stubbornness I will offer one last reply.

I feel like you are correct in saying that posing code as magic to people who have no understanding of the rigor and structure that has been built up in the field over the last few decades is correct - you don't want people to think waving a wand gives them a hadoop framework because it is actually extremely complex. The point I am making more though, is that in order to truly understand something, you must understand all the components that relate to that thing - otherwise you have simply observed portions of the thing and understand its relational behavior, but not the thing itself. So, following this logic, given we don't yet understand the fundamental nature of reality, and rather have made observations about how pieces of reality we can observe and classify relate to one another - by definition, we do not yet understand how our technology really works and this lends it an element of magic (akin to a proto-human finding fire. Does it understand combustion equations?). You might tell me to fuck off reasonably and that compsci is about understanding abstraction levels and syntax and whatnot, but I would respond that in the spirit of abstraction levels, we can also position ourselves at different "levels" or perspectives to view the field as a whole. I have a job as a data scientist, and I never lecture my companies clients about this stuff, I'd be fired! With that said, to say that it doesn't relate to the field is disingenuous, because by definition in order to us to understand all these abstraction levels going higher and higher, we should be able to understand the nugget of truth at the bottom of the tower of abstraction - but so far as we can tell, at the risk of a cliche, it is turtles all the way down. We have not been able to find that nugget, and thus the whole tower of human knowledge (which CS fits neatly inside) appears to be somewhat wondrous.

I think perhaps where we may fundamentally disagree, but where neither you nor I can prove ourselves to be correct, is that perhaps you believe it is not magic because someday we will discover the rules, and this complete picture of the universe will be known, thus everything is explainable, and nothing is magic. I don't think this is possible, but lets say it was, and we found all the rules. So, these rules would then explain why reality spontaneously generated itself ~14 billion years ago in a massive explosion, from what we can only assume is some sort of void without time or space, with the very specific configuration of rules that we have been given? Ok, so now we are at a hypothetical point where we have discovered everything, and reality still seems arbitrary, and from this arbitrary nature beauty arises. At this point, perhaps it is a semantics issue, but I would choose to call that beauty magic - hence, my original point.

1

u/satanikimplegarida Nov 11 '19

Sure, I get it. There is a base layer from which all emergent marco properties of this world arise, and since we do not really understand that layer that well, everything is a bit magical, including CS. I get it.

...But I will still argue that this is not a terribly interesting thought to have, for two reasons.

First, regarding the magic from base layer permeating other things. Today I had a toast and coffee for breakfast, isn't this magical? After all, my breakfast was made up of electrons that I don't understand, thus it must be magical. Through this admittedly very sarcastic sounding example, the underlying point comes across: either everything is magic (including CS) or eh, magic is so common placed that it becomes overrated. The air we breathe, the rays of light coming from the sun, the sakura flower pedals in the spring... cancer, war deaths and plagues, the ebola virus... so much magic.

And the second point is this: CS has an abstract, mathematical quality in it. It comes from abstract ideas that are not tethered to the 4 basic nature laws of this universe and its constants. Think about this: 1 + 1 = 2. This is an idea, an axiom, something so theoretic that the dirty, arbitrary, magical world we live in cannot even dare to touch! This realization is chilling! If the CS-electron stuff is magic, then the world of abstract ideas is straight up forbidden black arts & voodoo! I mean, it's not even affected by this world, how crazy is that!!!

Your computer is a marvel byproduct of this world (see how I avoided using the word magic here), a marvel so advanced that can, given an input program, execute it at blazingly fast speeds. On the other hand, CS as a science is abstract, based on mathematic axioms (1+1=2) and is completely understood hence my original point that CS != magic.

Closing comments: if you want to discuss whether mathematic axioms are universal or tethered somehow into the properties of this world, a) I'm pretty sure we're entering the aristotelean metaphysics domain here so you'd be better served following that path of philosophy and b) eh.. r/computerscience is IMHO just not the place for it.

If you made it this far, let me belatedly apologize for my tone of language. It may be sharp, but I can't help myself; I kinda enjoy it ;). I thought about it for a bit and I realized I'm actually not achieving much by using it, other than coming along as standoff-ish and smug.

1

u/[deleted] Nov 12 '19

"Think about this: 1 + 1 = 2. This is an idea, an axiom, something so theoretic that the dirty, arbitrary, magical world we live in cannot even dare to touch! This realization is chilling! If the CS-electron stuff is magic, then the world of abstract ideas is straight up forbidden black arts & voodoo! I mean, it's not even affected by this world, how crazy is that!!!"

Now you're getting it! :)

1

u/satanikimplegarida Nov 12 '19

I know i "get it", but for completely different reasons to you, do you "get" that? You get why I'm unexcited by toast and Ebola?

1

u/[deleted] Nov 13 '19

I am excited by both toast and ebola.

1

u/satanikimplegarida Nov 14 '19

...we have descended into madness.

46

u/Lexilogical Nov 10 '19

I actually teach beginners this. When you start learning code, you're basically using magical incantations to make things work. You'll learn that "print("Hello World");" makes the words appear on the screen, but you don't know why. Why a semi colon? Why the quotes? Why brackets or print? You learn this later, and it just opens more questions.

But to start, it's magic. When they make a syntax error, I tell them it's the difference between "LeviOsa" and "LeviosA". Once you know what the rules are, you learn what you can change. But even without that knowledge, you can start with safe knowledge and basic spells.

14

u/sudden_potato Nov 10 '19

This is actually some great analysis I love this comment so much! Such a great way to look at it.

5

u/deelowe Nov 10 '19

I learned the other way. My university program started with basic C code then we learned about pointers really early on which then led to us building digital circuits then assembly and so on. About the time we were doing assembly, we were also getting introduced to OOP. They used C++ for everything which allowed us to do low level stuff in one class while doing high level code in another. I really enjoyed this approach a lot. They switched to java soon after I left and from I heard, they struggled a lot with that approach.

2

u/Lexilogical Nov 10 '19

I learned with C too, but even then it took years before I fully made some connections. In C, there was even more magic. "What does int main(void) mean?" "Why is there an f in printed?" "Why does a print statement sometimes fix things?" (Hint: it's the f)

Not to mention the answer to malloc and pointers was mostly "add * and . until it works"

1

u/deelowe Nov 10 '19

I recall asking those questions at first as well but once we learned about memory and it's role in computing, it was all pretty easily explained.

1

u/Lexilogical Nov 10 '19

Yeah, but to start? Sufficiently advanced science that is indistinguishable from magic. Say this spell and it works.

For the record, I also read a lot of sci to and fantasy, so magic systems with intense rules are my norm.

1

u/deelowe Nov 10 '19

Perhaps. I just thought it was more fun that way. By the time I was taking sophomore classes, we were building simple virtualized computers. Seeing it all work together in real time was fascinating to me.

1

u/Lexilogical Nov 10 '19

That does sound great!

1

u/tcpukl Nov 10 '19

Interesting. I don't think it helps personally. I don't see why it's magic just because you don't understand something. You describe it more like a black box but it's not because literally doing what it day on the tin. The computer is only following the instructions you give it.

1

u/Lexilogical Nov 10 '19

It follows the rule that any sufficiently advanced science is indistinguishable from magic.

So the fact that the computer is a black box that you don't understand the inner workings of is precisely why it's magic. Obviously, you can eventually dig into the science and it's not going to feel that advanced then, but for most people, it's beyond their understanding of how it works, hence magic.

1

u/tcpukl Nov 10 '19

Ok. You've just described the difference between religion and science now.

1

u/Lexilogical Nov 10 '19

Spirituality, not Religion. Religion has a couple more steps involved.

But you know, those who don't believe in magic will never find it.

11

u/squarlo Nov 10 '19

I can vaguely recall a quote something along the lines of "magic is just science you don't understand" and think this is relevant here.

I think it's from Thor honestly.

9

u/GenomeXIII Nov 10 '19

Any sufficiently advanced technology is indistinguishable from magic.

Arthur C. Clarke

15

u/BubblegumZebra Nov 10 '19

Yes! Especially when I write code that shouldn’t work but does.

10

u/zzsherry Nov 10 '19

Magic gone wrong.

8

u/SouthOceanJr Nov 10 '19

A lot of the magic you mentioned are more scientific in general. While CS does help accelerate advancements in science, it rather plays the supporting role. I understand you compare human achievements to magic as a compliment, but it overlooks humans blood and sweat put in to get to where we are now.

I also love coding btw, it's magical.

5

u/ALonelyPlatypus Nov 10 '19

predictive machine learning is the next best thing to divination.

2

u/darth_waiter_ Nov 10 '19

That is actually the perspective that got me into CS in the first place. I took a 2-week intensive introduction to programming in summer when I was in high school just to try something new. The course was given by this amazing Stanford professor called Chris Piech and he started the first lecture with reasons to get into CS. There was one part where he explained how "It is the closest thing to magic" and I just loved it. I thought you'd like to hear that your perspective of CS is shared by top-notch Stanford professors.

5

u/1544756405 Nov 09 '19

The computer does exactly what we tell it to do. It would be magic if it did what we actually wanted it to do.

3

u/Qvoovle Nov 10 '19

I became somewhat disenfranchised with the world as I grew older

https://www.merriam-webster.com/dictionary/disenfranchised

I think the word you are looking for is "disenchanted".

3

u/chemconsumptionPHD Nov 10 '19

I agree 💯 with you I'm a self taught coder/hacker bad mentioned the bad....which also scares the hell out of me.... Besides all the bad u mentioned psychopaths can do from a laptop at Starbucks one power outage and we're back to the stone ages ... sustainable power is the only absolute answer to our advancement

2

u/[deleted] Nov 10 '19

Its math.

1

u/ALonelyPlatypus Nov 10 '19

applied math.

0

u/[deleted] Nov 10 '19

[deleted]

2

u/plappl Nov 10 '19

It's exactly true. All programming can be expressed in terms of lambda calculus.

0

u/[deleted] Nov 10 '19

[deleted]

1

u/plappl Nov 10 '19

That's impossible. You are required to implement the for loop construct in terms of recursion.

https://risingentropy.com/for-loops-and-bounded-quantifiers-in-lambda-calculus/

0

u/[deleted] Nov 15 '19

[deleted]

1

u/plappl Nov 15 '19

You should take a few graduate courses in Computer Science before making ignorant comments.

What did you mean by this? 🤔🤔🤔

0

u/[deleted] Nov 15 '19

[deleted]

1

u/plappl Nov 15 '19

Read the thread.

What did you mean by this? 🤔🤔🤔

0

u/[deleted] Nov 16 '19

[deleted]

→ More replies (0)

1

u/Asalanlir Nov 11 '19

To add to this, my current thesis work is in analyzing brainwaves using an eeg system to use as input to a physical device. In essence, it's telekinesis.

Im literally building the superpower kid-me always wanted.

1

u/skinnyblkbstrd Apr 23 '26

I wonder how you feel now with AI. it’s like humans just got a power up in magical abilities

1

u/plappl Nov 10 '19

0

u/[deleted] Nov 10 '19

[deleted]

2

u/plappl Nov 10 '19 edited Nov 10 '19

I was referencing the very famous MIT course, 6.001 The Structure and Interpretation of Computer Programs (SICP). In this course, the lecturers explicitly state that computer programming is actually magic; the people who write the programs are magicians who "conjure the spirits of the computer with their spells". This idea that code is magic is at least 34 years old when SICP was first published in 1985. The age of this news is what I was referring to.