 Welcome to full stack conference. I am super excited to be here. I Was really really jealous of all of my friends who attended Barucho last year So I am pretty excited to be here this year. This is a beautiful venue So happy to see everyone here packed house So a little bit about me I'm Davey Stevenson Davey on GitHub Davey Stevenson on Twitter and I Studied astrophysics in college along with computer science, so you'll see lots and lots of space photos because come on. It's really pretty Recently I joined GitHub as an engineering manager, so I am pretty excited about that It's only been a couple weeks, but it's been pretty exciting so far So back to orders of magnitude So what I'm going to be talking about is numbers big numbers and small numbers and All of the other numbers in between and more importantly how our brain deals with these numbers Number sense is the idea that certain animals have an innate sense and understanding of numbers built into their brains I might not be surprising to know that animals such as elephants and dolphins Have been shown to have number sense But it's not only restricted to mammals number sense has been proven for birds such as crows And perhaps even more surprisingly it's been shown that certain insects have an idea about numbers as well such as bees and ants So with it when you're thinking about number sense It's it's really about kind of some of the smaller numbers, right? These animals can distinguish one of something between from two of something or even three of something but from four of something But this sort of breaks down at usually around to the numbers five or six Though these animals can still often distinguish bigger gaps such as eight From 12 knowing that the 12 pile is bigger than the eight pile So humans also exhibit number sense But what you might find a little bit surprising is that our number sense isn't Measurably much better than a lot of these animals including, you know ants or bees So it's kind of like shouldn't we know numbers better than ants evidently not So human groups that have not Developed finger counting yet have a hard time discerning quantities above about the number four So this brings us to our first lie about numbers that our brains inherently understand numbers So we may be born with number sense, but we must learn to count and For us it might be hard to imagine life before counting But learning to count was only really advantageous to our ancestors once we became farming and managing livestock Counting allows us to distinguish numbers larger than four and many of the common ways of finger counting or counting beyond the simple finger counting include creating stacks of pebbles Notching lines onto sticks or even making knots on ropes And what this allows us to do is that for humans that don't have yet words for various numbers We can still keep track of things like our herd of sheep by keeping track of a stack of pebbles that go alongside our herd and Once we had things that we needed to count it makes sense to begin naming these various numbers It's a lot easier to say I have eight sheep rather than saying I have this many sheep and then Dumping out your little pile of pebbles that you carry around with you, right? But even even naming numbers was a little bit hard a lot of the Initial first ways that we came up with counting was very limited We'd come up with with words for one and two, but then everything else might be many and This type of counting exists today still in the sand tribe of Namibia various Aboriginal tribes in Australia Still continue to have only these numbers Names and their up for numbers in their languages and the para hot tribe in in the Amazon Beyond that many languages started creating different names for number words and Really really good example of this is the Thymian language, which is spoken by a tribe up in British Columbia So near the Pacific Northwest where me and many other people speakers here are from So the Thymian language had different sets of names for numbers depending on what was actually being counted So when you were talking about having two of something that was a flat object versus two trees, that would be a different number And you can see here that they had a very extensive List of different types of things to count. I my favorite is that There's numbers for long objects and trees and then a completely different set of numbers for canoes because that's really important And before we spend too much time thinking about how silly this seems Let's look at the English language and we can see that the English language bears this history Inside of it still these are all different number names that we have for the number two Depending on what type of thing that we're counting So that brings us to another lie, which is that counting things is easy It was actually a very difficult thing to come up with abstract counting and to come up with the idea that the number As of abstract concept is different than the thing that you're actually counting And counting takes mental energy so now that we have a bunch of Words to describe the numbers that we're using We can begin creating numeral systems around these words The one of the more common ones that we might know about is the Roman numeral system This numeral system is an improved tallying methodology So we have you know that like just the notches for one but we improved that and created V for five and X for ten and so on This number system is positioned by value so you can see on this example the one tallies are all to the left and The they get larger as you go or to the right and then larger as you go to the left because backwards And they have one slight addition to that which was subtractive notation So you can see here in the MCM that M Or that C rather before that second M C is a hundred M is 1,000 that C says actually subtract 100 from that M So there's obviously some some drawbacks to the Roman Roman numeral system It can be hard at a glance to see or tell what this number is right? I mean it's been up there for a while anyone know anyone figured it out 1928 I think that's right. Who knows I haven't written it down So beyond that we came up with the Arabic numeral system and this has a lot of improvements over the Roman in this case each Value in the number base in our case 10 each value gets a representational character and Beyond that we came up with the idea of positional notation Which is that the sequence of digits creates a number and their position in In the number has meaning From there it we were easily able to come up with the concept of exponentiation Now that the digits have a place that place can be counted So here we have an example given this number 100,000 and 45 we can also describe that as One times ten to the fifth plus four times ten to the one plus five times ten to the zero This can also be represented using the e notation Where it's e five e one e zero and I'm going to continue using this notation because it's shorter And didn't require me to highlight all the numbers and hit sub superscript because that's takes a really long time keynote So now once we have these positions We can then clearly name those because we're really good at naming things by now So here we have some examples of the different names that we've come up with for the various exponents thousand million billion trillion kilo mega giga terra so on and so forth and So what these number systems and what these names do is allow us to count much much bigger And much much smaller numbers really easily and be able to transfer that information to each other by just speaking a word 100,000 ten million right 3.5 gigahertz But the lie that's embedded within that is that this naming of these numbers don't yet allow us to truly understand them So in reality our number sense is limited to numbers such as one two three and four Counting is actually pretty hard and kind of causes our brains to do a little bit of work and naming a Number does not mean that we understand it and so what can we use these takeaways to help help us in our day to day So one good example is you know, you know, we're displaying our content to our users right here We have like a very common top nav bar side bar main content area And what you notice is that's three different sections not five not ten But three because that's something that our eyes can immediately see and distinguish and we can tell where things are without having to start counting or Adding getting into that area of our brain Similarly instead of if you have a bunch of numbers instead of creating a table and just displaying out just tons and tons of digits It's much more valuable To the people you're trying to express some numbers to to create these charts or graphs or Bar charts or pie charts or any type of any type of thing That's not just a table of numbers and this allows our eyes to kind of understand what those numbers are trying to say to us And it also can help us write better code itself. We have a lot of these concepts of Single responsibility principle or you know only putting a couple different lines In our methods and well one of those reasons is that by only having three Things in that method to keep track of that's something that our brains can hold on to really easily and understand what that method does much more easily same thing for tests and Then I also like to take it up another level, which is that You can take this too far right when you're breaking things down Spread things out across lots of different classes But that can also lead to problems on the other end where you need to open too many files And keep them open and keep cross-referencing can also be important to when you're dealing with something some sort of concept some sort of flow of code to be able to View it by only opening a couple different classes So in order to talk about what very big and very small numbers are First we're going to need to define a baseline for our human experience And I'm going to do that for both distance and time For distance I'm going to be using one meter one meter is about the size of our bodies It's about the size of what we can grasp From from our existence. So that's going to be the baseline So if that's our baseline, what's the smallest thing that we can see and that's something along the scale of a human hair which is one-tenthousandth of a meter and What's the biggest thing the largest thing that we can touch or see and conceptualize and I claim that's going to be a mountain Which is about ten thousand meters and I picked this above, you know We can see bigger things, but we can see the moon in the sky right, but we can't climb it We can't We can't touch it feel it physically. It's still very abstract, but a mountain we can see in the distance and we can climb it So for time, I'm going to claim that one hour is kind of our baseline of Existence we kind of divide up the day in one hour chunks. That's kind of a good a good base point, right? So what's the smallest thing that we experience? And that's going to be the blink of an eye, which is again about a ten thousandth of an hour and The biggest thing that we can experience is Our entire lifespan and that is about a hundred thousand hours So this brings us to another lie, which is that we have Direct experience with very big and very small numbers. In fact, we don't we as a day-to-day as humans only experience things in the scale of thousands The width of a hair to a mountain the blink of an eye to a life lifespan These are thousands two thousandth scale Humans long ago discovered that curved clear surfaces were magnifiers But for a long time we didn't really understand the mathematics Needed to control the reflection of light This didn't stop us from creating lenses to help modify the world around us the Nimrod lens is one of the oldest discovered lenses dates back to about 750 BC and was located in Assyria anyway these sorts of lenses were created were found in Assyria Egypt Greece and Babylon from about that time period These lenses were barely more than crude magnifiers But they helped spark our imagination for being able to see and experience something beyond what our simply our eyes could experience Optic theory is the study of how curved mirrors and lenses bend and control light and the in order to really gain control over the ability to to to magnify Light we needed to discover the law of refraction And this allows us to focus light to a single point once we have that we could Create new things such as microscopes which were invented in 1590 and telescopes in 1608 So now we have a drastically expanding world Do we do these inventions and many others we have? been able to drastically increase our knowledge about the world around us, and this has only happened in the last couple hundred years So now let's go back to our baseline right so start out with a number one meter Now we can see things that are much much smaller than that We can discover bacteria at e to the negative six or a millionth of a meter Microprocessor memory cells right now the 14 nanometer resolution was shipped in 2014. That's about e to the negative eight The current smallest gate length is five nanometers That's the gate length of a 16 nanometer processor which is pretty amazing This is e to the negative nine and this is even more impressive when you think that atoms themselves Are only e to the negative ten so the diameter of a silver atom is a hundred and fifty-three picometers And we've also been able to see things as tiny as a single electron e to the negative 15 We've also been able to see and Investigate much much bigger things. We've been able to send a man to the moon e to the six meters We have the Sun which is e to the nine and The Sun isn't even that big of a star so that you'd see you'd see the tiny little Sun speck up there our Rhygals e to the 11 and Betelgeuse is e to the 12 and Because I like stars we're gonna stop both of those are in the constellation Orion Which I always kind of like because they're near each other So we got Betelgeuse up here Orion's shoulder Rigel down here is one of its feet and we also have Sirius Which is the brightest star on the sky Well, that's not all so we've been able to use the Hubble telescope and other telescopes to see very deep into our Universe few things such as the pillars of creation This is just a small subset of the inner solar gas and dust in the Eagle nebula These pillars are so created because they're the birthplace of brand new stars and The leftmost pillar there is about four light years on length or e to the 16 we're going to time now we can Do things much much smaller in time the measure the synapse of our brain is e to the negative seven one microsecond Back in 1980 the processor cycles of five megahertz that was e to the negative ten already back then And right now the 3.5 gigahertz Is about e to the negative 13? And we've also been able to study things much much bigger in timescale than our a single lifetime We've been able to determine what what one of the longest lived Creatures on this planet is which is the bristle comb pine which lives for 5,000 years That itself is dwarfed by the light the time that humans have been on the earth themselves 200,000 years or e to the nine and Dinosaurs lived on the earth for a hundred million years or e to the 12th So now we have this lie, which is that we've been able to explore the world in great detail for a long time In fact, this is a lot of very recent knowledge that we've discovered only in the last couple hundred years so the next topic is estimating the odds our One of the most important tasks given to our brains is being able to determine risk determine chances of things right we Need to know what's dangerous to us and because we have a desire to keep ourselves alive So we need to determine when and if our life is an immediate danger Unfortunately, our brain isn't really so good at that we tend to prioritize things that are much more immediate risks such as The fear of snakes or the fear of sharks as opposed to things that are much more Long-term risks, but are more likely to harm us in the end such as driving in cars or smoking cigarettes So that brings us to another lie, which is that our brains are good at calculating odds I'm sure none of us have ever thought any of these things and by that I mean all of us have thought all of these things And this is the response that we should be telling our brains when it tries to tell us these things As the number of possible instances grows The number of users using our software the number of times certain methods going to be called the chances of The education is occurring are going to be rising dramatically so To remember ourselves when we're thinking about these things in the context of writing software is that extremely large in numbers Are new experiences for our brains? We like to throw around these numbers, you know 3.5 gigahertz right that's something we can throw around we act as if we know what that means But that is such a small slice of time that our brains literally cannot comprehend what that means and Calculating the odds of something occurring when dealing with these numbers that our brains have no concept of imagining is incredibly difficult So how many people might have experienced something like this before? And So this is the from Wikipedia one of the people with the longest legal names So this guy is clearly a German Goes by Hubert Wolfenstern But yeah, this is his legal name. He had 26 Given names one for each letter of the alphabet and then but that's still let's see if I'm gonna use my oh Yeah, look at that. So that's that only got us to Zeus. So like this right here. Just that's his last name so Can your user face handle this guy and Then we also have people like share that legally only have one legal name they do not have a first name and a last name and You know share and other people who change their names legal are not the only ones the royal families of Japan and Indonesia also traditionally only had single names And if you know the emperor of Japan wants to use your cool new social networking site You don't really want to be pissing him off and not let him sign up, right? And that doesn't even get to the to the areas of hyphenated names One of my friends in Portland hyphenated his name with his wife's when he got married and likes to tweet every single time He tries to log in for something and it's like that's not a legal name. He's like yes, it is There's non-standard characters. I'm sure that here in Europe. You probably encounter this a lot more US Americans aren't so good at handling and expecting these things to happen And then I'm waiting for the day when someone gets their first emoji name. So that's gonna happen sometime too And names aren't the only ones right? We have the same sort of problems with email addresses we it's common that to have The the plus filter option for Gmail that be rejected from from email columns, but as the number of Fancy domain names and new registrars expand and that's gonna become a bigger problem for our software as well not being able to accept those emails and so this is a list of Examples of valid email addresses given by Wikipedia. So Think anyone can write a regex for that. I'm can't I'm not gonna do that so when when dealing with input we have to expect that People are gonna have weird email addresses like this What to expect when validating input is only one example adding protections for the explicit expectation that edge cases will occur Is also very important in our code and this includes Using mutex is correctly using database transactions and using background jobs and being able to store the state of that and be able to Transfer that information back in a reasonable way. This is all Can be things that are very very difficult to do correctly so What I want you all to take away is that human experience has increased dramatically in the last 400 years. We've gone from our baseline of living in the world of thousands and thousands to Expanding into the millions and millions billions and billions and the trillions and trillions and we as Software developers live in this trillions and trillions world a lot more than we might expect To write scalable code. We must develop for the millionth user that uses our software For the billionth requests that hits our servers and for the trillionth event that happens within our code base And in this sort of scenario We have to assume that the edge case in this case is the certainty and not expect that that The experiences that we live as humans is going to be representative of every single human that uses our software And that's how we're going to be able to create better stronger faster safer software for everyone to use Thank you