Hello, Flutter Europe. How are you doing?
So, yes, I've come here today to talk to you about the art of code. Now, the first computer
that I ever had was one of these. This was an Amstrad 6128 and it was lame.
It didn't have a joystick, it didn't have any good games or anything, but I was kind of obsessed with it.
I was seven years old when I first started playing with this.
And the reason why I got obsessed with it was it had something on it called logo.
And logo is what I wrote that little intro sequence therein on an emulator in old 1980s logo code
because logo meant I could make the computer draw pictures.
And then I switched it off and they disappear, but I knew it was there.
And I loved that. I got this thrill out of making this computer do things on screen
that maybe nobody had ever done before. And that kind of thrill of making the computer do something interesting.
For me and I hope for lots of you here has never gone away. I still get that when I'm coding
and prototyping and building things.
And we've had some amazing talks here over the last two days about computer programming
for things that are important, things that are useful, solving real problems,
design systems, domain driven design, website engineering.
But I'm not going to talk to you about anything useful. I'm going to talk to you about art.
And there's a famous quote from Oscar Wilde, all art is quite useless.
But it's the keynote and there's no other talk, so you're going to have to sit here and learn about useless stuff.
But maybe art isn't useless after all.
There is another quote that I like. Douglas Adams said, the function of art is to hold a mirror up to nature.
Art can help us understand each other, our society, the world we live in.
And if we want to hold a mirror up to nature, first of all, we have to invent the mirror.
And that is where science and technology come in.
Because for hundreds of years, we've used machines to see things in the world around us that nobody had seen before.
We invented microscopes that have revealed this hidden world right underneath our noses.
Showed us things like this. This is the eyelid of a beetle under a scanning electron microscope.
This is crystals growing in a dish of soy sauce. This is the spiral stems inside one fiber of a banana leaf.
Beautiful, beautiful things that nobody had ever seen until we built the machines that allowed us to see them.
And we've sent rockets and satellites and telescopes into space.
And we've seen views of Earth no one ever saw before. We've looked back from beyond Saturn.
We've seen our little pale blue dot there in the corner.
This is a thing called the pillars of creation at 6,000 light years away.
And we've built machines that can take photographs of it and show us what this looks like.
And we've also started to discover another hidden world, a world of mathematics and information that we can explore using software and modern computers.
A guy called Martin Gardner wrote a monthly column for Scientific American magazine where he talked about mathematics and puzzles and logic.
And in this edition, October 1970, he described something called John Conway's Game of Life.
Now, the Game of Life is it doesn't look like a very exciting game.
It's a game that's played on an infinite grid with no players and it has four rules.
The rules of life. Each of these little grid cells can be living or dead.
And the rules are, if a cell has zero or one neighbors, it'll die of loneliness.
If a cell has two or three neighbors, it will survive.
If a cell has four neighbors, it'll die of overcrowding.
And this is the spooky part. If a cell has exactly three neighbors, it'll come back to life.
That's it. Those four rules are the whole of Conway's Game of Life.
And when this was first published in 1970, people used to figure out what these rules meant using graph paper.
And they would draw graphs on bits of squared paper and try and figure it out.
And this can give you sort of some insight and understanding into how these systems behave.
But it doesn't really show you what's going on with them.
If we take these five basic shapes, the five tetraminos, sketched out on paper here, it's like looking at butterflies in a museum.
You know, pinned up in a glass case, you can see what they look like.
But you don't really understand how they behave.
In the 1970s, people started using computers to simulate the Game of Life.
And they found some really cool stuff. These are the five tetraminos.
And this is how they evolve.
Four of them settled down really quickly.
But one of them goes into this infinitely repeating pattern of these little crisscross shapes that we call traffic lights.
One of the earliest questions with the Game of Life is, is the grid bounded or is it infinite?
In about 1973, a team working with a guy called Bill Gosper discovered this shape, which they called the Blader.
And the Blader just glides across the infinite grid, repeating itself every five generations.
Now, one of the other questions they had is, is the Game of Life bounded or will you get shapes that grow infinitely?
And then they discovered all of these. These are all Blader configurations coming from those same four simple rules.
These are called spaceships. And there are hundreds of these as weird and wonderful as anything.
You'll see on, you know, TV or Star Trek or Babylon 5.
But then they started discovering some really cool stuff.
This is a configuration. You've seen the Glider already.
But Bill Gosper's team discovered something called the Glider Gun.
This is a stable configuration. And every 27 generations, it creates another glider and sends them streaming across this grid.
We now have a signal generator in the Game of Life based on those four rules.
They discovered another pattern. This thing is called the Eta. It consumes gliders.
And now we have a way to create a signal and a way to destroy a signal.
We have one and zero. We have true and false. And we can build logic gates.
This is an AND gate implemented in Conway's Game of Life.
So here are our inputs, A and B, and this is our output, A and B.
Now if we take this blocker out of the way so that input A becomes true and we run our circuit, nothing.
The output is still false. If we switch it around so that B becomes true and we run our circuit again, nothing.
The output is still false. If we enable both of those inputs A and B and we run the circuit, we get true on the output.
We get a signal coming through.
Now this is incredibly exciting because if we can build logic gates, we can build circuits.
And if we can build circuits, we can build computers.
And if we can build computers, we can run programs.
Like this one, it's a program called Conway's Game of Life that you might have heard about recently.
For simple rules, for rules, one infinite grid.
Now Conway's Game of Life is one of a whole category of systems that exhibit really complex behavior, starting from very, very simple sets of mathematical rules.
The name they have for this, this kind of really complex output from simple inputs, is sometimes called the butterfly effect.
And one of the great examples of these kinds of systems is an area of mathematics called fractal geometry.
The pioneer in this, there was work done in the early 19th century by two mathematicians in France, Péfáto and Gaston Julia.
But because they were doing it on graph paper, they never really understood what they had discovered.
But we didn't know that until this guy came along.
Didn't know I'm Mandelbrot.
He's a Polish mathematician, he lived in Paris, he did most of his work in the US.
And he was obsessed with using mathematics to try and understand the world around him.
He had this very famous quote, clouds are not spheres, mountains are not cones, coastlines are not circles.
Bark is not smooth, nor does lightning travel in a straight line.
And using his mathematical insight, he had a brilliant job.
What mathematics at Harvard, and when he got bored, he'd go and hang out to IBM and play on the computers.
And then he'd take those ideas back to Harvard and he'd teach mathematics.
And using those early IBM computers, he became the first person ever to see the shape that now bears his name.
His name was Mandelbrot, but everyone calls this the Mandelbrot set.
So the Mandelbrot set.
Now, this was the first visualization of this shape.
This shape comes from one single equation, just crunched again and again and again.
These days we have high definition color displays when we draw the Mandelbrot set.
It looks more like this.
You've probably seen this shape.
But the astonishing thing about this is from that one equation, there is an infinity of complexity.
We're going to start with this Mandelbrot set and we are going to go on a little journey and we are going to zoom in.
And in, and we are going to say that now we are at factor one magnification.
And we're going to keep zooming in and we're going to keep zooming in.
By the time we get to round about here, the original shape is bigger than the building that we're in.
By the time we get to about here, this is two to the 20 magnification.
The original shape is now bigger than Warsaw.
And more detail.
And more detail.
And we keep zooming in.
The original shape is now about the size of Poland and we're not going to run out of detail because we never are.
Because there is an infinity of beauty and complexity.
That we never saw until we invented computers and the arithmetic and the tools that were necessary to allow us to do this.
And this isn't something anybody created.
This is something that was discovered.
Like an Easter egg hidden in reality.
Well done human kind.
You've invented mathematics and computers.
We've left this here to convince you you're on the right track.
And I think that's cool.
I think that is amazing and beautiful.
But we've reached a point now where computers are so powerful that there's almost no limit to what we can see on a screen.
In 1982, Disney made Tron, which was the first mainly computer generated motion picture.
Tron was disqualified from the Oscars because they said using a computer to make a film was cheating.
And you weren't allowed to do that.
We've had the first completely computer animated film, Luxo Jr. in the 1980s.
We've had computer generated dinosaurs interacting with real human actors.
Couple years ago we had this guy on our screens.
And there's this big argument where the actor Peter Cushing's family are going,
you can't do that.
And Lucasfilm are going, but that's not Peter Cushing.
That's a character called Grand Moff Tarkin from the Star Wars films.
So we can literally use computers to bring kind of dead people back to life and put them up on screens.
We can even turn to our computers and go, hey, what would it be like if they remade friends and they got Nicolas Cage to play all actors?
Now, the reason we can do things like this is we've trained computers to work in a very similar way to our own brains.
You have a lie on your back in a field on a cloudy day and you see clouds kind of drift over head.
And they look like shapes.
That one's a rabbit and that one looks like a cat and that one's in our plane.
No, that is an airplane hang on.
And your brain is coming up with these patterns.
It's recognizing things.
And within the last 10 years we've done lots of very successful research on training neural networks to work in a similar way.
Now, we don't exactly understand how they work, but we've worked out how to build them and train them.
You take these layers of recognition matrices, something called convolutional neural network, and you train them on a load of inputs.
And you let them figure out for themselves how to tell a difference between, say, a cat and a dog.
Now, sometimes this is a lot harder than it looks.
One of the big challenges in machine learning and computer vision is how to tell the difference between a puppy and a muffin.
Which doesn't sound like a big deal until you look at some of the input data.
Now, this is all very cool and very interesting, but what's really cool is somebody took this neural network that is used to recognize dogs in photographs.
And they basically flipped it around backwards and instead of being a dog detector, they turned it into a dog amplifier.
And then they fed in photographs, which have nothing to do with dogs, and said, find the dogs, and the computer goes, no dogs.
And you say, no, no, no, find the dogs, look harder.
And when you find them, enhance them, and the computer goes, this is a horrible idea.
And we say, no, turn up the power, more dogs.
And what this is doing, this is a technique called deep dreaming, came out of the deep dream project at Google in 2015.
And what it's doing is it's exploiting the same kind of circuits we have in our brain.
Like when you're walking through a forest late at night, and all the trees look like murderers until you look at no, that's a tree, treat murderer, treat.
It's the same kind of short-circuiting pattern recognition.
It's finding things which might slightly have some kind of dog-like behavior, and then it's just exacerbating, and exaggerating those elements of it.
Now, we have, and I didn't know this until I got here.
We actually have somebody right here in the organizing committee of this conference, who's been doing some really cool stuff, using flutter and dart to create procedural art.
Check this out.
When I start a new artwork, it's just an inspiration.
You just have a feeling.
So between the first ID and the end result, there's just the same feeling.
It's not about the visual. I'm not interested in what you see. I'm interested in what you feel.
I'm Robert. My everyday job. I'm a flutter dev and project manager.
And I'm also a flutter artist.
Previously, I was kind of locked by the tool. I can do a lot of stuff, but only what the tool permits me.
When I found flutter, it opened the door inside me. Now, I can really push further.
The generative art is a lot of research. Like a lot. It's a lot of failure.
It's a lot of failure finding the color, finding the form, understanding the good behavior of light.
What's really good with flutter is the speed of the feedback. It's nearly instant.
Currently, artists do not understand the full potential of the tool.
When you start flutter, you start with a material design or you start with the iOS component.
And you think this is just the tip of the iceberg.
Or if you want to push, then you start to enter the flutter engine.
And the flutter engine is like the juice of the coin.
Each time I start to code, I just feel joy.
So some people are painting, so people are cooking. I just do flutter and flutter engine.
Now, it's actually, I was talking with Robert earlier today about this.
And he showed me some of the things that he's shared on Twitter.
And there's one I wanted to put in this talk just because I think it's absolutely beautiful.
And it's this. And what's happening here?
This started as a photograph taken in Tokyo at night that was then run through some machine learning models to extract depth information.
But then all of the visualization that's happening here has been built using flutter and sort of artistic input
terms of defining colors and gradients and things to recreate this image by drawing up layers based on the depth of the objects in the picture.
And I think it's beautiful. It's kind of hypnotic. You watch it looping and looping.
And every time you start noticing little things that you've not done not seen before.
And as Robert says in the video there, one of the things about art is the immediacy of feedback.
You know, if you're trying to capture a feeling in your head when you're working in paint or play or software, you need something that responds instantly.
Otherwise, you lose your inspiration, you lose your thread.
And I'm really interested in seeing what flutter as a platform is going to be able to offer like generations of computer and generative artists and stuff.
So we've talked about using computers to create art and render things and draw things.
But now I want to talk about what happens when the software itself is an art form.
There is this debate that has been going for many, many years. Is programming engineering or is it creative or is it art or is it technical discipline or, you know, are we just glorified typists?
There's this very famous Donald Knuth's book, The Art of Computer Programming, which is like the Bible of data structures and algorithms and these kinds of things.
But I'm sure all of you have reviewed some code or maybe written some code of your own that you came back to later.
And you open that code up and you're like, I don't know what this is. It's not art. It's not engineering. I wouldn't call it science.
It's creative. I'll give it that much.
And, you know, when you're managing a team or you're pairing on stuff, that can be a challenge and how do you deal with it?
You know, how do you do code reviews effectively? But fortunately, there is a safe space for this kind of code.
And it is the international obfuscated C code contest.
The goals of the contest are to write the most obscure C program to show the importance of programming style in an ironic way to stress C compilers with unusual code,
to illustrate the subtleties of the language and provide a safe forum for poor C code.
Now, I want to have a look at a recent submission.
Any C program is in the room. Anyone want to read this code and tell me what it does?
What the hell? Let's run it and see what happens.
So I'm just going to make that and I'm going to run it. And there it is.
That's Flappy Bird running in a Unix terminal in text mode in just under 1024 bytes of source code.
And it is just as difficult as every other Flappy Bird ever made.
And, you know, there are whole generations and wonderful creations of these tiny minimalist obfuscated programs.
This is one kilobyte of JavaScript.
That's it. That is the entire program. If you paste this into a web browser and refresh it, it plays chess.
It's called nano chess written by a guy called Oscar Toledo G.
And I don't mean it draws a chess board. I mean it plays a game of chess and it actually beats me.
It is a better chess player than me in one kilobyte of JavaScript, which I just think is fantastic.
Now, there's been this sort of race to see how minimal we can get these kinds of programs.
And in 1994, a guy called Simonra Sinkovich submitted this to the international obfuscated C contest.
This is an empty file.
And he submitted it with a note saying if you compile this using this compiler, that compiler, if you gave it an empty file,
it would produce a program that created empty output.
And he said this program produces its own source code when it is run through certain compilers.
And the C code competition said that's very impressive. Well done.
They gave him a special prize. And then they changed the rules and said your program must have at least one byte of input.
Otherwise, it's just the same as this program.
But this gets onto the idea of something called coins.
Now a coin is a program that prints its own source.
And you can't just read it from disk and print it.
You have to actually generate the program source from the program.
Which kind of sounds easy until you try and do it.
So I'm going to see sharp is my preferred language at the moment.
So I tried to write a coin in C sharp.
So I got this class program with a static void main.
I'm like, all right, well, I need to output program and the closing brace.
And I need to output the static void main.
And then I'm like, well hang on.
Because now I need to console right line, the console right line.
And very, very quickly, you get into this kind of infinite loop.
So to build coins, you need to exploit loopholes in the design of your programming languages.
C sharp has something called string templating.
Which is supposed to be used for, you know, string formatting and outputs and things.
But we can create a string like this, which has these 010 placeholders in it.
And then we can feed that string back into itself.
And we get the source code to our program at when we run it.
Building coins is a lovely way of understanding the capabilities of different programming languages.
JavaScript makes this really easy because you can just take any function and put two string on it and outputs itself.
And then ECMAScript 6, this is a coin.
And I didn't believe that. So I ran it.
And that's what it does.
This program produces its own source code.
Now, as a guy called Leon Bambrick and a little while ago, he posted something I just thought was fantastic.
He built a coin in HTML.
This is a web page.
This is the HTML source code.
And we review it in a browser and it looks like this.
And now I'm going to exploit the loopholes in the browsers and CSS to make this web page print its own source code.
So the first thing we're going to do, we're going to put in a style sheet rule that says start.
So everything, display it as a block.
And suddenly, we've got our title and we've got our head and we've got our body elements.
Now we're going to use some CSS rules to say, add this content before and after the HTML tag.
Opens with HTML. It's closing as well, but it doesn't know where to draw it on the viewport.
We'll fix that in a minute.
So we're now going to plug in before and after.
Now you'll notice here, where we say style after, we need to escape the slash.
That's to stop the parsers fighting over who gets to own this line of code.
Feed that back through. Now we have our style sheet being rendered in the page source code.
We plug in before and after for all the different tags we're using.
Now we need to add a rule that says if there's a link on this page, we want to show the href for that link by adding some content to it.
That plugs that in. That works.
And finally, I'm just going to plug in a little rule here.
It's a margin on the HTML and changes the height.
And now we have a web page that displays its own source code.
Which is completely useless.
But it's kind of fun, right?
Now, who wants to tell me?
Take a look at this code and tell me what language it's written in.
Does someone say C?
C. All right.
So I'm going to apply now some syntax highlighting.
But this is what the C preprocessor will do to this.
So that looks like valid C, right?
We've taken out the comments and highlighted the strings.
Yeah. Looks pretty good.
Now I'm going to apply some Ruby syntax highlighting.
Now this is interesting.
And I'm going to highlight the string literals.
And that looks like valid Ruby.
So what is it?
Is it C or is it Ruby?
There's only one way to find out, right?
Let's run it.
So here is the source code.
Polycoin.c.
There it is.
I'm going to run that through GCC.
And then I'm going to see what the output of that is.
We get one warning, but hey, nobody said this was a good idea, right?
And that program prints its own source code.
But now I'm going to run the same program through the Ruby interpreter.
Because why not?
And there it is.
It prints its own source code.
And now I'm going to run the same program through the Python interpreter.
And there it is.
And now, just because hey, we got this far,
let's run it in Perl and see what we get.
It prints its own source code.
And if you can find a C++ compiler that doesn't mind if main doesn't
return an integer, it works in C++ as well.
This is a thing called a polycoin.
It's a program that is syntactically valid in this case five different
languages and it prints its own source code in all of them.
But we're just getting warmed up.
What language do you think this chunk of code is written in?
Well, let's figure it out.
So we've got system.console here.
Which is probably a .NET C Sharpie kind of a thing.
And we've got an XML namespace here.
Which is XSLT, I presume.
And down here, we've got four each in console.log,
which looks kind of like JavaScript, right?
And we've got an ADA text.
Any ADA programmers in the Flutter community?
We have one.
Is this look like good ADA code to you?
And we've got begin here in all block capitals.
So that's a business language.
It's either SQL or cobalt.
And then up here, we've got Act 1, Scene 1, Enter Ajax,
which doesn't even look like programming at all.
This thing is brilliant.
This is written by a developer called Yersuke Endo,
who is one of the Ruby language core contributors.
It is a Ruby program that creates a Rust program
that creates a Scala program that creates a scheme program.
It goes through 128 languages.
And you end up with a Rex program.
And when you run that, you get your Ruby program back again.
This is the Ouroborous Quine, the snake eating its own tail.
And the most beautiful thing about this
is that the entire source code to it looks like this.
LAUGHTER
128 languages.
And if we zoom in on the end,
you'll see one of the cool little details about this
is all of this space has been reserved
so that they can fix bugs in the program
without messing up the shape of the source code.
And that's not even the coolest thing about it.
Because all 128 of those languages
are available using apt-get on Ubuntu Linux.
And so there is a continuous deployment pipeline,
which runs all 128 languages
and verifies that you get your output back at the end of the route.
But let's backtrack a second.
What was Act 1 Scene 1 Enter Ajax?
Well, it turns out one of the programming languages here
is a thing called Shakespeare.
And Shakespeare is an esoteric language in Easterlang,
which is designed to let you write computer programs
that read like Shakespeare plays.
So this is Hello World in Shakespeare.
All of your variables are characters who must be introduced.
So we have Romeo and we have Hamlet.
Instead of blocks and methods, we have Act 1 Scene 1
Enter Hamlet and Romeo, that's variable scoping.
Now, you increment variables in Shakespeare
by saying positive and complimentary things,
and you decrement variables by insulting them.
So Hamlet says, you lying stupid fatherless big smelly half-witted
coward.
You are as stupid as the difference between a handsome rich brave hero
and by self.
Speak your mind.
That prints H.
It calculates the ASCII character code for a capital H,
and then speak your mind is output.
And then the next block there prints E.
So Hello World is about two pages long in Shakespeare,
which is kind of fine, because Shakespeare wrote
some quite lengthy plays.
Here is Hello World in another one of my favorite languages.
Anyone know what this one is?
It is.
This is the white space programming language.
I'm going to apply some syntax highlighting here.
White space ignores everything except spaces and tabs.
White space is brilliant for hiding programs inside other
programs, because most programs ignore white space,
but white space loves it.
It's the only thing that means anything.
Everything else is a comment and gets ignored.
Now, there is another language, which I particularly like.
It's a language called Chef.
And the idea with Chef is to write computer programs
that look like recipes.
This is the kind of canonical Hello World in Chef.
Now, this is interesting.
But if you look at that recipe there,
72 grams of beans, 101 eggs, 108 grams of lard,
133 potatoes.
This is a very interesting salad.
It's a program, and it looks like a recipe,
but it's not a recipe anybody would ever actually make.
So a couple years ago, a guy called Mike Worth created this.
This is the Hello World chocolate cake.
Not only is it a valid Hello World program in Chef,
but it also makes a chocolate cake with chocolate sauce.
So you choose your hardware.
If you run it on a computer, hello world.
If you run it on your kitchen, you get this cake with chocolate
sauce.
Apparently it needed the sauce, because the cake was a little dry,
but it's a recipe.
It's a valid recipe.
And if you didn't know it was a Chef program,
you might be completely unaware.
There was any software here at all.
Let's have a look at how to square a number in the programming
language called Pete, which is named after Pete Mondrian.
This is the source code for squaring a number,
because Pete is a graphical programming language.
This is the instruction set.
And these are the color shades.
And the way a Pete program works,
we have an instruction pointer that starts in the top left corner.
Every time it crosses a color boundary,
that's an instruction.
So we've gone from light blue to dark green.
That's the instruction code for input.
When we get to black, we change direction.
When we cross from green to red,
take whatever's on the top of the stack and duplicate it.
Red into yellow, multiply the top two values on the stack,
put the result on the stack.
Yellow into red, output that number.
Anything that crosses white is a no operation.
When we get to the edge of the grid,
we turn right, we turn into blue,
and we follow that blue shape until we end up with black on all sides,
which means your program has finished and you can halt.
Now this is Hello World in Pete.
And you could print this out and frame it and hang it on the wall,
and nobody would ever know they were looking at a computer program.
They just think you like kind of slightly funky geometric art, right?
And I love all these kinds of ideas.
I love esoteric languages and the creativity that goes into designing them
and creating them and stuff.
And we have this idea and software about being able to reproduce things reliably, right?
We've all worked with continuous unit testing, integration testing,
automated deployments.
We don't ever want any variations.
We want to take all the risk out of it.
Now, conferences like this, there's always a couple of people who do live demos.
Now, I quite like live demos because they have this kind of element of risk.
What if it doesn't work in it?
And it kind of turns coding into something akin to performance, right?
Now, I wouldn't ever recommend anyone does live performance coding on mission critical systems.
I've seen people do it, and once I saw someone get it very badly wrong.
And we have this term in software for fragile servers or fragile processes, right?
We call them snowflakes because they're unique and they're special.
But the thing about a snowflake, if you grab a snowflake out of a blizzard
and you watch it melt on your hand, you've just been part of an experience
that nobody else will ever be involved in.
And, you know, you cannot share it.
You cannot replicate it.
You've just been a part of something unique, a unique performance
that will never take place ever again.
And I want to explore this idea of how we can use software as part of performance.
Now, this guy in the picture, sat up here with the London Philharmonic Orchestra,
is a guy called Sam Aaron.
And Sam created a programming language called Sonic Pi.
A Sonic Pi was designed to help kids get into computer programming.
And Sonic Pi is a live, real-time programming language for performing music using code.
And I'm just going to show you a little demo now of what Sonic Pi actually does.
So, you open your Sonic Pi interpreter and you say,
I want to play this note.
And it plays it.
Now, Sonic Pi is the only language where it will run all of your code
simultaneously at the same time.
Imagine if JavaScript did that, you know?
Unless you tell it not to.
So, we're going to play these three notes.
And we're going to put a delay in there.
And now we can go in and say, well, actually, we don't want to map this out.
Let's put a loop in here.
Let's build ourselves like a little looping baseline here.
So, it's looping.
Now, this is not musically terribly interesting, right?
So, I'm going to crank up the tempo a little bit.
I'm going to say, use beats per minute to 44.
Get something with a bit of energy behind it.
And then I'm going to take the sine wave.
And I'm going to say, no, no, I want to use one of the built-in synthesizers.
Think called tech source, because I think it sounds cool.
And we're going to be just getting warmed up.
Because the really, really brilliant thing about Sonic Pi is it has a feature called live loops.
A live loop lets you run and modify code while it's executing, so you never need to restart your program.
So, I'm going to kick off this live loop here.
And then I'm going to drop another loop in on top of it, which is synchronized with that main loop.
Then it's going to give us some sense.
And then I'm going to grab this, which I have prepared in another buffer.
And I'm going to drop this loop in on top of the program at the same time.
Now, I'm going to put counter into my loop up here.
And I'm going to say, okay, if the number is divisible by 3, I want you to play it.
This note, otherwise, play that one.
And now I'm going to put another loop in there, which says, okay, if the number is divisible by 5, play this note.
And if it's 3, play that note.
And can anyone guess what the last case of a better plug-in here is?
Visible by 15, 3 and 5.
Play that note.
Does that algorithm look familiar to anybody?
Fizzbus.
Fizzbus implemented as a baseline, as a riff in real time, using Sonic Pi.
Which I think Sonic Pi is brilliant.
I've seen people do full live band performances with one of them typing loops and samples and things on laptops.
It's absolutely fantastic performance tool.
And it's a different way of thinking about code as well.
It's doing something with software which isn't quite like running programs or writing code
something, come back and run later.
Now, I have one more part of this talk.
I've talked about all kinds of amazing and wonderful things that have been created and shared by other people,
other developers around the world who have too much time on their hands, probably.
And I want to tell you about something I did.
Now, you're probably familiar with the trope of the rock star developer, right?
Because there's these advertisements all over the world about people looking for rock star developers.
Rock star front-end.
We need a front-end rock star, back-end rock star, database rock star.
This rock star, that rock star.
And a couple years ago, somebody put a thing on Twitter.
I just said to really confuse recruiters, someone should make a programming language called rock star.
And I had this experience.
This moment of blinding divine revelation.
I thought, this is why I'm here.
This is what I need to do with my life.
Because when I wasn't goofing around on Amstrads and learning programming and all this kind of stuff,
I wasted my youth under the influence of these fine people.
The hair metal rockers of the 1980s.
And I thought, that's what we need.
We need a programming language for creating programs that are also rock songs.
Bad rock songs.
Bad 1980s power ballad rock songs.
Now, I invented the rock star programming language in a bar.
This is important and it'll become apparent why it's important later.
But basically, I sat down and I started playing around with ideas from languages like Pearl and Ruby and VBScript.
First of all, hello world.
I thought, well, one let's have lots of different ways of doing things.
So you want to do hello world in rock star, say hello world.
Or scream, hello world.
Or whisper.
Or shout.
Any of these is fine depends.
What kind of song it is you're trying to write that day.
Now, to be able to program computers, we need variables and we need assignment.
And I'm sure you've all seen languages that look like this.
X equals five and my string equals this and VAR and so on.
Now, I decided rock star was going to be dynamically typed.
And it wouldn't need semicolons because hey, we can do that.
Ruby does that.
JavaScript sometimes does that.
Maybe.
We don't need to declare types.
Variables declared we're using.
I didn't want equals because equals doesn't.
It's not something you can sing.
So is.
It was the assignment operator.
Now, have you ever had an argument longer than say three hours about whether to use underscores or
Pascal case or camel case or yeah, I have.
And I saw Douglas Crockford give a talk last year where he made this really interesting
point.
He said we have all these discussions about Pascal case and camel case.
What we want to a variable names with spaces in them.
And I thought all right, I'm inventing a language in a bar as a joke.
We can have spaces.
That's fine.
Three kinds of variables in rock star.
The simple variables which are just like they are in most languages.
Common variables have to start with my and your a the.
So you can have these little two word variable names.
And then proper variables need capitals.
It's not just a big deal.
We've got to feel good.
Black, Betty, Billy, Gina.
These great rock and roll names.
Now, to be able to write a program like FISBA's.
You need to initialize numbers with values.
Three, five, 100.
And this is not terribly rock and roll.
I wanted to come up with a better way of initializing them.
So I had the idea.
What if we take the is keyword and we say, let's count the length of the words on the rest of the
Modulo 10 and treat each one of those word lengths as a digit to initialize decimal numbers.
Yeah, make sense.
And then I thought how does this work with decimals?
Now, in C sharp, pi equals 3.14, blah, blah, blah, blah, blah,
I am semi-colon in JavaScript, var pi equals.
And if you're lucky, you'll get almost that number back when you're finished with it.
To initialize pi in rockstar, my heart was ice, three dot.
A life-unful filled wake in everybody up, taken booze and pills.
We're just getting warmed up.
A arithmetic.
I didn't want operator symbols.
All this needs to be stuff you can sing.
So, addition, well in English, we say it's the price with the tax.
It's the total without the tax.
It's the quantity of the product.
It's the distance over the time.
But this also means you can write arithmetic like a girl with a dream, a man without a face,
the wings of the night, a whisper over the water.
For comparison operators, your love is a lie.
True or false.
Well, is it?
The whiskey ain't the answer.
My heart is stronger than steel, my soul's weaker than water.
My will is as strong as a lion.
Your lies are as low as a snake.
Needed a way to implement functions without using brackets and blocks and
tax and all this kind of stuff, so I thought all right.
Modulus takes a number and a divisor.
That takes is the function declaration syntax there.
While a number is as high as a divisor, put a number without a divisor into a number, assignment,
give back a number.
There's a blank line there.
That's what terminates the while loop and there's another one at the end that terminates
the function.
And this is arithmetic modulus in rock star.
But this is kind of not terribly rock and roll.
So what if midnight takes your heart and your soul?
And while your heart is as high as your soul, put your heart without your soul
into your heart and give back your heart.
At this point, I've had several beers and I think this is done.
I stick a draft up on GitHub and I put a thing on Twitter and I said, hey,
there's this new language, go and have a look and it goes crazy.
Within 24 hours, it had 2,000 stars on GitHub for a repo containing one joke specification.
It made the front page of hack and use.
It made the front page of Corey Doctorow's boying boying, did a write up about it.
It made the front page of Reddit.
I just kept getting all of these little funny comments, you know, why doesn't it go up
to 11?
Someone saying the docs are hilarious, so I'm sold shut up and take my money.
Then the really weird thing happened.
I got an email from classic rock magazine, which is a real music magazine that normally
interviews Red Hot Chili Peppers and people saying, what's this rock star thing we're
hearing about and they did a whole feature on it and I got in classic rock magazine for
a joke programming language and that's not even the weirdest thing that happened.
People started filing issues on the GitHub repository.
I went back to these people and people were filing issues like there's undefined behavior
in your specification.
I was like, so?
Why would anybody care and they say because my compiler doesn't work and I said, what?
I said, I built a rock star compiler in Scala at the weekend and it's got edge cases
where I don't know what the correct behavior is.
Within a week there was a Scala implementation, someone had built one in Rust, someone
had built a transpiler from rock star to Python, just this absolute flood of interest and
enthusiasm and I kept thinking it's going to die down any time now, you know, this has
got to be the end of it and it didn't.
This thing just kept going over and over and I reached a point where I thought I liked
like people saying, oh, you know, Dylan BT, the creator of rock star, but I didn't feel
right taking the credit for something that I did in one evening in a bar.
I thought I need to put the hours in and actually come up with something.
So I built my own rock star interpreter.
It is hard implementing a spec that you made up while you were in a bar, but about 95%
of it actually proved to be implementable.
I did it in JavaScript and I did it in JavaScript for a very good reason.
I wanted to put an interpreter on the web that anybody can go to in a browser and they
can just open it up and they can type some code and become a rock star developer right
there and then.
So I built code with rock star.com with a JavaScript interpreter behind it.
Now that shiny 1980s rock and roll logo up in the top corner there.
I just need to give some credit to where that came from because I wanted to pick up
on something really excessive 80s rock and roll, big hair and fast cars and all that kind
of stuff and I was looking around for inspiration and somebody said, have you thought
about Microsoft consumer products and I thought that's exactly what I want.
That typography is perfect and it turns out Microsoft aren't using that logo anymore.
So I picked it up.
Thank you Microsoft for letting me recycle that.
Now I do have some certificates for the certified rock star developer program here with
me to give away at the end of the talk.
So go to codewithrockstar.com, try something out, show me and I'll give you your certification.
And I'd like to close the talk with one little kind of creative software coding experiment
if that's the right with you because the whole idea, the premise behind rock star was
to write programs that could also be songs.
And of course that only works if you can play the songs for people and they sound okay.
And when I say okay, we're talking like, you know, bad meatloaf from the 1980s kind
of okay.
So I would like to perform for you now, Fismas in rock star, live at Flutter Europe.
Is that all right with you?
Well, it takes your heart and your soul.
But your heart without your soul into your heart, you give back your heart.
Now you remember the Fismas riff.
It's like, it's a much drunken lady killer, my world is nothing, fire is ice.
Oh, there is nothing that this was, taken to the top, it might take in my own body,
nothing, shall this, taken to the top.
It might take in my own body, it might take in my own body, nothing, shall push in,
nothing, it might take in my own body, nothing, shall this take in my own body, nothing,
nothing, nothing, nothing, nothing.
Thank you very much, Flutter Europe.
That was awesome.
Thank you, I do have one important question for you, which is where's a good place to go drinking
in Warsaw on a Friday night.
So if anyone's got a good answer to that, come and see me afterwards.
It's my first time in the city, it's been awesome so far, and I have them right off.
Does anyone have any questions or anything about any of that, or have we achieved complete
enlightenment?
We have one way up at the back there.
Hi, is your language supporting metal on loads?
Yes, that's great.
I can actually show you if I can get it up, I'm not on the Wi-Fi, but it's open source,
if you don't have a look at the parser, it uses a thing called a parsing expression grammar,
and there is this massive chunk of text in there, which defines all the valid identifiers,
and yes, all the layouts are valid in all variable names.
At one point I thought of making the mandatory, but I thought that would make it difficult
to type on a phone if people don't know about it, but yes, it supports full metal
and layouts.
There's another question over that slide.
So, the Draft syntax, which hasn't been implemented yet, the problem with classic rock
music is there are no mistakes in classic rock music, so we had to take some inspiration.
I had an idea about why don't we use punk music instead, and so what we can do is the
way to in IEEE, you can have a division that returns nan and in some languages you have
error codes.
What I thought is we have a special keyword in the language called bollocks, and if something
fails, it returns bollocks, and if you want to, you put never mind the bollocks at the top
of your program, and that means you use like VB script on error resume next, exception handling,
and so that's the Draft syntax for exception handling, but I don't think that's going
to make it in, because it's a little bit too punk.
Any other questions?
What the album soon?
So what I want to do with this, I want to put a couple more things in the language because
it's not finished yet, but then I want to do a rock star programming competition, and
the prize is the 10 best programs I will go into a studio with my band, and we will record
them as actual songs, and release that as an album of procedurally generated, compileable
bad rock songs, but that might take a little while, give me another year.
Any other questions?
The closest I've got is a rocky like a hurricane by scorpions, it doesn't do anything,
but it's about 80% syntactically valid, and I think with a couple of tweaks to the language
aspect, I can get the whole thing to compile, but all it does is just declare a bunch
of variables, but I have a race syntax, instead of push and pop, it uses rock and roll,
so rock you like a hurricane, takes a hurricane, counts one, and then a hurricane is nine,
so that's 19, and it increments the array you by pushing that value on the front.
So yeah, it's almost there, scorpions is almost accidentally programming metal.
Yeah, sorry, I have really one question now.
Now tell me that the song you played last night at the party, they compile, they actually,
whoo, he will blow a knife.
Some of them don't even rhyme.
Have you considered throwing syntax error over when lines don't rhyme?
Difficult.
Not impossible, but don't don't give me any more ideas.
Any other questions?
Brilliant, we've achieved complete enlightenment.
Thank you everybody, that's been awesome.
Thank you very much.
Introduction to Art of Code
Childhood Experience with Logo
How Technology Reveals Beauty
Understanding Conway's Game of Life
Mathematics and Complexity in Art
Discovering Flutter's Potential
Generative Art and Its Challenges
Instant Feedback in Flutter Development
The Nature of Programming: Art or Science?
Understanding Pete Programming Language
The Concept of Unique Experiences in Coding
Introduction to Sonic Pi
Creating the Rock Star Programming Language
Engaging with the Audience
Questions from the Audience
Introduction to Draft Syntax
Future of Rock Star Programming
What does Douglas Adams say about art?
How does Conway's Game of Life illustrate complex behavior?
What are the implications of fractal geometry in understanding reality?
How can deep dreaming reveal unexpected patterns?
What does instant feedback in Flutter development enable for artists?
How can programming be considered both art and engineering?
What makes a program a polycoin that's valid in multiple languages?
How does the Pete programming language redefine coding aesthetics?
What unique experiences can live coding bring to software development?
How did creating a programming language in a bar lead to unexpected success?
How does music influence programming languages?
What is the draft syntax for exception handling in programming?
What could a rock star programming competition look like?
The talk begins by introducing the theme of art and code, highlighting how they are intertwined in the world of computer programming. Dylan Beattie shares his personal story of learning to program on an Amstrad 6128 as a child, which sparked his interest in creating things with code. He then transitions into discussing Flutter, a cross-platform app development framework that allows developers to build high-quality apps for mobile, web, and desktop. Throughout the presentation, Beattie emphasizes the importance of creativity and technology in crafting something useful and beautiful. He also touches on the idea of logo programming, which sparked his interest in coding at a young age. The talk concludes by reinforcing the idea that art and code are interconnected and can produce something truly remarkable when combined.