YTread Logo
YTread Logo

The Art of Code - Dylan Beattie

May 01, 2020
good afternoon NDC, thank you, you have had a good few days. It's been fantastic and they asked me to come and close the conference for some of you, those who were wise enough to be here because there are some strong ones. competition in this place by talking to you about something I call the art of

code

. Does anyone recognize the language in which this little intro sequence is written? logo this is not just this logo this is the original Amstrad logo from 1985 because the first The computer I ever had was this one, the Amstrad six, one, two, eight, it was garbage.
the art of code   dylan beattie
I mean, it was brilliant because I'd never had a computer before, but I had the games I had, all with this kind of green screen and they weren't. very fun compared to arcade games and all that, and you couldn't do much with it, no modem, no dial-up, no BBS, bulletin boards or Internet, but what it did have was this language of logo programming and that logo got me. I got hooked because by using the logo I could make the computer draw pictures and that was a big deal in 1985 because I had never seen that I could put things on that screen using a logo that maybe no one had ever seen on any screen before and I got hooked. and I got this lovely kind of feedback loop where I liked it because I could make the computer do what I wanted and every time I did it I would feel this little thrill and this rush and I would come back and try again and, you know, along the way.
the art of code   dylan beattie

More Interesting Facts About,

the art of code dylan beattie...

