 We all have been using it and it really is pushing for the internet to use it as a mobile device. If you guys are not new to technology, it has been used way before the internet comes and the internet has pushed it even further by increasing the power of how machines can communicate with other machines. That's how this mobile and mobile device that is coming out and all this movement that is going on right now will push it even further. We as developers have been using it, we have been using radios and a lot of other tools and other devices to help us to give a great guide and a great guide in a lot of sectors. My name is Juan Mota, I'm co-founder of Junko-Prom, we are a source for identification. This is how you can find your computer and internet in general. And today we're going to talk about AMS, API, radios and an adapter. And everything will be targeted by a lobster. So yeah, I tried to make the lobster the short part. I probably should get started with it. For those that doesn't know, I'm from Brazil. And Brazil is awesome. Actually, this is how far I am from the home right now, just to talk to you. It's like 10-hour flight. And what is funny is that every time that I go to every conference in the world and I tell them that I'm from Brazil, everybody asks me about all these trees and lakes and other stuff. Those trees and lakes and everything fun. But actually, the thing that I came from something like this. There are no trees, no lakes, no animals at all. And actually the largest city of the whole Americas. And also the largest city of the whole southern hemisphere. Yeah, it's pretty big. We had a lot of traffic, a lot of gems. So this is a picture of my usual Friday night. You can easily become one of those. What is funny about this picture is that if you take a look at this land side even the mountain cycles are having a jump. So yeah, it's pretty tough. Had fun. Yeah, we Brazilians love to have fun and love to hang out. And one of the major tournaments stuff that we have in our country is soccer. Soccer is huge in Brazil. Every other city it was called Alvitators. And it was a lot of fun. I talked a little bit about it on Rubicon. If you want to know more about it, you can watch the conference now. We are a couple of weeks away from the World Cup. And we are not users. We are about to get in the application. You can imagine. We have texture. We have indexes that weren't missing. And we also had no cash at all. So our APIs were really, really shabby. We are really good at the World Cup. And I didn't know what I should do. So that was when I thought about CMS. How many of you have used active models in real life? All right. So you even have a lot of these thoughts. But first, let's take it easy. This is when I found love. I always loved open spheres. And I was about to come through good with people and building new things. But that time I really found love with Active and Modern Surrealizer and RAILs API. For those that didn't know, I'm one of the contributors for RAILs API and Active and Modern Surrealizer. We are doing an amazing job. I talked a little bit about it from the end of the talk. But as far as to get started, let's talk a little bit about API. API stands for Application Programming Interface. And I would like to dive into the story of the definition. That it's interface. We are so worried nowadays about interface in general. Everybody knows how much user experience is important to an application. Everybody knows how much a user interface is important and how much it can really take you apart from a bunch of other applications. And what we usually do again is that APIs are also a kind of interface because their users are going to use it. Or your customers, or your developers, or your team, or all their developers are going to integrate with it. So yeah, we should be putting the same fork and the same amount of technology and fork in developing APIs as we do with the usual user interface and user experience. Because APIs can really be one of the great assets of a company. If you take a look at Facebook, for example, Facebook is the biggest ever made social network in the story of your message. And I don't know if you realize how much the API, their API, helped them to achieve it. By nowadays, we are using the power of signing with Facebook which is our problem. We assume, every time that you build an application, that we are going to integrate with Facebook. So yeah, their API has been a major tool in their expanding process. But it also can be one of the greatest liabilities of a company. Because if you don't do, if you don't write a good API, it will definitely come back to you. You're going to have to invest money to fix it. You're going to have to invest time and people to fix it. And you'll probably give a better experience for everyone that's going to integrate with you. So the question here is, how do we build a good API? What are the definitions of a good API? Well, in order to define a good API, there are eight concepts that we have to use. Those eight concepts is what defines if you have a good API or a bad API. These concepts are performance, scalability, reusability, and probability documentation. It must be easy to learn. It must be easy to use. And mostly, it must be hard to reach huge. This eight concepts is what defines if an API is a good API or if it's a bad API. So we have to start to worry about this. Well, there is a great talk about that. Joshua Lange gave it to Google, and he made this code that it's really precise and really will help you to achieve a good API. An API should do one thing and do it well. So this is where we're going to start about thinking APIs from now on. Maybe I should do one thing and do it well. But if we take a look at the technical side of it, we have a lot of tools to build APIs. We have a lot of tools that might help us to build APIs. And I would like to talk a little bit about why radios is the best tool to build APIs. The thing is, I would like to talk about it, but it's not. Yeah. But it's a great one. I know there's no super good. There's a lot of downsides where radios are great too. And I will show you how we can use radios to build an API. So the things about why radios are great too is because if you take a look at that eight points that I pointed out for you, that the form is kind of radiating hard to use, hard to use, how they are deeply related with conventions. If you follow conventions, you probably have a reference. If the problem is to document, it's probably easy to use, hard to use, and easy to scale. So there are deeply connected conventions. And conventions by itself, it's deeply connected to radios. Radios is all about conventions. So yeah, this is why radios makes yes and great too to develop an API. But I have to argue it's something that radios is indeed rebooshed. So yeah, radios has a lot of parts that you might not want to use and a lot of parts that you might want to use when developing an API. So this is why radios API exists. How many of you have already used radios API? Right, two. What radios API does is it removes the parts of the radios that you don't really need and don't really want when developing an API. And it brings new functionality that you might use and might want when building an API. It's pretty much simple. And one of these specialities, one of these projects that radios API has in union is Active Model for Realizer, also known as AMX. The easiest way to define Active Model for Realizer is that it brings convention over configuration to your data. So it follows the radios concept, it follows the radios logic, and it also is made in a convention. But it adds a layer in your radios application that will handle the conversion of an object that you have into a JSON object. So I will show you an example of what is a serializer on a radios application. This is what a serializer looks like in a radios application. I'm going to go through it. So first things first, you have the definition of a serializer. No worries. We have a line that defines the actual boot that we want to return as JSON. In this case, title, body, and comments count. But the thing is, comments count isn't a natural boot of post. So it's a virtual virtual boot that you create on a serializer. So this is the method that counts the comments of a post and gives it back as a JSON. So once that you have this realized in your radios application, this is the output that you're going to have. So you're going to have a JSON output every time that a post is returned to your client and you have an ID, title, body, and comments count. Pretty much easy, right? All right. So we have been using AOS, I think, for some years from now. The first question that was kind of stable was the O8 version. How many of you use the O8 version? We have the O9 version. How many of you use it? And we also have been working on O10 version. How many have heard about it? So yeah, we are working really hard for several months in the O10 version. And I would like to give you a sneak peek of it and the great features it has and it will have. And you learn a lot. I'm sure about it. So the first feature is we implemented an adoption part. So what it means? Right now, adoption is part of it. It's a part of Activity Models to Realize It. Let's try how the Activity Models will be realized. It means that if you would like to use Activity Models to Realize It, to do an XML, for example, you could be an adoption by yourself and you can create it with Activity Models to Realize It. So it makes it easy for people that want to use other formats, other than JSON, to use Activity Models to Realize It. And if they want to contribute beauty and contribute to the project itself by building new adopters that don't work only with JSON. So yeah, it was a great change and a small one. So yeah, quick win for us. So the second feature that I would like to talk about in this one, it's really cool and I really would like to focus a little bit about it because I don't know how many of you have heard about it. It's JSON API. How many of you have heard about JSON API? All right, JSON API, the standard for building APIs in JSON. So it started back some months ago. Some of the brilliant and greatest minds and friends that I have right now have been working on that. So you might know Steven Klamnick and give him another talk, another conference and another room. So they start building it and there's a lot of other brilliant people that are working on it right now. The concept is that I want to define a standard form to build APIs in JSON guys and it brings all the good things that convention is always bringing so you don't have to worry about negotiated and it with your other employees and your other developers you don't have to, a friend can develop you don't have to worry about how it will be integrated or which tools will be returned for API. So yeah, it's really cool. It really makes it a lot easier to integrate APIs and build APIs and make it a lot faster. We really believe in that and we are kind of glad to announce that we are ready to implement the JSON API and there's three in this new version and the one-day-old version is supposed to be released on May 21 and we are already working on that so after the release we're probably going to also work with ActiveModus Realizer and it's really cool because if you choose to use JSON API you could build APIs way faster follow up comments that you anyone in the world know what it's about and it's really cool and we're really proud of it. The next two features that I'm going to talk about are some features that I'm pretty proud of because I'm the one that made it and I really think that it can really help a lot of developers out there because it helped me on increasing and improving my APIs back then in the World Cup. So the first one is Cache. We have implemented a beauty in Cache functionality inside of ActiveModus Realizer. So it's a totally new implementation right in the first patch. It's optimized and it's followed the rails of completion. I'm going to show you as we speak of how it works. So this is a user-realizer, a post-realizer with a title and body attribute. Let's say that you would like to cache it. All you have to do is add a cache method and it's done. I have to do that a cache method is a realizer and a part of it and it will be cached and it will reuse it. But you can go further than that. You can even specify a key for your cache. Or even further than that, you can use all the rails of conventions. So you can place expires in three hours and this cache will get automatically expires every three hours and it's really cool. So let's imagine that this realizer has a post-controller. So this is a post-controller with an index definition, user stuff. So every time that a user goes to the index method it will generate the cache as we saw in the post-realizer. The good part is when the user goes to the show method the same cache will be reused across every action that uses the post-realizer. So yeah, it's a really great optimization and might make a lot of difference on your application's API. The next feature that I would like to talk about and it's another really cool feature is Threadman Cache. Threadman Cache can really save you a lot of time. What it does is, oops, sorry, what it does is it always follows the rails conventions. It also follows the rails conventions and it's viewed to cache specific attributes on a serializer. I'm going to show you this thing, pick up the two. So take a look at this post-realizer. It's a little bit more complex. So we still have a title, a body and a comments count attribute. But this time we are overriding the title attribute and we are overriding the comments count attribute and generating them inside this realizer. So if you take a look at those two methods by themselves you're going to see that the title despite of being the modification of the usual title of the post it definitely is cacheable. But the second attribute that it calls how many comments it has, it's non-cacheable because it can change very quickly. So how can we cache one part of this realizer and get the other outside and still have the improvement of the cache implementation? So right now all you have to do is add cache on the title also using the Rails convention. And you can always, you can always use the otherwise except comments count and it's okay. So this is what you can do with, you put everything together. So you can define cache, you can use a key, you can use all the Rails method like it's firing in and you can also use it to make it pregnant cache. So yeah, it's really cool and it's a really cool two features that you can combine together pretty well. There is this famous phrase that we got the truth and now the others bring the data. What about how it can be problematic? How is it concerned with the old version of active models to realize it? Because this version was totally hybrid. It was right in scratch. So well, I made some benchmarks. So if we take a look at the last version, the online version, we look at like a benchmark that I made with about 10,000 times boating and hazing serializer. But if you take a look to the new version, we have a drop of, in this company, drop of 10 seconds, obviously, and if we use cache, we're going to see like almost 15 seconds drop. So yeah, it's a really great increase of performance and it might really help very much. So there's a lot of working progress too. We still have a lot of things to do. We are really working hard to implement that approach so we can push forward to have even faster response when loads a lot of cache together. We are still working on a benchmark presentation that will help us to also keep track of the performance issues where we are making. And there's one more thing I'd like to talk about that's really cool. And I'm not sure if I, even I believe it, it's that we made it, we have just released an AMS open like today, early this morning, just because of RailsConf. So you are all able to use this everywhere. So you're all able to update your JS, update your applications, and to use ActiveModeler serializer. So let's try something new here. So if you'd like to teach about it, you can use the hashtag AMS10. Yeah, it will be fun. Like, whoa, what is AMS10? Let's check it out. So yeah, use the hashtag AMS10 alongside RailsConf and people will be concerned about what it is and you should check this out. So we have released it this morning. You're all able to update it. We still have a lot of work to do, but yeah, it's really great. I have another thing to talk about and it's really cool. Not sure yet, but I think that I should share with you because I'm excited about it. We have been touched with a Rails core team for some weeks from now and we're really excited about the possibility of AMS joining the Rails as the full. So you would be able to use it in any Rails application. It's not for sure yet, but we have been going through it and it seems that it's going to happen and I'm really glad that I shared it with you so we can make it push forward and make it happen. I also would like to give a special thanks for the whole AMS, Rails API team. They are amazing. Specifically, those more amazing guys that have been closely working with for the last months. There is a lot of other contributors, a lot of amazing developers and amazing people that helped us out, but there's a lot of people that are amazing and helped me in building this. Actually, I haven't been learning for them a lot. I think that I ended up going too fast. I was planning to take another 15 minutes but I think it's great because you have some time for questions. I would like to thank you all for being here and letting you know that it's out for you guys.