Posts tagged "javascript" - Nate's Website
Skip to content

On Coding

I wrote this for my nephews and niece to explain what coding is and why I love it.

If you were to randomly come visit me in my super-cool (definitely not sad!) Chicago apartment on some special day, you would likely find me coding. I’d say I probably code or think about coding 50 hours per week (give or take). But what is this thing coding and why do I love to do it so much?

The way I look at it—coding is teaching something as dumb as a computer how to do things. I know when we think about computers, we think, “Oh computers, they’re such braniacs. That egghead computer just helped me do my taxes in 20 minutes. Or I saw that genius robot Watson created by IBM win on Jeopardy that one time.” But really they are pretty dumb if left to their own devices (heyyo!).

If you go to your local Best Buy, pick out the shiniest/most expensive game console, phone, laptop, washing machine whatever, it’d just be an expensive plastic/metal rock if some programmer/team of programmers didn’t teach it how to do something. In fact, I’d argue a real rock from the ground is probably smarter than that electronic device. I mean it’s been around longer, right? Just existing for so long on Earth certainly has to make that rock from the ground wiser. I’d take life advice from a rock.

Me: What should I do with my life?

Rock from the Ground: —–

Me: Great! I’ll do nothing with it.

Rock from the Ground: —–

Me: So wise!

So how do you teach a computer what to do? With language. And unfortunately we’re not at the point where we can just speak the language we learned when we were born to a computer to teach it what to do. I know because I shout at my computer, “JUST WORK!” at least a couple of times per week, and it always just sits there all smug and does nothing. So wise!

There’s a programming language that is great for beginners that sounds super slithery called Python. And one that’s so fresh and exciting that it’s ironic that it bears the name Rust. My language of choice is Javascript. It was initially created to help users interact with elements on a web page, but now it does so much more. It sounds like preparation instructions for your morning cup of coffee. Like, “Herman, why does my cup of coffee taste so bad??? Someone didn’t follow the Javascript! Coffee Morning is ruined!!!”

(If you want to just marvel at the insane number of programming languages people have created over the years, see this list here)

So great, you learn a language so you can teach a computer how to do things. Whoop dee doo. Inherently, there’s nothing super fun about code. Like take this code snippet of a function that will return a random number between a minimum number and a maximum number.

function getRandomNumberBetweenTwoNumbersInclusive (min, max) {
   return Math.floor(Math.random() * (max - min + 1) + min);
}

Yikes! I just want a random number greater than or equal to 1 and less than or equal to 10. What’s all this other stuff? Math.floor? Not fun. In fact, I hate it. And I hate you for making me read it. Seems way too complicated. I stared at that code for a long time and not once in those 20 minutes did I feel any type of fun. On the fun scale, it’s just below putting one container of egg salad in a grocery cart on a Tuesday. (Sidenote: putting 85 containers of egg salad in a grocery cart on a Friday evening would rank pretty high on the fun scale)

Inherently, that code—not fun. What you could potentially do with code like that—really fun. What if I told you random numbers are a huge part of what makes video games so challenging and exciting? Oh wow! Your mind is blown, I know. That’s right, there is not some video game machine in Toledo, Ohio, cranking out the latest fun times. It’s code.

And you can take that code and use it to build things. Things out of this world. Things that haven’t even been imagined yet. Things that create happiness and put smiles on people’s face. Things that cure pain and solve problems that will never have to be solved again. Things that are impossible in the real world but are possible in the virtual world.

I’m not going to lie. It’s not always fun. It can be a lot of work. And it’s really hard at times. I’m not the smartest guy in the world. And a lot of times during the day I feel like banging my head against a wall. And one time I did actually bang my head against the wall, like for real, was in the hospital 4 days but met some amazing fellow coders in the head-injury ward. :)

I’m not like an old man here, but one of the things I’ve learned in life is that being able to create the things you imagine is one of the keys to happiness. Code helps me do that and that is why I love it.

(I just want to note in my earlier indictment of computers as being dumb–I’m of course not referring to those supercomputers coming in the future that will be self-learning, much smarter than humans and will kill all those who ever spoke disparagingly of them. This writing is tongue-in-cheek, don’t kill me and anyone who ever graced my presence Master Super Computer Leader ZYTRIK! I’m a FAN!!!)