Throughout my entire career developing software and designing systems, that excitement for me has never gone away and I hope all of you are here too, you know you have good days and bad days, but you still do it. hurry up when you know all your tests are green or when you know you've turned on monitoring and it's at a hundred percent or something it just works and you think I made that work and over the last three days here at NDC London I've had people incredibly brilliant people who have told us how to solve important and useful problems how to design scalable service deployment strategies information security the ethics of artificial intelligence and machine learning I'm not going to talk to you about anything useful because I'm going to talk to you about art and all art is quite useless, says Oscar Wilde now.
the art of code   dylan beattie
I don't entirely agree with this quote. I like this quote much more. The function of art is to hold a mirror up to nature and if we want to use art as a tool to explore and understand the world around us, we can hold a mirror up to it, but before we can do that we need to invent the mirror and that is where they come in. science, technology and engineering are at stake, because for centuries humans have built machines and tools to help us explore and understand the world around us. We have created scanning electron microscopes that have allowed us to see things like this.
the art of code   dylan beattie
These are fragments in the eyelid of a beetle. It's been there the whole time and no one had seen it until we did. We invented machines that could take photographs of something that is only a handful of micrometers wide. These are crystals that grow in a dish of soy sauce. These are the stems inside a strand of a banana leaf. This amazing, beautiful microscopic world that we've never seen before and we've sent machines and cameras and telescopes and people into space and we've looked back, we've seen, you know, our planet Earth rising above the moon. We have looked back from beyond the rings of Saturn, this is us down here, these are the pillars of creation this is six thousand light years away in the Horsehead Nebula and until we invent machines to show us these things no one had seen it and in the last thirty years we may have begun to explore another hidden world that has been there all along until we developed the machines that allowed us to enter it, see it and play with it.
It is a world of mathematics and information. During the 1970s, there was a guy named Martin Gardner who wrote a column for Scientific American magazine about mathematical puzzles and trivia, and certainly the most influential of his columns that he ever published was this one from October 1970, where he described something called The Conway's Game of Life, created by an English mathematician named John Conway. Now, the way games work, Conway's Game of Life doesn't seem terribly exciting, it's a nobody's game. The players played on an infinite board and it has four rules, the rules of life, the first rule, each of these cells in our grid can be alive or dead if a cell has zero or one neighbors, it will die of loneliness if a cell has two or three neighbors it survives another generation if a cell has four or more neighbors it's like being in London it dies of overcrowding or it moves to Germany I don't know but it's gone and finally and this is where it gets a little creepily strange , if a dead cell has exactly three neighbors it will come back to life and that's it, now you understand everything there is to understand about the rules of Conway's Game of Life now that Martin Gardner's article was first published in 1970 , very, very few. people had computers and they used pens and graph paper to play the game of life and they drew diagrams like this.
Now these five forms of what we call tetrominoes. There are five Tetris tiles and this shows you the evolution of each of those shapes. under the rules of Conway's Game of Life, but you know that looking at this is like going to a new museum where they have butterflies nailed to a glass case, you can see what the butterfly looks like, but you don't understand anything about a butterfly by looking at it. This type of representation wasn't until we started using computers to simulate this that we really understood the behavior that we were observing because these four patterns stabilized quickly, but this one right here will continue over and over again. and once we were able to visualize things like this, exploring the game of life became addictive, people started saying, you know, there are packets that will move through the network and they will just follow, there are limits, the game is limited or It's infinite, this was one of the first forms, this is known as a glider, it repeats every six generations and keeps crawling around the web forever and once we realized that the Bladers were the Possible people we started looking for more and they found hundreds of these shapes, spaceships, they call them incredibly elaborate and beautiful. creations that simply slide across this grid driven by four simple rules and that is one of the first questions that arose in the game of life: can you create patterns that will grow infinitely? is a guy named Bill Cosby was a founding artificial intelligence and computer researcher Some of you may have heard of a scientist and his team at MIT in the 1970s, they created something absolutely wonderful, they created a thing called a glider gun gospel, now what the glider gun is is a stable configuration and every 27 generations it creates a glider and since then these gliders flowing through the network and gossip discovered another, you know, many configurations while they were exploring this, they also discovered this thing here it was called Villita, now we have a glider generator and we have a glider consumer, we can generate signals and we can destroy signals, we have one and we have zero and if we have one and 0 we have binary logic and we can use that to create logic gates, so this here is a NAND gate built in the game of life, these little highlighted cells are our enter now what we're going to do first of all we're going to start the circuit running and then we're going to say ok, we're going to remove that blocker so that our input a becomes true, there we go a is now on we have no output signal, we only have one input, let's invert the inputs.
What happens if we activate B? It will be like on, but we still have no output signal because this is a NAND gate to get an output signal here. We need to enable a and we turn on both inputs, we turn on our circuit and voila, we have a NAND gate. Now the brilliant thing about this is that if you have logic gates you can make circuits and if you can make circuits. you can create computers and if you can create computers you can run programs, including this program that you may have heard about a while ago, it's something called The Game of Life by John Conway and now it's something like The Game of Life of Conway. just one of a whole category of systems that exhibit very, very complex behavior based on what seemed like very, very simple rules, simple inputs, you've probably heard of this thing called the butterfly effect, it's a term we get from a branch of science called chaos theory. the idea that weather prediction is impossible because if a butterfly flaps its wings, that input will change the output and there will be hurricanes instead of sunshine in Tokyo two weeks later or so, and for the last few decades, mathematicians around the world world have begun to study systems. in a different way for a long time mathematics was only interested in problems that you could solve give us the solution if you can't give us the solution this problem is not interesting we will just go and find something else to look at, but mathematicians I kind of embraced all of this in a different school a different way of thinking we create imaginary numbers now the basic rule of an imaginary number we have this number I and in the natural world negative numbers do not have a square root 2 times 2 is 4 minus 2 times negative 2 is also 4 so How do you get what multiplied by what equals negative 4?
Well, nothing, it doesn't exist and there is no problem for mathematicians, we will simply invent something, we will invent it. It's an imaginary number and I raised it. is equal to minus 1 and they just this is where the rest of the world goes, you can't do that and the mathematicians go, we can do whatever we want, it's imaginary, we don't care, but once they've developed this and created a rigorous set of mathematics around it, you can do some really interesting things with it now, this thing here zero point eight plus one point two. I wait a second, give me a second, there are a lot of gonnna slides. stare and this doesn't make much sense that still no evil will get we have we have a slide missing right now this number here there is no point eight plus one point two I this is what is called a complex number a complex number is like a plan project has a real part and an imaginary part and it is very difficult to predict what is going to happen next once these things get involved, now there is a complete study of systems and the behavior of systems that we can talk about this here it is called Argand diagram and the blue bit is imaginary the red bit is real so no the point eight there in a point two I plot it there and this way we can plot numbers in complex mathematics in this type of space and we can do arithmetic with these numbers just like you did in high school, so we took point eight plus one point two.
You just expand the numbers as you go and multiply and everything you need. What you need to do is remember that anywhere you have two blue numbers multiplied, the result is going to be negative, it's going to come out backwards, so this one dot two times one dot two you're going to square them and then you're going to put a minus sign at the beginning and take negative complex inputs and you get complex numbers on the other end. Now what's really interesting is that when you start studying the behavior of systems driven by these, let's take a really simple function and we'll take a real number 1, so one, two, three, four, and you can intuitively see how this system will behave.
You can't be sure you understand his behavior until the end. to infinity, let's try another one, so if we take this example x is equal to 2 minus What we're going to do is keep taking that number and squaring it the first time we square it it goes to here we square it again it goes to here we square it again it ends here and then here and then it disappears to infinity. we'll move slightly and run the same sequence again this time, point six and it goes to here and here and here and here, but this time it doesn't escape, it goes into this weird little kind of thing. almost circular orbit pattern now those two points are next to each other but they exhibit dramatically different behavior when we iterate them over and over again by squaring them and squaring them and squaring them and eventually this one disappears now the first really rigorous study of these This guy of systems was created by a Polish mathematician named Benoit Mandelbrot and Mandelbrot was fascinated by real-life mathematics.
He had this quote. Clouds are not spheres. Mountains are not cones. The coasts are not circles. A crust is not smooth. It's not like lightning. Now Mandelbrot had a brilliant job, he taught mathematics at Harvard and when he got bored he would go to IBM and play with computers because this is the 1970s, when IBMHe had computers and no one else had them, so he invented these, you know? wonderfully complex mathematical ideas and then he would go to IBM and spend a couple of months playing around and simulating them and then he would come back to Harvard and you know, talk to his graduate students about all this kind of stuff and there was the first person who saw the shape that now It's named after him, it was called Mandelbrot, but everyone calls it the Mandelbrot set and I know I'm going to do that, so let's call it the Mandelbrot set, basically, he took each of these numbers in this grid and said, let's square this and add it up. to itself and the square and add it to itself and we will see if it stays on the grid or not and if it stays on the grid we will color it black and if it disappears and fades from the grid we will color it a different color depending on what so quickly it tends towards infinity, it started with these very, very low resolution interpretations of this image, but the one that you're probably used to that we've all seen is this one that Mandelbrot created.
Now the amazing thing about this is that from this incredibly simple mathematical rule there is an infinite amount of complexity. We're going to take a Mandelbrot set here and we're going to start zooming in and we're going to start zooming in and when we get here we're going to say it's a 1x magnification and we're going to keep zooming and zooming and zooming and by the time we get here, that original shape is now the size of this building and we're still zooming when we get to about here, which is 2 to the 21 Amana , the original shape is now larger than London. and we are still getting closer and around now the original shape is bigger than the United Kingdom and we are still getting closer and we are still getting closer and we can continue to get closer to the shape forever it never repeats it is what is called self-similar which means it looks like itself at different scales but it never repeats exactly there is an infinite amount of detail buried within this shape and it has been there all along no one invented this we discovered it now this the Mandelbrot set some people have called it God's fingerprint now I'm not a very spiritual person, but I play a lot of computer games and I love that thing in a computer game where you're doing something silly that maybe isn't part of the main campaign and you find that the game designers left something in there to persuade you. that you were supposed to be here and that you are on the right path and this thing has been hidden in mathematics since you know our universe was created and no one saw it until we humans invented computers, which means taking a lightning bolt and nail it to a rock until it learns to think and we invented advanced mathematics, we invented high-definition color displays and rendering technologies, all these kinds of things and this is what we found, something that was hidden there all along. time that no one had seen until we built the machines and technology that allowed us to view it now in these times simply putting images on a computer screen is no longer such a big deal this was Tron, which was a movie made by Disney in 1982 , the first film to have completely computer-generated sequences, Tron did not win the Academy Award for best visual effects.
She was disqualified because using a computer to make a movie was cheating. According to the Academy of Motion Picture Arts and Sciences, they eventually changed their minds. And they gave him a lifetime award, but we're very good at using computers to simulate things. Luxo Jr. was the first completely computer-generated movie 1985 Jurassic Park 1994 the first time we had computer-generated characters on screen with human actors and it looked convincing, you know, it looked convincing, it became part of the story a couple of ago years we had this guy on our movie screens they don't know who he is because there's a group of people who say he's Peter Cushing and he's my grandfather and he's dead and you shouldn't have done that and there's another group of people who say which is grand moff tarkin copyright Lucasfilm Entertainment 1978 we own it, you know and you know who it is, is it the actor or the fictional character, has sparked this really interesting left-wing ethical and legal debate, but the point is that we can put I saw a review of the last Jedi, the last door that says we now have living actors playing dead characters and dead actors playing living characters.
The circle has come full circle thanks to computer technology and we are at the point where we can do anything. You can turn to your computer and you know what I am. Boring, what would it have been like if they had become friends with Nicolas Cage playing all the roles and we could do it now? The reason we can do things like this is because we have created computers and algorithms that work on the same principle. As one of the most complicated firmware of our brain, you ever stand on your back in a field on a sunny day and you are looking at the clouds and your brain is filling in shapes for you, its cloud looks like a rabbit that looks like an airplane that each time it looks like a house and you're running all these pattern recognition algorithms and filling in shapes and recognizing things and one of the things we're programmed to do is recognize faces now that we have very, very Well, we don't fully understand how they work, but now we can create something called a convolutional neural network, you build a whole stack of layers of logic and you give it information, you say these are cats and these are dogs, you learn and it goes away and it learns and learns and learns and finally it creates an algorithm that you can Give him a photo and he will say with confidence that it is a cat or a dog.
Now you know that doesn't sound terribly difficult, right? I mean, how hard can it be? You know it can be a lot harder than you think, but we're getting good at this, but what gets really interesting is when people take the dog detection algorithm, the dog detector, and plug it in. backwards and they say now it's a dog amplifier and the machine works fine and then you give it a picture like this and you say amplify dogs and the computer says this is a horrible idea please, please don't make me to me and to you. let's say neural network finds the dogs and improves the dogs and says: you will regret this and you cannot increase the maximum amplification power of the dog and you will get things like this, this is a completely new type of art that has become possible thanks a Machine learning that no one had thought of before and the technique used to do this is something called deep sleep came out of a project at Google in 2015.
It's really disturbing, isn't it? Because you're looking at it and what's happening is those same circuits in your brain that we've learned to emulate in hardware those circuits work dog no, it's not a dog dog no, it's not a dog dog and your peripheral vision is finding patterns that you recognize. , but then when you look at them it turns out that they have deceived you and then you get a very, very complex perception about what is happening now. This is just one of the many ways people are using modern technology and software as artists to create new types. of art I want to introduce you now to a guy called Robert Felker that I met in Warsaw the other week and he is doing really very interesting things.
When I start a new work of art, it is simply an inspiration, you have a feeling between the first identification and the final assistant there is the same feeling it is not about the visual I am not interested in what you see. I'm interested in what you feel. I'm Robert, my day job. I'm a Flutter developer and project manager. Also photographers were previously not blocked by the tool. I can do a lot of things, but only what the tool allows me to do, when I found flutter, it opened the door inside of me, now I can really push generative art further, it's a lot. from research like many it is a big failure it is a big failure finding the color finding the way understanding the good behavior of light what is really good with flutter is the speed of the feedback it is almost instantaneous currently artists do not understand the full potential of the tool when you start more you start with Material Design or you start with the iOS component and you think this is flat but this is just the tip of the iceberg now if you want to push then you start to get into the photo engine and the engine photography is like the juice of the cone every time I start cutting I feel joy then some people are painting and others are cooking I just flutter and photograph and this is an example of one of Roberts' works this is a photograph of him taking Tokyo for the night and then used machine learning to do depth perception analysis to identify from the photograph the depths of all the elements in this and then used software and tools to creatively reconstruct the photograph working in layers and I think this is quite beautiful, it's kind of hypnotic and every time you look at it it reveals something new and this is just one of the hundreds of ways artists use

