Problem Solve Like a Computer Programmer | Kyle Smyth | TEDxRPLCentralLibrary

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
computers are stupid we give them fancy undeserving names like smartphones smart devices but the truth is they possess no intelligence whatsoever at least not yet computers require explicit written instructions in order to do their jobs however you can guarantee that they'll do those jobs or die trying' I've been a computer programmer for most of my life a computer programmer software developer software engineer computer scientist it's our job to tell the computer what to do computer programming has not only taught me how to make computers work for me but it's also taught me how to make smarter decisions and how to be a better problem-solver when I was 12 years old I went to a computer camp and it was there I took my first introductory computer programming lesson after the lesson the instructor Adam challenged us to go beyond the lesson and to solve our very first computer programming challenge the problem he presented us with was to draw a diamond on the screen well simple enough right so that's exactly what I did I opened up a word processor I furiously typed in a diamond based off of some spaces and some asterisks is I copied and pasted that into a block of computer code then I told the computer fork or program to just show what I had done I went back to Adam I said look I'm done now Adam completely anticipated this cheeky solution because although I had done what he asked the computer wasn't doing any work I had done all the work the computer just showed what I had done so he ups the challenge now Adam says okay take what you've done but now you have to ask the user for input the user being the person running the program he says you have to ask the user for the length of the side of the diamond for example this diamon here has a side length of four on each side there are four asterisks now this completely changes things I could still use that cheeky solution but that would require require me to write or draw an infinite number of diamonds from one into infinity which is not very feasible at all and really wasn't what the challenge was about so we've defined the problem draw a diamond given the length of one of the sides but we have to reverse make sure we understand the problem so what is a diamond well it's a four-sided shape of four equal sides so it's kind of like a square on a 45 degree angle but it's also two triangles if you cut that diamond in half around the center line and mirror you've got a triangle above and a triangle below so now that we understand the problem bit better well now we can just open up our geometry textbooks right we could find out the area of a square the area of a triangle well maybe we could leverage the Pythagorean theorem C squared is equal to a squared plus b squared sine cosine tangent right wrong while that might work and yes triangle math is legit that is far too much far too complex of a solution to our problem and luckily for twelve-year-old me I hadn't even heard of the theorist yet so I had to work with what I had as problems come in and out of our lives we have a tendency to sometimes over complicate them or sometimes the problem is so complex that we just ignore it completely and pretend it doesn't exist other times will default to a familiar but ultimately ineffective solution however in this case the problem with this problem is that we don't fully understand the problem so a computer has no concept of space let alone a diamond and well a diamond to us is this shape that exists in blank space so if I go in back to that first example of that diamond I drew and I highlight it you know a simple control a you'll notice something on the left-hand side of the diamond that blank space is highlighted as well while on the right-hand side above and below it's not that's because on the left-hand side of that diamond there exists space as in literally the space bar because to us we just see a diamond but a computer has no concept of space for us we use space or blank space to separate words and numbers and symbols to provide context but the computer has no use for that so to demonstrate this a bit further I've replaced those spaces with the equal sign this space character exists on our keyboard just like any other character of the alphabet whether it's a number 4 or the symbol for the asterisks so by replacing those spaces with equal signs we notice something we're not drawing a diamond at all we're drawing a five-sided polygon that I like to refer as a sideways house so although the original problem is to draw a diamond the actual actionable problem is to draw a sideways house that appears as a diamond to us ok so now that we really fully understand the problem we can begin to break it down and we'll do that by going line by line so given an input of 4 that is the length of each side of the diamond line 1 is going to look like this free spaces and 1 star I've already noticed something three places three spaces plus one star 3 plus 1 is 4 4 is the length of each side of the diamond interesting let's keep going line 2 two spaces three stars line three one space five stars I'm starting to notice a pattern for each line the number of spaces decreases by one while the number of stars increases by two so we could deduce that the next line line four is going to have no spaces and seven stars and we'll see that it does so this is great we're halfway there but we already know that the diamond is just two triangles one reversed on top of the other across the center line we've got the top half of the diamond and we've got our center line so now we just work our way back in Reverse we add one space and subtract two stars and we do that until we get to a line that's three spaces one stars and equals two for the length of our diamond we have just solved our very first computer programming algorithm and just like your favorite cooking show the code has already been written so let's take it out of the oven and give it a taste so so this is a command line interface and although it looks old-school make no mistake this is one of the most powerful tools on the modern computer I'm going to run the program I wrote called Diamond Jas and give it an input of four and we'll see that there is the diamond we drew we can go down and show an input of two or up to 16 or could I get a number from the audience 32 great number and there is the 32 diamond of length 32 in all its glory and and just for the sake of going big or going home let's draw a diamond with side lengths of 500 and see what happens I'll have to zoom out on this bad boy here and they'll air we see it the diamond in all its glory amazing so it wasn't until much later in life that I realized the significance of a simple problem like the diamond one in industry with complex systems like Facebook or the Falco SpaceX Falcon 9 rocket in those complex systems there exists millions of very small problems not all that unlike our diamond one those small problems make up the much bigger problem of connecting billions of people together across the planet or landing an autonomous rocket that's already been to space down onto an autonomous barge floating in the middle of the ocean my company was recently we recently finished a project for a customer in order to close a deal the customer required some additional functionality out of our software to make it useful to them we completed the project the customer was happy but I wasn't I figured we spent too much time catering to their needs that our precious development schedule the things we had to do were push back and it wasn't worth it that was until I took time to break down the problem well how much did this actually cost us so we spent about 40 development hours and eight sales in project management hours so really the project only cost us about twenty four hundred dollars to build which really isn't all that much money especially when you consider the deal size map deal was worth $480 per month recurring indefinitely so if we can assume that that customer stays a customer for six months we make our money back that's a great investment so we also gain a valuable relationship with a customer because we delivered on that promise and that feature we made for them was made in a way so that our existing customer base and our future customer base could take advantage of it now our development schedule did get pushed back which is what worried me initially but given or now that I could see all the variables in front of me the pros clearly outweighed that one con now not all problems are as easily quantifiable as financial ones I'm a runner I'm training for my first full marathon this fall the worst thing about being a runner is when you're not able to run and unfortunately just a few weeks ago I was diagnosed with a stress fracture which means no running for four six months you need six months - sorry the marathon is in six months and you need about four months to properly train for a marathon so six months - four to six months is equal to not enough time however is the is it that I can't run the problem the real problem is that I can't put any excess pressure load or tension on my left leg so what if I could run without touching the ground I'm happy to inform everyone that I've recently taken up the sport of aqua jogging and yes it looks as ridiculous as it sounds aqua jogging is moving in the water in an upright position that mimics running on land and can result in similar physical metabolic benefit as running on land and if it's on Wikipedia it must be true so I'm combining this style of training with a regular cross-training gym routine and a stationary bicycle and I think it's going to pan out if you'd like to see how I how I fare feel free to look me up online for race results for the Queen City Marathon 2019 and I hope you don't find I did not finish next to my name the hardest problem that I've ever been up against is something called anxiety and depression and I regret to inform you that I have not solved this one yet in fact I might never solve it but if I can take this really complex an abstract problem and break it down into manageable pieces well maybe I can make that overall problem suck a little bit less did I get an adequate amount of sleep last night did I get my daily aqua jog in is it that I'm not hungry or is it that I have anxiety surrounding the meal preparation process these are just some of the questions and tools that I use to check in with my condition so if you want to make smarter decisions and be a better problem-solver approach them like a computer programmer would define your problem make sure you fully understand the problem break the problem down into small and manageable pieces go as deep as you can until you can get to easy yes-or-no questions work your way up from the bottom until the problem is solved but most importantly recognize that some problems are completely out of your control and they'll be impossible to solve and that's ok if you can make a really big problem a little bit easier that's a win in my books [Applause]
Info
Channel: TEDx Talks
Views: 79,756
Rating: undefined out of 5
Keywords: TEDxTalks, English, Technology, Behavior, Brain, Computers, Entrepreneurship, Mental health, Software
Id: x77-gT8bWLo
Channel Id: undefined
Length: 14min 28sec (868 seconds)
Published: Mon Apr 15 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.