Non-Engineering Guide to Programming

I know quite a few people who have expressed (mild) interests in learning how to program, but they just can’t get started. When asked why, the usual responses are along the lines of It looks too hard, or, I don't think programming is required of me, and I can always get someone else to do it, or I tried but don't get it. I completely sympathize.

This post gives the step-by-step. Skip down to see the cirriculum I used to learn Python, Matlab, and R.

Finding Motivation

In the case where one is not motivated, but still needs to learn how to prgoram, a prep talk from a friend might just be the fix. I’ll gladly tell my story — hopefully to inspire.

I enrolled in AP Computer Science in my sophomore year of high school, out of peer pressure. (I was recruited on to the award-winning math team at my school, which means that my teammates are mostly STEM-focused.) The class focuses on Java. I wrote good code for homework assignments, thanks to my somewhat logical senses. I tripped up on stupid, little things like workspace organization. By the end of the semester, I was still putting scripts in the folder of my first homework assignment. But to be fair, I had no idea what the “good” practice is like. Thinking back, it’s absolutely comical. It’s like I was this clueless kid shoving all of my Bio, Chemistry, and English handouts all in the same folder. I know, makes no sense.

But I digress. All went well until we started learning The Grid World — four scripts that made up this hell full of “critters”. The assignment is to manipulate and move the “critters” — these emoji-like creatures — in a grid. There are the side-walking crabs, the rocks, and color-changing bugs, if memories serve me right. The Grid World was my Brave New World. My grades suffered, my spirits low.

On a brighter note, I ultimately received a score of 5 on the exam, the highest score achievable. It came with tremendous stress and last-minute cramming. Despite the good news, I vowed to never touch programming again.

Fast forward 4 years, it was my sophomore summer at NYU. Job/internship-less, I went through an existential crisis. I was good at math and I should become a quant, so I thought. (And no, I’m not working as a quant now, but programming is still helpful for what I do, which goes to show the importantance and versatility of programming.) After doing hours of research, I felt defeated as the lack of programming skills can disqualify me.

I tried making every excuses to not learn how to program. If I were to become a quant, I’ll have my own programmers. Yet every single internship post I found requires at minimum proficient programming skills in two or more languages. My naive optimism didn’t last long. I finally decided to suck it up and learn.


Getting Started

Once one feels determined, getting started can be quite a hurdle as well. I was self-taught. I preferred learning at my own pace, and had enough discipline to follow my regimen. I made decisions on the details by asking myself:

  • What language(s) should I learn?
  • What resources should I use?
  • If learning multiple languages, in what sequence should I learn them in?
  • Will I get confused with the syntax if I learn multiple languages?
  • How to avoid that?
  • How much time should I devote to learning?
  • Do I want to learn the basics, be proficient, or master the language?
  • What kind of learning works best for me?

Personally, I decided to learn Python — an easy, accessible language that can be used for both scripting and object-oriented programming, Matlab — a good intro to mathematical scripting, and R — to brush up on my regression knowledge. If I must choose one to learn, it would be Python.

Because I’ve already been exposed to Java, programming was familiar. I had no trouble shifting gears learning the different languages, but if you find yourself getting confused over the syntax, stop and just tackle one at a time.

I found Learn Python the Hard Way, a treasure chest for those who want to ease into learning how to program. I also found the Coursera Stanford Machine Learning course which uses Matlab. It’s more theoretical and mathematical than Python, but certainly made sense to me because of my background. I quickly went through the Coursera Johns Hopkins R course. I knew most of the concepts already from a regression class at school, but it’s good to learn how to set up R Studio (and IDE for R programming) and my very own Github.

Juggling to learn three languages was quite ambitious and time-consuming. I learned in Python in just a week. I started the Matlab Machine Learning course simultaneously. The intro week was vanilla, so it wasn’t bad. I began the R Programming course after I finished Matlab.

I was mostly self-taught. I preferred learning on my own pace, which meant I can speed up on the trivial and take my time on the triker subjects. I had no desire to take formal classes at school. I didn’t have spare credits anyway.

If you prefer a more structured approach, I recommend in an intro class at school or on Coursera. Coursera is free, but certainly asks for more discipline than taking a formal class at school.


Python Bootcamp

My (in)famous 5-day Python bootcamp:

  • Day 1 Setups, numbers, math, variables, names, printing, prompting user questions. Assignment: Exercises 1-9, 11
  • Day 2 Functions. Assignment: Exercises 18-21, 26
  • Day 3 Logic and Boolean. Assignment: Exercises 27 - 31
  • Day 4 Loops, Lists, and Dictionaries. Assignment: Exercises 32-38, 39
  • Day 5 Object Oriented Programming. Understand __init__ and self. Assignment: Exercises 40, 41, 44, write your first OOP script
Matlab, Machine Learning

Stanford Machine Learning Course

R Programming

Johns Hopkins R Programming Course


Confidence

With practice, I became conversant in all three programming languages. Having understand the fundamental computer science concepts like inheritance, scope, and object-oriented programming, learning new languages will only be exponentially easier.

Discipline

None of this would be possible without discipline. When learning, I always set myself deadlines and goals to meet. I gave myself a week to learn python, whereas the Standford Machine Learning course was structured into a 6-week course, and R Programming a 2-week course.

I made sure not to miss any deadlines with homework submissions for the Coursera courses. I also typed the class notes in Latex. Some of what I did might seem excessive, but certainly helps me to stay grounded.

Beyond the Basics

Finally, finishing the book or courses is just the beginning. Real learning begins as you pound out lines and lines of code. I started an internship in which I had to use python – I learned pandas and numpy for data manipulation and analysis. Both packages are not covered in my intro studies. My code often didn’t run. I learned to debug. I found that most answers are answered on stackoverflow, but some questions required searching and reading documentations.

As one learns to program, one also learns to loathe the mundane, repetitive, and inefficient tasks. I wrote an attendance tracker that eliminates the cumbersome Excel work for my Analytics Club at school. The problems we face daily push us to learn.

Some inspirations:
» Is your inbox cluttered? Learn Python-Gmail API to better organize and file away emails.
» Ever find yourself download lecture notes from a school site? Learn web crawling. Why waste time and download the individual files?
» Research a topic you are passionate about using data analytics. Learn Pandas and Numpy.
» Present data finding in beautifully formatted GUIs. Learn PyQt4.