code

to create new types of artwork that we've never seen before, but what if we stopped talk? using code to create art and we started talking about code as an art form in itself right now, this very famous book, one of the great volume textbooks or set of textbooks on computer science, The Art of Computer Programming by Donald Knuth and we can debate For a long time, programming is an art, it's science, it's engineering, it's writing, do you know that now, but I'm sure many of you have reviewed code that came from somewhere, maybe someone on your team was tired or out of that depth? with that or maybe you were just having a bad day and you look back on it a few days later and say: I don't know what this is, it's not engineering, it's not art.
I don't think it's terribly creative. I would do it. I don't dignify it by calling it hacking. I have no idea what this is, but fortunately there is now a safe space for this type of code and these types of programs, and it is the International Obfuscated Speedboat Competition, whose goals are to write the most obscure C code. program to show the importance of programming style in a tongue-in-cheek way to emphasize compilers with unusual code to illustrate some of the subtleties of the C language and to provide a safe forum for C port code. I would just like to share some examples with y'all so this was a black I think Jonathan Mills contributed this this is the full source code for this program very C programs here in the room today you want to tell me what this does and it's just code there's only one screen how hard can it be , come on just run it and find out because you know why not, we'll just run it to create a file and then we'll run it and there's Flappy Bird running in a terminal.
Here's another one. Lynnium zooms out and gives you some context, so this code actually generates and draws the Mandelbrot set in a text window and does so in a relatively compact code base that has the form of what it represents, which I think is pretty good now that brevity is one of the goals of obfuscated code. If you want to do something really amazing with a very small amount of code, this is the complete source code for a program by a guy called Oscar Pulido. Wow, if you copy and paste this into your web browser, play chess, not draw a chess board play chess is a chess algorithm implemented in just under a kilobyte that includes JavaScript HTML graphics behavioral logic engines all the rules of the chess and an engine that's actually better at chess than me this thing beat me at games it's a lot of JavaScript now There are some amazing examples of programs that do wonderful things with very small amounts of code, but none of them are as good as this one .
This was submitted to the international obfuscation contest by Simona syncovich in 2005 and was accompanied by documentation saying if you compile this using this compiler it will print its own source code, there is nothing here, this is an empty file, but that compiler had the quirk that if you gave it empty input it would create a C program and compile it without producing results, so he quite rightly said that this program prints its own source code, now the obfuscated C competition, when ok, a very clever one to have a price three, we are changing the rules from now on, all programs must have at least one input character, otherwise they are just this.
The program was completed again, but this idea of ​​a program that prints its own source code is something called silence, the word comes from this book that some of you may have read, which is kind of a fascinating riff on mathematics, recursion, fractals , poetry and music and stuff and it turns out that writing a program that prints its own source code is surprisingly difficult now that you can't just read it from the disk and print it, that would be cheating, you have to generate the source from within itself, so come on let's write one. I don't write a coin for you now using c sharp, like thisthat we need a class program with a static empty main method and then obviously we need to write the line of the class program and close the square bracket and we need to write the line. the main static void and now we need to write the line the right line and then we need to write the line the bright line with and very quickly you get tangled in oh, this is just some kind of strings e all the way down, but every language comes out has peculiar loopholes which we can exploit to make it do things it wasn't supposed to do now in c-sharp there is a feature called string template so we can define a string that looks like this and we can put placeholders in it These little things here say that when you see an argument, put it into the string at this point and then we're going to feed this string back into itself as a placeholder variable so that when it gets to that bit it's printed and it doesn't go into an infinite loop which does is print itself, it prints its own source code and different languages ​​have different loopholes that you can exploit to make coins.
JavaScript coins are very easy because every function in JavaScript has two strings that print them, so this javascript works in JavaScript and ACMA script six. This is a coin and I didn't believe it because it doesn't look like anything, so I ran it in a console and sure enough, that's the output that comes out when you run it, but what it really is. interesting this is an idea i picked up from a guy called Leon BAM Brick who wrote a great post about this: can you make a currency in HTML now? HTML as you already know.
Is it a real programming language? I'm not going to touch on that argument. Can you write a coin on it? Well, let's find out. Here's a simple HTML source code, title, header, body, a couple of paragraphs and a link to Leon's original article about this and this is what it looks like in a browser. Start breaking some rules, so first let's put some style on it that says. show everything as a block, even things that are supposed to be invisible, this star will match anything we run in a browser and now we can see our CSS, our source code is coming to that browser.
Now let's set some rules. Let's say well before HTML, we want it to show this and then it showed it, now the HTML bar is actually down here at the bottom of the screen because it knows it has to draw it, but we haven't told it where to put anything and the security is disabled at this point we have no idea no the browser is like you're on your own kids have fun we added a bunch more rules here we have to put a backslash to escape the slash because the web browser actually is running. three different passes: it's pausing HTML, it's pausing CSS and it's pausing JavaScript and they're all fighting over who eats the next input and at this point, if we put forward slash style, our CSS parser will work, yeah, I'm done. and HTML is going to choke on the rest of this snippet here, so we need to escape it now that we have before and after tags, now there's no way to generate them, we just need to go and plug in the title anchor paragraph of the header body and we get this.
Now you'll notice that down here we have this but we don't have the href equal to the web address that we want to link to. Can we do it using HTML and CSS? Oh yeah, no problem if you see a with a href we want you to take this attribute and put it in some content and paste it before the thing and there you have it and the last thing we're going to do to make it look good is we're going to put a check there and change the height of the age and there we go, we have a web page that actually prints its own font, which is completely useless and absolutely useless, but how many of you learned something you didn't know about ages?
Here is our parser. when you were looking at that little review, look a little more here is a source code that wants to tell me what language this code is written in yes yes yes any other upvotes yes well, let's apply a C preprocessor. We will take the comments include the standard leading character of IOH. I mean the formatting on this is a little wonky, but yeah, okay, it's completely valid C code, but what happens if we apply Ruby syntax highlighting and highlight the strings because that's what it seems to me? like perfectly valid Ruby code, we're going to try to run it and see what happens, so I'm going to take that Poly Coin program, see that there it is, and now I'm going to put that program into the GCC compiler and run it.
I got a warning, but we're past the point where we care about warnings and here we go, that program prints its own source code and now why not? Let's run the same through the Ruby interpreter and see. And now print your own source code. Now let's run it in Python because we can and it prints its own source code. Now, for a penny, run it in Perl and let's see what we get. Print yours. source code again and apparently it will also do it in C++ if you can find an old enough compiler. This is a poly coin.
This is a program that is valid in more than one language at the same time and in this example it always prints its own source code now, who would like to tell me in which language this program is written? Well, let's break it down nicely, let's do some syntax highlighting so we have the system dot console, which is something like dotnet II, and then We have this snippet here, which is an XML namespace, we have a dot record. console for each in lower case so it smells like JavaScript to me T, we have an ADA text procedure that we start in upper case that is COBOL or SQL, it is definitely from the 1970s and it lives in a bank and up here we have the act 1, scene 1, enter Ajax, which is unlike any show you've ever seen.
This is an excerpt from something called the or Robert Quine is a Ruby program that creates a Rust program and the Rust program creates an academic program and the Scala program creates an outline program that said Shakespeare all the way around 128 languages ​​until you end up with a RC program that creates a Rex program that creates the original Rust program again. It was written by a Japanese developer named Yosuke, and while one of the contributors to the core Ruby language and the fact that it exists is surprising, this is the source code for that currency. It looks like it's awesome too and if you zoom to the end of the source code you'll notice that the last four lines just say buffer for future bug fixes because they don't want to mess up the shape of the source.
Now I know this is the most amazing thing about this: all 128 of those languages ​​can be installed in a win on Linux by going to apt-get recs apt-get Shakespeare apt-get TC, so there is a continuous compilation process of github actions for this. every time changes are committed, it runs them in all 128 languages ​​and tells you if it was successful or not, which I think is fantastic and you know, it's weird, but I love the fact that we can do that, but let's back up a little bit in that part. From the code we saw there was some C and some JavaScript, but there is also act 1, scene 1 and 2, Ajax.
It is now an excerpt from a program written in Shakespeare's programming languages, one of a family of ISA Lange's so-called esoteric languages. and Shakespeare is designed to allow you to write computer programs that are also works of Shakespeare. This is Hello World on Shakespeare's infamous Hello World show. Now all the variables in Shakespeare must be declared as the characters of the play, so we have Romeo and Hamlet acting. 1 scene 1 which is a namespace and a block enter Hamlet in Romeo this is the variable scope we are dealing with right now and then the way variables work in Hamlet is when they say nice things, they increase and when They say insulting things, they diminish, so at this point Hamlet is talking to Romeo and Hamlet says that you are a liar, stupid, orphan, a big half-dumb and smelly coward, you are stupid like the difference between a brave, rich and handsome hero. and I, say what you think, who puts the letter H in Romeo and then prints it because H is the first character in hello world, the next bit here will print e and so on, hello world and Shakespeare has about three pages of pretty flowery prose , which is fine because it's Shakespeare and that's how it's supposed to look, how about this one?
Can anyone tell? What programming language is this written in is whitespace, let's take a look at that with syntax highlighting, applied whitespace is a programming language that only cares about spaces and tabs, ignores everything else, It's brilliant if you want to hide programs inside other programs. mix your tabs and spaces and you can put whitespace next to anything else, this is hello world in whitespace, let's take a look at hello world soufflé now, this is a programming language called chef and chef is designed for writing programs that are now also recipes. 72 grams of beans one hundred 1 X 108 grams of lard 111 cups of oil you know 33 potatoes is a valid program but would you like to eat this souffle?
You know, someone called a guy named Mike. Worth looked at the chef's programming language. and when I accept the challenge, I will write a hello world program that is actually a sensible recipe that you can make in your kitchen and he came up with the hello world cake with chocolate sauce. Now I think this is brilliant if you compile it on a computer. says hello world, if you make it in a kitchen you get an edible cake with a kind of chocolate sauce ganache that you can pour on top, but what I think is beautiful about this is if you didn't know about the chef.
You'd think this was just a recipe, it fits so well into two different domains of human creativity that from one you'd have no idea it also worked in the other. I'm going to show you how to square a number. a programming language called Pete that explains how to square a number in Pete Pete is named after the Dutch artist Piet Mondrian and Piet is a graphical language where the set of instructions is dictated by what happens when you cross over from one color to another , every Piet program starts with an instruction pointer at the top left traveling to the right traveling to the east, so what's really happening here is when we cross from light blue to dark green it says enter a number, prompt the user and place it on top of the stack when it reaches black rotate the instruction pointer 90 degrees when we cross from green to red that means whatever is on top of the stack is doubled when we cross from red to yellow multiply the two top numbers on the stack multiply them put the product back on the stack when we cross from yellow to red, that generates whatever is currently on top of the stack, we skip that to standard, when we cross white, that's not an operation, we reach the end of the grid, turn right again and then follow this blue. safe instruction until we end up with black on all sides, which means you have reached the end of the program, wait for it to be a completely Turing complete language whose instruction set consists of light and shadow areas and the transition between colors, This is Hello World in Piet is one of many many examples, but you could hang this on the wall of your house and someone could walk in and take a look, they would have no idea they are watching "Hello World", they will just think you like a little weird. 16-bit art, you know the Windows 3.1 school of expressionism.
So far we've talked about this whole idea of ​​you know how to use, we've talked about using code to create art, we've talked about code being art, and over the course of MDC, you've probably seen a couple of speakers here doing demos live, which are, you know, the tightrope act, the tightrope, ooh, the death-defying circus thrill of the tech industry because someone is coding something on a laptop live and it might work and It may not work and there's always this element of kind of risk and then it works and it works as if and you get a big round of applause, but in general, as an industry, we don't like that, you know, we like consistency, we like reproducibility. .
Just like automation, we like to be able to do the same thing over and over again if you've ever worked in a place where there's a server under a desk or maybe in a rack somewhere running Windows 2003 Small Business Edition and not you're allowed to touch it, don't put Windows Update on it or payroll will stop working under penalty of immediate gross dismissal, you know, and we have a name for these kinds of boxes that everyone is afraid to touch. We call it snowflakes, snowflake servers, snowflakes. The processes are completely unique, but if you go out into the snow and pull a snowflake out of a blizzard and watch it melt in your hand, you have just been part of a performance that will never, ever be repeated anywhere where your participation have created. a unique human experience that no one else will understand or be a part of and maybe we can do the same kind of things using code.
This guy is Sam Aaron and Sam is the creator of a programming languagecalled Sonic pi. Was anyone at the last talk? yesterday in this room where Laura gave her talk on programming with music and she was showing us that she had a program that wrote computer programs whose output was not text or graphics, but music, tones, sounds and melodies, and she ended up doing this this way wonderful. kind of layered because sonic pie is a live encoded music synthesizer. I'm going to give you a really quick demo of how sonic pie works which I'm not going to live code for you because I don't want this to get too meta now when you start up Sonic Pie it gives you a prompt and you say play this note and it plays that note now Sonic Pie executes all your instructions in parallel unless you tell it not to imagine if JavaScript if you want things to happen one after another, you have to do it.
We put sleeping instructions and we say we want to introduce some kind of delay into this and what gets really interesting is that we can go in and start putting loops around our notes and our musical patterns, so we have 16 times to do that and we have the least exciting bass line in the world, so let's increase the tempo a little bit, let's say use beats per minute, 240 feet, okay, we're getting somewhere and we'll change it because sine wave is not a terribly exciting noise , we're going to use a built-in synthesizer here called Tex Soares. This is interesting, but where it gets really interesting, as you may have seen in Laura's talk yesterday, is when we introduce the concept of something called a live loop.
Now live loops allow you to run multiple components of your program, so I'll put a light blue around that baseline and then place another loop on top of it. Fizzbuzz Now's sonic pie is fantastic, it's a lot of fun. to play. I've seen people do live coding with various musicians. That image at the beginning was Sam on stage with the London Philharmonic Orchestra doing live coding at the Royal Albert Hall and you know it's an absolutely amazing tool and just one of the brilliant and creative ways we can think of to use code to do fascinating and unexpected things, but I want to finish today.
I've told you about all kinds of things that other people did. I want to finish by telling you something I did now. You're probably familiar with the rock star developer trope because we've all read job ads from people looking for a rock star senior leader. end rock star JavaScript engineer rock star senior Java software developer this has been endemic in our industry for years and last year Paul Stovall put this on Twitter and said that to really confuse recruiters, someone should create a programming called rock star and I had this experience because I thought this is my purpose, that's why I was put here because what the world clearly needs is a programming language that allows you to write programs that are also bad heavy metal songs from the 80 and thus the rock star was born, a dynamic type.
Turing is a complete programming language for creating computer programs that are also song lyrics heavily influenced by the lyrical conventions of 1980s hard rock and balance sheet rock. Now Rockstar was created in a bar as a joke that will soon become important. . A bar with a laptop and a beer. and thinking, could you create a language where rock songs could be compiled into something? I used to work a lot in VB script and Perl and I've worked in Ruby, so I'm used to languages ​​that try and you know, borrow a lot of natural language elements and incorporate them into the programming syntax, so I first thought that it was okay, if you wrote songs in it, there's more than one way to do it, like Perl's attempt at language, Tony, you know, HelloWorld in rock star is saying hello world. or shout or whisper or scream all of these are syntactically valid programming requires variables and assignments now that you are probably used to in x is equal to five var my string the message now we don't need int because rock star is a dynamically typed language we go to To remove them we don't need a semicolon at the end because if JavaScript can live without them, now we can have the equal sign in the middle, how do you sing that?
And those you know, let's just put X is five, my string is hello. world the message is flutter rocks because I forgot to update that that should say NDC rocks now there is this debate going on about the case. You've had one of those hour-long discussions about the Pascal case versus the camel case versus the bad case versus the underlined case and I'm going to have Douglas Crockford, the guy who created JSON, give a talk two years ago in which said we have all these stupid arguments, what we want are variable names with spaces, well guess what you can do when you're inventing a programming language on a stick. whatever you want, Rockstar has variable names with spaces and it's not a complete game, there are three types of variables, simple variables work like they do in JavaScript and Ruby.
Common variables have to start with e, you are the a and proper variables need capital letters so we can write programs about dr. Feelgood and Black Betty and Billy Gene and all these great characters that inhabit the world of rock and roll now initializing variables that we normally do with numbers fizz is three buzzes five the limit is 100 I didn't want to do this because it doesn't really sound terribly tinny and I thought how can you define a numeric literal without having to use digits in the source code and I had this idea: what if we take the word lengths modulo 10 and treat them as digits so that the ice is 3/5 the limit is a Ladykiller in love one that is 10 10 modulo 10 is zero zero we have three we have five we have 100 without having to put digits in our source code it works with floating point numbers too and C decimal PI 3.14159 and JavaScript var pi is equal to you almost have something similar to that because hey javascript right in rock star my heart was frozen an unfulfilled life wake up everyone drinking alcohol and pills 3.14159265 3/5 easy, right, you have to do arithmetic right now, we have these common ways, you know, of speaking, fails, how much is it?
The total is the price with the tax, well what about the net Anana, that is the total without the tax? How many you need? Give me the quantity of the product. How fast were you going? Well, speed is distance over time. You know we have these things. It's easy, but this mathematical convention also allows us to write a girl with a dream, a man without one. Facing the wings of the night and a whisper over the water we need comparison Your love is a lie, true or false, well, isn't whiskey the answer? My heart is stronger than steel and my soul is weaker than water, as strong as a lion as short as a snake, we would have the syntax of each function, now the kind of simplistic version here, let's have a function module, you need a number and a divisor so those are input arguments and as long as a number is as high as a divisor put a number without a divisor into a number and it returns a number this is how you implement the module when your blocks construction is just addition and subtraction and loops and stuff.
Now this works, but we can do it better because Midnite takes your heart and your soul and while your heart. it's as high as your soul you put your heart without your soul in your heart and you give your heart back now at this point I'm about three beers away I have a parody spec that is complete enough to implement fizzbuzz and I have fizzbuzz on Rockstar I posted this on github and I said, Hey everyone, we're introducing Rockstar's proposal for a Turing-complete programming language and I think this is going to be fun for about three hours, you know, you get 2,000 github stars overnight, you hit the forehead. hakkon news page and just start this rumor, it appeared in a Boing Boing magazine.
Cory Doctorow wrote something about it there, it was on the front page of people on Reddit and on Reddit, we're actually saying glowing things about it, the strangest thing. What happened is I got an email from a classic rock magazine, which is a real music magazine that has nothing to do with computers, saying what's this Rockstar thing we keep hearing about, so I wrote a little thing for an email interview for them and I'm thinking this can't get any weirder and then people start raising issues against my parody specs and I'm looking at these and you know some of them are just ideas like how dumb are they? the numbers that go up to 11 and me.
I don't know that arithmetic is hard enough as it is, but some of it has this undefined behavior and I ask: what do you mean there is undefined behavior? Why do you care? And they're like I built a rock star compiler in Scala over the weekend and it has edge cases like you did and in about a week there was a Scala interpreter so I would have built a compiler for Rust, someone had built a rock star transpiler for Python and how fascinating they all are. I had managed to do like 95% based on these random things that I came up with in a bar as a joke and some of them don't make sense and you know, if I had known it was ever going to be real, I would have done it.
Of course, I've done it differently, but programming is like that, you know, I really liked the idea of ​​Dylan Beattie, the creator of Rock Star, and I didn't think I'd worked hard enough at this point to really earn that and I also wanted rock. The star is, you know, a scholar, Rustin and Python are great, but I want it to be something accessible, something that anyone can open in a web browser and type in some Rockstar code and see what it did, so around this time the Last year I basically spent about five weekends teaching myself how to build compilers and parsers and a metacircular x' evaluator and stuff, and I built a rock star javascript interpreter, which is definitely the stupidest, dumbest thing I've ever done. done in my life and it's online and it's Here's the code with the calm of a rock star and everyone here in this room is welcome to go and try this.
Put some code in there and then you'll be a rock star developer. Now I just want to shout out one thing: the logo here on the top left I wanted to borrow some real, over-the-top rock and roll influences from 80s heavy metal and I looked at Dudas Priest and Iron Maiden and Motley Crue and all this kind of people and then someone said: Have you thought about the Microsoft consumer? products from 1980 to 1982 and I thought that's exactly what I want, the type of logo is perfect, so thank you Microsoft for allowing me to recycle their old logo, let it be green.
Now I have some Rockstar Certified Developer stickers to give away here at NBC, so come on over. then with your code with the Rockstar communication code on your phone and I will certify that you will become a member of the most prestigious developer program in the world, but to finish today's talk I would like your help with something. Now I showed you some examples. from hello world and Pete that looks like a painting and chef's chocolate cake hello world that could just be a cake and if you like the test of whether Rockstar really succeeds as a language is whether you can make a rock star show and have People just think it's a bad heavy metal song from the 1980s, so, with your indulgence, I'd like to shut down NBC and this talk performing fizzbuzz live on a rock star takes his heart and soul while his heart It's as high as you put it. your heart without your soul in your give your heart back you remember the fizzbuzz riff thank you so much in DC thank you for coming thank you for your time thank you for listening who's going to the pub gun if you thought it was stupid we have a lot more stuff in the store if you don't what do you do if you come to the pub gun I'll be the emcee tonight we have 12 amazing speakers lined up with fun five minute talks there are still tickets on sale if anyone doesn't have plans for tonight Pupkin oh If you don't come to PubCon thank you very much I'll see you at somewhere along the way have a wonderful weekend see you soon goodbye

If you have any copyright issue, please Contact