‘Serverless’ Back-end Development for Front-end Developers

(energetic, rhythmic electronic music) - Alright. So, like I said, I have a confession to make. The confession that I have is that the last bit of front-end code I wrote would've looked something like this.

It had tables and spacer GIFs, and it would've looked like this if you would've had syntax highlighting because it probably actually looked more like this. So, like I said, I'm a back-end dev.

I've been writing sort of back-end stuff for a long, long time and I would like to apologise for our sort of role in the sort of schism of software development because what happened is that we sort of went for sort of front-end developers and we...

We went from developers to sort of front-end developers and then we went to the back-end developers, and then we sort of didn't really have our act together so we got sort of C++ developers and Java developers and sort of Dell Net developers. Luckily, you guys didn't sort of sit still for very long either, so you had sort of web and Native, and then Native became iOS and Android, and now it's become we've got Angular developers and React developers.

We've all sort of schismed into our small little corners of sort of software development. It's sad. I know we teased you guys with things like Rails and PHP, like, "Oh, sure, it's easy. You can do this sort of stuff," and then sort of when you went like, "Oh, this is good. I've learned some cool stuff in it," and then it got more than four users and it sort of fell apart again.

I'm sorry. But what I'm here to do today is sort of reach out the olive branch to sort of you front-end developers.

A sort of olive branch because I think we should all get along again.

I think it's time to sort of stop doing this. And one of the most sort of recent sort of things that I'm extremely excited about is a technology called AWS Lambda, and I think that's going to sort of save the profession of software development and sort of reverse the course that we've sort of been on with this sort of hyper-fragmentation. And so extremely cool stuff is coming out of that. That? Yeah, not going to happen, which is great because it saves us the sort of two minutes it was going to take, but what I was going to show you is how easy it is to write a Lambda, and you can write Lambdas in many, many different languages. Of course, you wouldn't choose any one but JavaScript, but it's literally an event handler.

So if you sort of look at event handlers that you write and some of the code that you write, it's a very similar thing. It gets an event and it replies and sort of do something with that event, and it takes you about four or five minutes to set up after you've invested the sort of 12 hours to figure out how to do that. It's Amazon.

But once you've figured out that you have to configure the body templates in the bottom there and sort of make sure you do applications or something even, then everything works fine. So once you sort of get past the sort of first hurdles, writing one of these things is extremely quick. The other thing I was going to show you is just how easy it is to sort of scale that up. Now, the HellaWorld example that I just didn't show you is obviously very trivial, but what we're going to be seeing is you can compose small bits and pieces instead of more serious things.

So basically, with Lambda you have access to all of the APIs, all of the sort of manage servers that AWS has, such like DynamoDB, which is a seriously amazing key value store.

This is the sort of thing that, over Black Friday, did a couple millions of requests per second. Mind-blowing.

Or maybe you want to do S3 or maybe you want to do the sort of RDS, their sort of relational database.

Or we're going to still talk a little bit about that image recognition software, or LEX, or any of the other sort of things that I have. Really, really powerful.

And the fun thing is you can not just push these things, you can push them real good. (audience laughter) - You can push them real good.

There's a lot of old people in the room.

Hello, fellow old people. But yeah, so the thing is because they're tiny bits of JavaScript, Amazon takes cares of scaling this thing out for you.

It takes all the scaling out of it.

You can do one request at a time, you can do ten requests at a time, 20 requests at a time, or 100.

Now, if you want to do more than 100 confirmed requests, you have to do this sort of really tricky thing.

It's called emailing Amazon, and then they'll give you 1,000 confirmed requests.

It's the only thing you have to do to scale up, beyond the 100 confirmed requests, is send Amazon a polite email, "Could I please have a little bit more?" And they're like, "Sure." And there's a couple of really amazing sort of advantages; the first and most obvious that sort of people talk a lot is about sort of cost. If you want to sort of do... And if you have a semi-serious application and you want to do some sort of availability zones and some...

So you've got two M3 Large instances with some load balances in front of it will set you back sort of a little under $1,200 per year if you pay up front.

If you want to make one million sort of typical API-Gateway and sort of Lambda requests, it's somewhere between five and eight bucks. Orders of magnitude, big difference.

Massive, massive change. Not having to worry about servers? Priceless.

