 come on in we're gonna get started so this year has been got a little bit of feedback a little bit different on the organizing I kind of the metaphor I use I like metaphors so metaphor I used was like a greatest hits I wanted to get like all the hits back together some of our favorite sessions and speakers and bring it back and kind of see where everyone's at now and and you know and all the best greatest hits albums there's always the one new song and so that's Davey Davey's never speak spoken but she's awesome and she's gonna speak to us next so thank you for coming and being our our plus one reason to buy the album awesome well thank you so much Mike Mountain West has been a conference that's been on my wish list for a long time never worked out before this year and I'm just so happy to have been able to be a part of the very last Mountain West Ruby so I am from Portland Oregon our slogan is of course keep weird and I'm keeping it weird with the feedback and we have the smallest park in the world right here it's one of my favorites I've taken many people who visited Portland to this park it's in the middle of the street so you kind of have to like dodge cars to get there I think it's worthwhile we of course have Portlandia which is about 50% document testing testing okay so Portlandia mostly a documentary this of course is one of my favorite sections of Portlandia putting a bird on everything since 1999 I do my part to keep Portland weird this is my cat Kamaji he goes for walks he loves going for walks very gregarious he's also on Twitter not quite as famous as Gordy Puff though maybe one day I came by yesterday at the conference and I decided to wear contacts instead of glasses and had at least two or three people have no idea who I was so today I'm wearing my glasses so you can all remember me and yes that did make me feel like a superhero I work for GitHub I am an engineering manager for the team that works on the availability and performance of the rails app it also means that I have stickers lots of them so if anyone wants some stickers come find me afterwards there's a good cow one unfortunately we have retired all of our copyright infringing stickers so we won't get sued so no more of you know Zelda sticker or Rainbow Dash sticker I'm sorry I don't have any of them GitHub likes to stay in business and not get sued out of business okay so on to my actual talk so I title of this talk is orders of magnitude and the concept is that I'm gonna be talking about numbers big numbers and small numbers and a bunch of numbers in between and more importantly I'm gonna be talking about how our brain conceptualizes and processes numbers so number sense is the concept that certain animals have an innate conceptualization of numbers and counting and built directly into their brains and they don't have to learn about numbers it might not be surprising to think that animals such as elephants dolphins many of the great apes have number sense but it's also been shown the animals such as birds have number sense and even insects such as bees and ants show us the ability to be able to tell the differences between numbers and so what this usually means is that they can tell the difference between one of something versus two or something they can even tell the difference between three and four oftentimes it tends to break down at around five or six but then often times animals have the ability to differentiate between sets of numbers that have a bigger difference such as like eight versus twelve what you know we also might expect that humans have number sense right we like to think that we're pretty good at this whole counting thing but the science shows that we're not actually that much measurable be better than any of the other animals that we study tribes that haven't developed finger counting yet oftentimes have a very difficult time determining differences between numbers of above about four and that is you know kind of surprising so this brings us to you know one of the first misconceptions that we might have about our brains and how we process numbers which is that you know our brains don't actually inherently understand numbers beyond one through four so we are born with number sense but we must learn how to count so it's hard to imagine life before counting but learning to count was only really advantageous to humans once we started farming or herding or managing livestock that was kind of when you needed to figure out how many sheep you might have and so the we were using think we invented things called like finger counting tallying via stones notches on sticks or knots on rope to help us manage these numbers that were bigger than what we could understand ourselves so you know now that we we don't we don't have words for these numbers but we are able to keep track of our flock of sheep by keeping a pebble in our pockets for each one and before you think that this is like a really naive or simplistic way of managing numbers the Incas managed to keep track of a vast you know civilization based around you know vast numbers of numbers by using what was known as rope counting or keeping knots on string in order to keep track of the currency or the you know the values they were having to deal with within their civilization so once that we figured out that we needed to count then the next step was was determining that maybe we should have names for these number things it's easier to say I have eight sheep and saying I have this many sheep and piling out your little pile of rocks from your little pouch and initially many of the first number systems only had names for you know numbers such as one two and many tribes that exist today that still have only these numbers represented with words are the sand people of Namibia the various Aboriginal tribes in Australia and the Paraha tribe of the Amazon the next thing that we kind of see is having many different names for the number words so an example here is the Thimshian language which is a tribe up in British Columbia and they had completely different sets of names for numbers depending on what you were counting so if you're counting flat objects you'd be using a completely different value of three than if you were counting men I also particularly like that they had a whole different set for long objects and trees but then canoes were completely new this category so canoes were very important to them and before we start thinking that this is incredibly silly the English language has the history of this built into it directly so we can see here we have many different words for the number two and this is kind of a relic of even our own ancestors having this sort of thinking when dealing with numbers a brace is oftentimes used when you're like a brace of horses to run a cart that's one use of it so a paired set of animals so that brings us to our second lie that counting things is easy even coming up with the names for numbers is difficult and that the names that we use to count can vary wildly so abstract number counting is actually kind of a difficult thing to discover and counting takes mental energy so now that we have learned how to count and we have words to describe our numbers the next step is to create numeral systems we all of course are familiar with Roman numerals system which is an improved tallying counting system their main the main points of this one is it's positioned by value and then also has subtractive notation in that so that's one one advancement over pure stick tallying the main problem here is that it still takes a little bit of time to analyze what number is involved who can say what number shout it out 1928 but you have to do some counting and ordering in order to gather that up so that still takes a little bit of mental energy next we came up with the Arabic counting system and this one I was a little bit different because in this numeral system each number base gets a representational character and then we have positional notation where the sequence of digits themselves creates the number and we find this to be a lot easier to parse and understand what number we're coming up with once we had this positional notation system the concept of exponentiation followed quickly after now that the digits themselves have a place that place can itself be counted so here one of our the common ways we reference exponential notation here is by using a 10 to the power another way to reference this is with e notation where e rep completely replaces the 10 to the and from now on I'm gonna be using this notation mainly because it's shorter and I don't have to do the subscript which is kind of irritating to do in keynote so e from now on out so we also have discovered determined names for these different positions as well and of course we couldn't stick to just one naming condition we have multiple so still continuing on our trend of you're naming things multiple times when only one could do numbers of systems allow us to count bigger and bigger numbers and much smaller numbers as well but that brings us to another lie which is that naming these numbers does not necessarily mean that we understand them so to recap humans have number sense but that only helps us up to about number four counting is hard and naming doesn't equal understanding so how can we use this to apply to our day to day life right we're all programmers and so far I've just been telling you the history of numbers well one common way that we kind of all already do this inherently is to you know block out our web pages into different sections right it's a lot easier to understand a web page and navigate on it there's only three sections rather than 17 that keys into our inherent number sense to be able to determine the different sections so here I have you know a header a right column and then the main body another way we can help ourselves is to instead of having a table of numbers just graph it create a visual that allows you to understand the relationship between the numbers instead of having to scan through a table of numbers and try and parse that information that way it also helps impact some of our design philosophies the sort of the idea that each method should only have a certain number of lines within them that also keys back to this concept of number sense there's three items three things that this method is doing one after the other easy for our brains to immediately see that and understand that as opposed to if it was doing 15 things in order and this of course can apply to good testing behavior too I think that this also applies to sort of our object hierarchy it's a lot easier to understand the flow of what's happening where if you only have a certain small subset of classes to look at and if you can open them up in your editor all next to each other we want to try and avoid that class that Aaron showed us yesterday with 10,000 ancestors that's gonna be a little bit difficult to deal with and speaking of our dear friend tender love he said something yesterday that is really important when understanding this concept right a number is meaningless to me I need to know the class name and so that's you know again referencing that having something a name a text string to be able to understand rather than just referencing some random four five six eight digit number that's going to be a lot easier for all of us to understand so in order to talk about what really big and small numbers are first we need to create a baseline for our human experience and so I'm going to be doing this for both distance and time for the baseline of distance I'm going to be using the default value of one meter that's you know approximately the size of a human about how far you can reach within your space around you so if that's our baseline what's the smallest thing that a human can experience and then and that is about something about the width of a human hair and that's going to be e to the negative four and the biggest thing that we can experience is a mountain a mountain is something we can see in the distance but it's also something we can climb we can physically walk the entire breadth of it and understand how large that is and that's about e to the four for time I am going to say that the baseline of human experience is about one hour you know one minute seems like way too short right like one hour we block our things into one hour or half hour time chunks that's a good experience like central experience of how we experience time and in that realm the smallest time that we can experience is the blink of an eye which again is about e to the negative four the biggest thing that we can experience is of course our own lifespan and that is about a hundred thousand hours or e to the five so this brings us to another lie that we have direct experience with very big and very small numbers you know you could see that the common thread with that was it that the our experience is from the width of a hair to a mountain or from the blink of an eye to a life span those are in the thousands two thousands range which in the grand scheme of things is not very big or small so humans long ago discovered that clear curved surfaces magnified and distorted light but we did not really understand the mathematics behind it for a while later that didn't stop us from carving lenses in order to try and magnify the world around us so this is the Nimrod lens which dates to about 750 BC and these lenses were have been discovered in areas such as ancient Assyria Egypt Greece and Babylon these lenses were barely more than crude magnifiers but they were kind of the first ways that humans were able to experience things beyond to what our naked eye would allow us optic theory was the study of how the light bends when going through mirrors and lenses and the law of refraction was required in order to really compute the shape of lenses that could drastically increase the availability of investigating the world around us so at about 1590 was when the first microscope microscope was invented and 1608 was when the telescope was invented and this of course allowed us to drastically expand our world beyond what we had previously been able to experience so let's go back to our baselines and see how much further we've expanded things since then when we're going smaller we were able to discover bacteria at e to the negative 6 the microprocessor memory cell right now is about e to the negative 8 the 14 nanometer resolution began shipping in 2014 the current smallest gate length of our processors is e to the negative 9 the size of a 16 nanometer processor and that's pretty fantastically small when you consider the atoms themselves are about e to the negative 10 and the electron is e to the negative 15 we're also able to explore things much bigger the moon is about e to the six the sun is e to the nine and sun is not even the biggest star that we've been able to study we have Rigel at e to the 11 and Beetlejuice at e 12 and because I studied astrophysics you're gonna get a quick lesson here so both the beetle juice here are and Rigel are in this constellation Orion here you can see Beetlejuice is the left shoulder of Orion Rigel is the right foot and then because the gods were kind to us they also put serious right here the brightest star in the sky so these are three of the brightest stars easily easily viewable it's also kind of cool to see both the red giant and the blue giant as you can see the colors here okay continuing on we've also been able to study things such as the pillars of creation e to the 16 these are interstellar gas and dust in the eagle mebula they are so named because this this massive gas is currently creating brand new stars and this of course is even tiny subset of a much larger consolation and collection of stars the leftmost pillar in this picture is about four light years in length so we can also expand our experience of time as well when we're going smaller we are able to determine that this a single synapse in our brain is about e to the negative seven in 1980 we created processors that at five megahertz which is about e to the negative 10 and our current 3.5 gigahertz processors are e to the negative 13 when looking at the bigger scale the current oldest known living thing on earth is a personal kong pine that's been alive for 5000 years or e to the 7 humanity itself has only been around for about 200,000 years or e to the 9 dinosaurs beat us out handily with their 100 million year lifespan or e to the 12th and so you know what is this telling us you know there's another big lie that we have been we have not been able to explore the world in you know this great depth for very very long this is only the last couple hundred years have we even been able to expand beyond the thousands and thousands so another thing that our brain is responsible for is to determine risk and estimate the odds of dangerous things clearly we have a desire to keep ourselves alive it's kind of important and therefore we need to determine what sorts of things are risks to our lives unfortunately we're not really good at this and tend to prioritize things that are immediate short-term risks rather than paying along paying attention to longer term risks here we we know what we have a very visceral reaction to the idea of being attacked by sharks or being bitten by snakes and yet we daily ride in cars or smoke cigarettes in the world of computing this we might think of this as is our concept around our nines right when we're talking about the availability of our software we like to couch it in how many nines we have referring to the number of nines past 90% of the availability of our website so we have one nine and that allows us about 36 and a half days per year downtime that's pretty easy I think all of us can meet that pretty well unless we're maybe government agencies so hopefully we're gonna start by by aiming for it the very minimum two nines which is still you know still 3.65 days per year down is kind of bad and she probably trying to do better than that so three nines three nines gets us to 8.76 hours of downtime in every year four nines 52.56 minutes five nines which you know is one of the biggest holy grails of services website services today that's only five just under five and a half minutes five and a quarter minutes a year down so what about nine nines anyone have an idea of how much downtime we'd be allowed if it was nine nines anyone want to throw something out it's gonna be 31.5 milliseconds otherwise known as 31 brain synapses in our brains that's how much time we would be allowed to be down we wanted to get to nine nines so this kind of brings us to another lie of course which is that our brains are good at calculating odds how many times have any of you heard any of these statements I think all of us have right and my answer to that one is no as the number of possible instances grows the chances of any of these things occurring are increased dramatically so we now have understanding the extremely large and small numbers are relatively new experiences to humanity as a whole and that our brains are really bad at calculating the odds of something occurring how many have you have experienced this sort of thing so now we're gonna talk about like you know what are the sort of edge cases here so this fellow Hubert Wolfstern is the man with one of the I think the according to Wikipedia the longest official name so he has one name for each letter of the alphabet but that only takes us to Zeus and then this is this guy's last name senior so thank you Germany do you think that your site can handle mr. Hubert trying to sign up which he can't because he already died but you know maybe he has another son junior and then of course we also have you know people like share who legally only have one name and celebrities aren't the only people that live following this category the royal family of both Japan and Thailand I think also traditionally only have one name so you know if the Emperor of Japan wants to sign up for your site maybe you should let him and then of course there are the people who suffer from dealing with their hyphenated names other funny unicode characters and then someday sometime soon maybe it's already happened there's gonna be some poor soul with an emoji character in their name so email is another common one in this in this realm right so we might understand like being able to parse and handle these types of emails with the plus sign as a filtering mechanism for Gmail or now that we have all sorts of ridiculous domain names that we can purchase but that's not only a part of it so this is an excerpt from the Wikipedia list of valid email addresses so you know do you think that you can write a regex that can correctly parse all of these I'm not going to try I would suggest you don't either and that's only you know this is not the end of what we have to deal with when we're dealing with edge cases and exceptions when it's also pretty important when you're adding protections for the explicit expectations that edge cases will be met by your software that includes using new texas to deal with possibly concurrent requests handling database transactions correctly so that you don't lose data or double save data and of course being able to correctly in Q and DQ background jobs it's also important when you're thinking about whether or not your test suite is really encompassing all of the cases that you need it to are you just testing the happy path deployments is your deployment process itself hindering your ability to get that next nine and when dealing with data bit migrations and you know are you your your customers data is gold to them are you tweeting with that level of respect to protect that information for them so human experience overall has increased drastically in the last hundred years we have moved from a realm of only experiencing things in the thousands two thousands range to expanding to the millions to millions billions to billions and trillions to trillions in order to write scalable code we must be developing for that millionth user billionth request and trillionth event and if you take away only one thing from this talk I would say that the edge case is the certainty don't think that that's something just because it's going to be very unlikely is not going to happen make sure that your software can accept that edge case and thank you very much that's a good question so how has an education in astrophysics affected my career one I was really really happy not to have to code in the programming languages that was popular in astrophysics so that was basically like Fortran so now like I think one of the the most interesting things about astrophysics was really learning about the ways that we as humans tried to just to learn about things beyond our own world when all you have to study is the photons kind of hitting the earth like how do you figure out what materials the Sun is made of or how far away things are being able to to try and figure out how to query that information from a very limited subset of data and being really creative about it is pretty amazing and I think that actually we do that a lot in programming as well you know we're dealing with with computers that are you know running on electricity right it can be incredibly hard to debug things that are going wrong in your servers when all you have possibly is a tiny stream of electrons flowing out of it how do we debug what's happening and understand what's happening within our computers with that limited amount of impression we have to be creative so the question is do you have a ways to try and calculate the risk of certain edge cases when you're programming and the answer to that is metrics record everything all the time if you don't have you know metrics on things when things are going right and when things are going wrong you don't have any way to do any sort of calculation or comparison or see when things things are happening poorly and that's something you know especially that github itself is very well known for and it still relies heavily on is storing information about every single thing that's happening at every layer of the stack and having something to create graphs again numbers are useless being able to see trends to see how things are changing even slightly week week over week or day or day is very important full set of logging or a statistical set of logging and that's so that's actually case by case there are certain areas where the storage requirements of full logging is not not feasible and so then you have to pick a percentage random percentage you know are you gonna log 10% of things that are happening or versus 100 so that's like again it's almost always case by case and what your particular storage requirements or abilities are a good question so that's the any you have a rule of thumb on balancing the cost of trying to manage the ever more increasingly rare edge cases as opposed to like the time that requires and again like all of that is based on each each project each company's particular use case what are the resources available and that's you know it's hard to give any particular answer right you want to be you want to be certain enough what was the phrase in Ernie's talk yesterday about the skyscrapers right you want to be relatively certain with the abilities that you have that that acceptably unlikely you want it to be acceptably unlikely that something like that's going to happen and that definition of acceptably might change depending on the size and scope of your project so question is do we use any process improvement tools like six sigma and no not really so the question is basically have I come across any resources that would help people play around with a relative scale to try and understand like the difference between million versus billion for example and no and I actually did spend some time trying to find something like that honestly like one of the resources that I've loved the most when kind of putting things into perspective like this is some XKCD comics I think that he's done a couple I think he did one on like currency and how much things were worth that was like really amazing and kind of bringing out the scale of those numbers so honestly maybe just XKCD I think that might be it thank you