CMOS #6: Tally Barak on GraphQL
I'm your host, Gabor Szabo, and with me is Tally Barak. Hi Tally, how are you?
And it was like that. So it's many, many years now, since I started programming. I did that as a hobby, as a kid, later on as my military service which is compulsory in Israel, later on as my profession. But the interesting twist here is, that along those years, I moved from pure programming into more management, products, other things, consulting for large firms about architecture, all those surrounding areas around programming. For about 15 years, I wasn't really doing pure programming, at the time.
So we are talking about some time back at the end of the millennium, the previous millennium, that I stopped programming. About 2.5 years ago, I got this urge again, to go back to code. A few things have changed, I was doing some other things, and then I realized,
Why shouldn't I go back and start doing that?
I came back to a totally different world, because it was, and especially the two things that are different from 15 or 17 years ago, we can call them GitHub and StackOverflow. That's the one thing that changed all the programming experience for everyone, the GitHub with all the open source projects, and StackOverflow with all the questions, that you just post your
Guys, guys, I don't know what I'm doing wrong here! and then someone says
Oh, no problem, you are missing a semi-colon or
You should just call it A instead of B or something.
For me, that was an amazing experience and one that I said
I want to be part of it. And since, which is for some time now, I am asking and answering on StackOverflow and various forums, helping with some open source project, and that sort of things. So yeah, that's how I got here, to be a programmer, female, not so young, which I think is pretty rare. I mean it's not very common for sure, I'm not your typical 25 years old, male.
Yeah, I know you're not 25 as well.
How did you grow so fast?So you can see the differences, the contrast, in a different way, how the industry has changed, especially open source I guess, but in general, the industry, right?
What were the names of the things you told me I should learn?Because I couldn't even remember, that was how out-of-touch I was at the time.
hide a lot of the complexity, you could just go ahead, write something, and later on understand it. But in parallel, I did a lot of reading, and watching of videos, and YouTube, and going to meet-ups, and learning other things.
So I also learned about Meteor, which was
Recently, the new thing from Meteor group is Apollo Server, and I got really fascinated, back again. You go to something and you say
Wow, that's really nice and cool!, so yeah, GraphQL and Apollo server is my last cool thing and right now I'm doing that as sort of as a hobby, an after hours kind of thing, but I hope it will go to my real-hours thing.
So GraphQL is actually a standard, it is, I don't like to say an evolvement, but more like another tier, on top of REST API. I mean, we are all familiar with REST API and Ajax, and how do you send the data back and forth? But it turns out that REST APIs have some great features and great value but some big disadvantages and the main one of them, well, let's say the two main things are performance and documentation.
Performance is because you are sending one request per resource, normally, and you get it back. So that means if you want a few resources and to get some additional information about each resource, that will require you quite a few roundtrips to the server and if you are doing that from your desktop with your 1GB network connection, then I guess that you're okay. Even if it's 50 or 70 or 20MB connection, but the reality is that most of us use something else for a lot of browsing and it's this big device, which is not that powerful on one side, and usually having a worse internet connection.
So the main issue here is to say
I want to send one request, and get all the data I need at once, because that will be much, much more efficient, especially when I use mobile devices. And GraphQL describes some sort of a standard, it's a middleware that is standing between your client and the server, receives those requests from your client, mobile, or web, or whatever, and does the multiple requests, and then returns one response with all the data. So it actually takes some of the processing that you used to do in the client, for combining data, merging it, and moves it to sort of a server, or middleware. In fact, it's another server.
And the GraphQL is describing the schema, what you should send. The good thing about it is that, that schema is very well-aligned with what is needed in the client, with how you design the user-experience in the client. Now I know it sounds very fluffy, but once you go and look at it on your screen, how you describe it and how you send a query, how it is well-documented, it is very easy to understand. And most people go
Wow, that's really what I need!
I don't know if you are doing demos here, or...?
The main thing about GraphQL is that you describe your schema, you describe how the schema is built, and you use this schema to build all your queries. It's sort of, and I'm very careful here, it's like moving your ORM to half-way through the client. I think that's almost like it, and then you have all your schema defined, but the good thing, this is what as a consultant for large firms, what is really exciting is that you don't have to connect to a single server, you can, in fact, use this middleware to connect to multiple servers if you have in your organization.
Or even if you are a start-up and you say
No, I am not this huge enterprise that has ten thousands of servers but even if you are a start-up, you probably connect to Slack and Stripe, for your payment, and some other services that you use, instead of developing them. Maybe you have payment, maybe you have something else for your billing, and the accounts' management, and that sort of thing, so you probably have some integration that you need to take care of.
Go ahead, check it out, because it's really, really interesting and I believe it's going to be extremely popular in the coming years, look at it as sort of some evolution. First we had SOAP, and most people love SOAP today, just as long as it's in the shower, and not in the code. And then we had REST, which solved some of the problems that SOAP had. And I think the next step is GraphQL.
And then, to set up a server, it's actually pretty easy. I mean, you can take the Apollo server, which is open sourced, as I said, and implement it, but there is another cool thing which is about two companies, which are providing now GraphQL as a back-end service, similar to Lookback or Dream Factory, that provides you a full back end without you needing to develop anything. So they did the assembly, they're providing GraphQL with a database. So assuming you go to a database that is local, they have two different approaches. One is giving you all the surrounding services, the other is more focused on database. We'll put them in the notes, one of them is GraphQL and the other is GraphCool. If you want to find more about that, there's a GitHub repository which is called awesome-graphql, and it has all the resources, just like the Awesome, everything that they are doing there.
We talked about what's in GitHub, apart from just pure code. So that's another example, we have books, I think the second most-popular GitHub repository is in fact, books. And we have all the Awesome-something repository, which gives you the main resources that you can see on different environments, so there's also an awesome-graphql there, so you can go and check it out, and there you will see also the provider, the GraphCool and the other two, that I don't remember.
Published on 2016-09-10