I was giving a talk and someone was like, "So, but what do you do if the thing's down?" And you're like, "I go and grab another drink." There's nothing I can do, right? "Wow, that's really scary." I'm like, "Well, if you think that you do ops better than Amazon, you could be Google or delirious. Either of those two things is true." It's just not going to happen.

But what I'm most excited about is that convergence of development.

The convergence of development is what I'm most excited about.

First of all, because we can write JavaScript. Now, JavaScript is really easy to make fun of. Does anyone have a guess what the type of null is? Object, yes. This is my favourite.

The type of is not a number. Is a number.

Does anyone know what happens on the last, the last line? It's actually undefined, they fixed that a long time ago and you can sort of redefine undefined, this is one of the most mind-blowing things.

But as Kyle was saying in his talk, it's pretty darn amazing language.

It's easy to pick up, lots of people know it, and it's literally everywhere. Everywhere.

So the fact that we can now write JavaScript everywhere is extremely powerful and extremely useful. Our sort of high-volume sort of back-end services cannot ultimately work in JavaScript. The other thing where I think that you, as front-end devs, have a...

There's sort of two reasons why you, as front-end devs, have an edge over our sort of us experience as back-end devs, and that's events. Sort of traditional back-end development hasn't done a lot of events. We've been doing a lot with sort of procedural, sort of imperative code, and that's what we're really used for. This whole model sort of thrives on events and working with events and events language, which is sort of the stuff you've been doing for a long, long time.

And it's basically events all the way down. If you look at the architecture of sort of my application, I run a startup and sort of half replication is just completely servers and all Lambdas, and it's events all the way down.

To give you an example, here's what we have with an API gateway, just like we had in the non-demo. We're sort of talking to a Lambda that takes care of these requests. This is a toy app that we've written. If you go to whichChris.bjennings.io, one of the problems I always have with...

I love sort of the Marvel and the DC sort of superhero movies, there's just too many actors called Chris in them.

So what we did is we wrote an app where you just upload a picture of someone you suspect of being a Chris, and it will tell you which Chris it is, if any. And it took us about a day to build and we spent about sort of seven hours on the uploads of binary documents and about an hour on the rest, and so basically that's what we do. We take that upload, it goes through a Lambda, and this stores it in its Three.

And that's where you get, so Store in Us Three, which is their sort of file system that you have installed with Amazon.

So we store it in there, and the fun thing is that that triggers another event.

So guess what we can do, we can write another one of these Lambdas that goes...

Talk to recognition. It goes into recognition and it sort of does their magic because that's pretty much what it is because it's actually accurate.

And it comes back and it all tells you if any Chrisses has been found, and then we can just back into another S3 and we can trigger something else again and again. In this case, we kept it simple and we created another service that also talks to S3. We've put fun in front of it to make it really perform well, but this is... So we've now have a sort of extremely high-performance sort of web application to figure out which Chrisses are in your favourite movie. Hours worth of work.

Extremely high, and that's sort of what I'm so passionate about; high-volume, really easy to write. One of the things that I've been finding in practise, sort of having built a real-world application based on this, is one of the fun things that events give you is you add features by adding event templates. You do that by adding...

You add more of these Lambdas, and that brings me to that sort of third thing, where I think you actually have an edge over sort of our, us, sort of old, traditional back-end devs, and that's components and thinking in components because that's what, it turns out, is what we need in this sort of brave new sort of world of back-end development, with lots and lots of event handlers and lots and lots of state, is we need that same component thinking.

What we need is sort of self-contained units, containing both sort of state and behaviour together. There's a hierarchy of them, a hierarchy of them, and this is the most important thing that I've been finding ever since I started sort of working with the things like React, is a thing that I called that sort of coherent on multiple levels. If you're familiar with React or sort of any other sort of component for front-end framework is you can look at your componentry at any point in that tree and it is a coherent self-contained unit.

We need exactly that kind of thinking in our back end, we need exactly that kind of thinking.

We need your sort of expertise that you've been doing for a long time and we sort need your help. I want back to that convergence of development.

I want us all to be developers again, and I think we can get there if only you guys could tell us how you lay out things on the web because you don't seriously write this stuff yourself, right? I want us all to be web developers again.

Thank you very much.

(audience applause) (energetic, rhythmic electronic music)