The evolution of a RESTful Django backend
Formal Metadata
Title |
The evolution of a RESTful Django backend
|
Title of Series | |
Part Number |
23
|
Number of Parts |
44
|
Author |
|
Contributors |
|
License |
CC Attribution - ShareAlike 4.0 International:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this license. |
Identifiers |
|
Publisher |
|
Release Date |
2014
|
Language |
English
|
Content Metadata
Subject Area | |
Abstract |
A look at the challenges and successes that the Safari Books Online team has had implementing RESTful web services in Django.
|

00:00
Building
Multiplication sign
Real number
Stress (mechanics)
Evolute
Theory
Product (business)
Web service
Mathematics
Word
Different (Kate Ryan album)
Authorization
Quicksort
Position operator
Library (computing)
Physical system
01:44
Presentation of a group
Software engineering
Real number
Multiplication sign
Set (mathematics)
Median
Representational state transfer
Instance (computer science)
Template (C++)
Web service
Word
Videoconferencing
Video game
Text editor
Right angle
Quicksort
Computer-assisted translation
Plug-in (computing)
Library (computing)
Form (programming)
03:02
Web service
Prototype
Multiplication sign
Gender
Electronic mailing list
Software framework
Right angle
Library (computing)
03:32
Point (geometry)
Game controller
Mobile app
Functional (mathematics)
Serial port
View (database)
Multiplication sign
1 (number)
Online help
Client (computing)
Mereology
Food energy
Template (C++)
Medical imaging
Prototype
Web service
Different (Kate Ryan album)
Analogy
Software framework
Data structure
Error message
Address space
Social class
Dependent and independent variables
Multiplication
Gender
Consistency
Projective plane
Boilerplate (text)
Content (media)
Total S.A.
Line (geometry)
Type theory
output
Reading (process)
Library (computing)
05:59
Point (geometry)
Statistics
Serial port
Multiplication sign
1 (number)
Bit
Function (mathematics)
Evolute
Software maintenance
Field (computer science)
Number
Type theory
Personal digital assistant
Logic
Cuboid
Software framework
Resultant
Library (computing)
Social class
08:04
Point (geometry)
Server (computing)
Service (economics)
Computer file
Code
Multiplication sign
Range (statistics)
Numbering scheme
Client (computing)
Function (mathematics)
Mereology
Field (computer science)
Number
Revision control
Semiconductor memory
Term (mathematics)
Computer configuration
Single-precision floating-point format
Cuboid
Software framework
Data structure
Extension (kinesiology)
Form (programming)
Social class
Validity (statistics)
File format
Surface
Expression
Feedback
Interactive television
Bound state
Content (media)
Mathematical analysis
Staff (military)
Bit
Entire function
Demoscene
Type theory
Computer animation
Doubling the cube
Personal digital assistant
Logic
output
Right angle
Quicksort
Object (grammar)
Library (computing)
Probability density function
14:20
Group action
Context awareness
Serial port
Code
Source code
Coroutine
Sheaf (mathematics)
Set (mathematics)
Function (mathematics)
Client (computing)
Mereology
Computer programming
Mechanism design
Mathematics
Computer configuration
Different (Kate Ryan album)
Cuboid
Software framework
Endliche Modelltheorie
Social class
Theory of relativity
Electric generator
Electronic mailing list
Bit
Maxima and minima
Representational state transfer
Cognition
Type theory
Message passing
Digital rights management
Order (biology)
Website
Right angle
Quicksort
Resultant
Point (geometry)
Server (computing)
Computer file
Variety (linguistics)
Drop (liquid)
Rule of inference
Field (computer science)
Number
Revision control
Energy level
Representation (politics)
Selectivity (electronic)
Router (computing)
Form (programming)
Default (computer science)
Multiplication
Information
Validity (statistics)
Gender
Boilerplate (text)
Total S.A.
Spring (hydrology)
Personal digital assistant
Game theory
Musical ensemble
Object (grammar)
Library (computing)
22:36
Point (geometry)
Service (economics)
Computer animation
View (database)
Authorization
Software framework
Library (computing)
24:34
Lecture/Conference
00:01
and it and so on and that's the good theory here that slice the import Lenora lives in all of the city so it's it's it experience so this talk I envision this talk is giving some insights from religion use in a production systems that supply books online has deployed about various rust uh our use of various Web services libraries to build API and sort of evolution because you know as we started kind with 1 thing in the which has some mouse no during this other thing it's change over time and we have a variety of libraries in production right now so going talk through you know 3 or 4 of for these things and what I'm what I'm going to do is give you some real words from from different engineers than just me and not not necessarily like safaris position but how I we experience like the good things and some of the that the 1st question there are any of you creators or authors of the Django web services library the OK I did it so so turn down the the the stress that so we talk about some columns and it's not it's not a judgment that's so quick introductions of before we get into
01:45
it so that you think you might be the stock you're familiar with genuine rest but you want to hear about some real world usage and go like I just described uh doing a web service libraries right the eyes the to and quickly about me at Safari I'm a senior software engineer all I write for an encoding the rights and back showed and mostly back and right now uh also like to write a text editor plug-ins for some reason I don't know what it is for different editors and so again and allows for instance the set median and use this but my PowerPoint template to make this presentation you know sort of you might know by the the longer forms of words of online I had from around the following else will assure and just sort of our cat phrasing as we're we're bringing the best of books in courses for life so we wanna give you guys access to videos books whatever is you need to learn from come
02:50
come in and look at our site and look at the of the even you jump out a way to leave was something from the start of so I will tell you the end of the talk before we do the entire time and that is that we
03:04
use gender arrest framework for a new API and we'll go into some reasons why there some there's a long list of of things you like about it but you need to leave or something and I'm sure you've already heard this many times probably isn't new but generous framework is this good so let's
03:21
start at the beginning right and this is in some ways like the beginning maybe at the beginning of the prototype we can also look at it as before we did before we use a library for DNA web services we use
03:33
Plainview's views have also uses prototype as well as image so so there's some pros of using just Bonilla Django views Fourier API it was about time on this but it as you may know me not know the good for returning like snippets of rendered HTML from a template of or something really simple like you wanna just expose a read only API for centuries on the excellent so how good are they give you complete control over the structure now put of your your your data and you can do what everyone in your view functional class before you to get this to an analog but I find Nisus under apartheid no one's the milled gender abuses Jason view that it's a it's actually called gender adjacent viewed because this little decorator you put on top your do you end up it it helps manage likely rising deserializing the hyphenated structures at adjacent on it as they can be cut out some at 1 point but of course there are some cons like you why would we have always library frameworks if there one-semester things about using military use and you have a lot of boilerplate shorter fever and she done this you know you know you you want what stuff around around validating input data for over the line it's a lot of setting up the dys'-related serialization the serialization multiple content types and so forth and having total control comedian consistency of your responses across and within project so maybe a metal apps that API as and you might have no pursuing stuff differently in different apps and suddenly you know the energy get back when there's an error a slightly different at different structure and the clients have to code differently bottle this this is not that form of and you might end up with multiple views we will with multiple views for different content types of that help manage you know want my stuff back in XML address some of the so easy if it's pointing view time is matched up part the binary all this
05:45
have a look at this and mostly because it's what we used to I think of the 1st real like web services library probably really knows you know present the greatest race at this point but not maligned piston but I will talk about it because this
06:00
is a history of evolution and and so we'll talk about prose of this and the following this is not very nice bright that major approaches for you today is you can get a simple API up and running probably any library can do that but on they don't have a lot of so keep the ship so we want some problems because the number 1 problem of course use piston it's really not being maintained its kind of a dead library at this point of the last 4 release was on type I was only 2011 so you know we we perceive that the community is drying up we still have a guys that were written in Pisa but we're probably going to my over too generous framework and I think we have migrated some of the case supply and we might 1 of my readers to here as well so real problems like or probably had is there not an explicit serializer really for your your API classes so it kind of makes it you know it's a little bit sticky to manage the 4 to mingle the output of the cell phone and in some you know dynamically calculated field in my my Jason anemic turning on a lot that logic ones that inside of this 1 monolithic API class and that's just it's doesn't it it's not maintainability you know this is a problem that actually is in a lot of libraries but person is 1 we found the 1st 2 and there's no pagination out box so the studentship with the ability to paginate results your results set and in the API it turns out that's pretty useful if you're showing lots of lots of items in a list of and more right there's other ones but why should be really spend a lot of time on this at this point but I think this and was a great library why Persia using like pain is way that the writing the no the user knows also paved the way so prompt statistic and the next thing
08:01
we resettlement was tasty so what are
08:06
some present about people are still thinking about the user-supplied erased your left this point and so what can the supply did you wouldn't give us the give pagination of box which was also the at and then so is a little bit of a better and there's a there's couple improvements over this 1 was that it was easier to mind to change the output data we're sending back because they see by as this thing use these methods you can override of for hydrogen dehydrating which is another analysis and further it's dishes the serializing your data structures that was nice on it was improvements and we found the resource object that you subclass to be relatively straightforward in terms of its API interaction with it what type money about on the surface the approaches for and then 1 of the cool things about the supply which is so cool is that it will generate a schema based API automatically so if you apply and that can do something with that scheme which is sort of the of but if you have 1 then that's pretty helpful at the client-side validation and you're also going to do your server-side validation as well and our and handles setting up the Urals for you which is kind of a double edge sword it's like that's nice in its fast and it is not necessarily Pythonic just an automatic Ural thing in my opinion because I kind of like having you by year pretty explicit by a lot of frameworks and do that for you and the rails does it as well as any other libraries like general framework have her anyway so couple comments we kind ran some big problems using his supplies and they were really things we expected at Safari Colonna were back in EP eyes are like a it's like a pipeline of content right so we get a bunch of stuff from publishers to get lots of material from them a lot of it is like the ponds and he have some these bounds of pretty large even when each of them and case apply to handle like binary types very well on there's a spatially Taylor just like the those others and then worked also I I put community can get access to the PDF version that you can check it out of the and then I think this is more like women using custom staff yeah yeah I had to get to get follicle working against the guy if you read that issue you know there's like I got this for and you can use it you know so the problem into like high memory usage of the receiving a file clerk because it wasn't doing any kind of streaming it would just for the entire thing in memory and they were uploading a huge objects on a lot of times so thing was that range he was it turned out to be here all the research articles easy to use it turned out that it was not so easy to extend lots of parts of the scene in our in our opinion and again this is little engineers you me feedback on the so like we all had the same problems but this was the perceived difficulty of and same with piston is in the substances generally end up with a single API class that kind responsible for doing everything like it does a panel like customs realization this realization logic and much of other you know fields are controlling medication stuff so yes that is why it is you know but it's just a lot of food in 1 place rely of thinks which has a smell when you have to maintain it and 0 1 told me that the supply had too much magic on which you talk about assault because actually this this person I use a lot generator expressions which if he had to maintain or interesting to to but sometimes they are so another 1 this Convention point right so a big thing about about what services libraries is you know you have all validation like you need to give what wanna give the client scheme so the scheme so the client use validation before use any request to sending it over all of the bad you also need to do all of that same validation you know on the server side when you receive data and APIs and I think in Pybel both approaches by using Django goes excellent already existing code to do in the validation which is the form of the form code right so you create a form and you check your inbound data gets formed scheme and this format like schema right so you can say 0 this is not tight correctly yeah they'll send back however you want but after we're done it for us like number like using forms to validate like Jason data coming in from API it's not specialized that purpose it's that kind of specialized to the purpose of handling like form inputs right so that things like say you want to help the air masses of the form generated from validation because of the problems are yet the some funky stuff like in there and can get the get that there's no maybe I can get like simple text out the 4 or sometimes I or maybe there is no I think there is actually and 1 . 7
13:48
the part so we were on these problems we know what to do the so many options and then and now we have a new engineer come to us and we are simply what you think about generous framework like is cool and to my knowledge told us that he thought it was cool and because his new engineer I think we want to really look at is input on because new people the team him good so we took a look at a reference and turned out that it was lost was actually asked so I
14:22
actually had to break up a list of great things about gender was from into 2 parts because there's so many things like that idea relieving these are actually much up and I put this on the top so the order and this is based on the it's for arbitrary right but not number 1 thing about gender was from the irony love that we have found is how well documented it's like you go to the site today you don't need it in a talk about gender I mean you should if you're interested but you don't need to read anything but the docks to really get up and running and also beyond that to really go deep and understanding how part of part of of work so it's very well done and the creator is very attentive on StackOverflow form asking questions if you will be and you know you are embodies ever know what the person you see about doing framework is houses also my age breast if you had grounds the if I listeners are it right but then was framework it creates this HTML the you that you can access the human being that shows you information about the it's also on I don't know of really numbers you my list but it's it's something that really likes me for stories right but some real stuff like but where we would we really find useful and out of the box pagination in this filtering feature has were really useful to us as we were upgrading some world API that we upgrade a bunch of API Casey pi generous framework of and this came in handy and as a citizen an and a lot of olazabal but as manager of that API nothing Haiti faults but that's all there were a lot of pieces of that API that we upgraded that were very poorly performing in in them and you could look in but we get the alerts in unrelated facts view it is crushing the server like so much RAM cities was stuff and we try to fix it and you know we get somewhere in here and there but the happening more with our generous framework the version so the it's more complex than always which generous framework we have many problems anymore so we made some changes based on what we learned was working about so I think it's my perception that performances live better jail spring and so that who wants it it supports Token off of the box which is just a 620 give up running with talking about like . drop and it's going to work the but there's more there's more so it is very easy to customize output from your API including resource selection some restaurant that we have a single resource and they relate to each other and it's easy to use it all up and get it the way you wanted the Urals right river with these explicit serializer classes so they might generous framework is you end up with a bunch of composed objects right so you have you're being in a has a serializer has a filter class yeah it's not just 1 big class that everything is composed into pieces and makes sense there's separately testable reusable in different contexts and 1 of those things is a serializer broken musical thing so source validation you have survived validation different stages of a lot of people we use validation routines in the model classes to do validation so the great thing about generous framework is when is creating something API it will call clean under models you can stick all your business rule validation for clean and use generous framework will use that you don't have the abstract in something else and then that you use that attack and call it from here full cleaner whatever it's just speak but it where it sort belongs and it will get used which is nice and the best around here but it's community itself is very active very helpful we have found which is very very important and the obviously and you know more about like the right we perceive it to be and that's important this is Python our perception of beauty in our team is actually you know high criteria kind of important thing to us and looking at the code Prosser looking at what we got out of that you know what is our API code actually look like we find it to be elegant we find it to be extensible and then that makes us happy every so 1 and related your API representation the being pretty concise and it's know this is unimaginable myself but anyway you end up with is like I said it's a bunch a composed objects so it in size in the sense that here's this 1 API it looks pretty small when I look at the high level of you write minimum to go down and look at the individual composed classes like the filter or whatever and they are in you can expand up into multiple classes but it's nice to build a CD concise overview sort of at the at the top level the the class the most action so that in but I you know going to say that it's the best thing on earth you know that everything has a couple flaws or whatever these flaws we thousand columns and so 1 thing that we really miss about the supplier is there's no built-in schema generation were group so well points can always cover that stuff and we have to maintain our own schema which is pretty common no and when you have an API I guess but I don't really like and like having to go in and like I change the thing and maybe of variety of England but did the schema file and you that's fine then we we have a client that I can read this schema and knows what to do with it like in in-house rest quite so that's the thing maybe someone will release some packages that is for on there and I will have to help but in the case of a lot of would like thank so this is the mothers right I've read usable . I either removed or put on every single 1 of these sections that the book boilerplate I think that's just program you actually have like coded with the latter were library you choose right so they were going so well by exposing filtering mechanisms we found can sometimes be convoluted and I think there's different things going on here raise generous remedies this thing that is the ability of filter results in the oral and it kind of feels me it feels a lot like here filter primary pass into the gender or right but it's not really the same and and there's a little bit cognitive dissonance there I think I any idea you you can have to do some suffix expose these different types of filtering options with your else so the and so inform you that the marginal fields are real which I don't think it's going to be a game changer in your problem by defaults yet you do some overrides any can we do sets of related fields are related objects but you have to do so yet accurate encoding so sir all in some like the way they're louder translated and if not familiar with Router Router is is this thing you can use to like have um the CPI code you wrote for a book or books will say it returns impression of books and you can use a router object you like I automatically generates murals for of I would have some of that but you know were were diverse group total and give them the voice of the voice of engineering did not action like that how and so
22:33
normal social and here I think I will do a quick summary so sometimes you can get away with
22:39
playing Django view by often when I'm presiding will use just to use and then i if it turns out we're going something like we we go back and and add it you do it right with a with a library of which our starting in high tech it's a it might be easier just start with the library if the general service pretty simple set up so the but I wanna read emphasized that I don't think that his is bad and and you and that's you know the I was that histone it guys rolling you know was this library that I served with like packet Autodock work for all the digital publishing it was great you know is a good start so paved the way to seek the supply was a great improvement over piston you was always nice features and you everything depends on something else right you can take it up you know without starting here in all these libraries were below we learn generously work I think and learn a lot from taste Python lot from this end and other stuff and I can't speak for the author of the say I know how he figured out you know how to do this but I think we learn and we're using generous framework for Newark as because we think it's great who so let's take away I'm I'm 3 after the talking Anthony like questions you might have any of these points is ought to 40 chance so thank you very much you
