How to Get Your Start in Coding

Some tips for anyone looking to begin a programming language.

If you’ve been following In the Aggregate recently, then you saw that I recently learned how to build apps in Shiny. For me, this was a tremendous accomplishment, with apps being something I had marveled over since I started working in the fantasy space six years or so ago.

Something I realized while creating the NBA Sim App was that it was not a particularly challenging assignment in itself. Sure, it required me learning something new — and grinding through that learning curve — but the main barrier of entry was my own intimidation that this would be too intricate for a novice such as myself.

With that in mind, I wanted to put together some tips for those of you looking to get into coding. My experience is in R, but these concepts should be applicable regardless of language.

1. Just Get Started

When I was writing at RotoViz, the email chains were legendary. Multiple reply-alls to the same email, difficult-to-monitor conversations, and the background anxiety that comes with being unsure if everyone got your reply (Do they not think I’m funny? Did that email suck? Oh no.). This was before Slack made life easy for everyone, and you could actually keep track of your interactions. Ah, the good ole days.

Anyway, coding and R Studio had come up a few times in the email chain, but none of us actually knew what we were doing, so the immortal Fantasy Douche set up a GitHub to help get us started.

The first example he created allowed us to scrape a PFR table into R Studio, do some manipulation, and finish with, of course, a visual. I had never felt so powerful. Of course, this was not particularly instructive on its own — I still had no idea what 90% of the words meant — but it opened my eyes up to what was possible. When I started working with bigger data sets that required me getting away from Excel, it was easier to dive into R with enthusiasm.

One of my favorite quotes is from Chinese philosopher Lao-Tzu, who said, “A journey of a thousand miles begins with a single step” (oh yeah, we’re getting deep today). You aren’t going to be great at coding right away. I’ve been working on different projects for a few years and still have learned maybe 10% of things I’d be interested in doing. But throw your hat in the ring. You’ll be glad you did.

2. Find Projects That Interest You

While I’m sure there are plenty of quality courses out there that you can take to improve your coding skills, I recommend learning by doing. Unless you are using this immediately for your professional career, there is no reason to be classically trained in my opinion. Find something that you would like to do in your preferred language, and then set out to do it.

This will make all of your time learning more productive, as it will be goal-oriented. It also will likely be more fun as a result. You can pick up the nuances of coding along the way. Building real, tangible object will hold your interest and keep you coming back for more.

3. Ask For Help

The coding community is pretty great, and there are tons of resources on the web to help you find the answers to any question you may have. Sites like Stack Overflow serve as a Yahoo Answers kind of environment for your needs, and don’t sleep on the documentation for packages you may be using as a part of your code.

If you know anyone who is proficient in the language you are learning, don’t be shy about asking them directly for assistance. In my experience, people are extremely willing to share with those set out to learn. Drop me a mention or DM if you ever want some help in R!

4. Don’t Be Concerned About Writing ‘Good’ Code

The one issue with sites like Stack Overflow is that the coding zealots come out from the shadows and tell you your work sucks.

Don’t listen to the haters! Writing “good” code is a lot less important than writing code that works. Find what works for you, and build on it as time goes on. For instance, I scraped a ton of college football data years ago, but lost it all when my computer crashed. Now I’m working on an even better, cleaner scrape using all that I have learned.

Many of my friends (namely Matt Jones) like to make fun of me for using Base R instead of the Tidy functions, but I'm here to tell you that Base R rules, and all of the functions make sense to me. I will continue to use it.

5. Save Your Code

This is perhaps the most important tip unless you want to look up how a function works every time you use it. GitHub is always an option for this, but I just have a bunch of Google Docs holding code I’ve used for various areas.

In addition to saving you time in the future when working on a new project, keeping code someplace safe while you work can help you recuperate data lost through errors. There is absolutely nothing worse than grinding on a project only to wipe out your entire data frame with one key stroke, requiring you to start over.