Programming advice for CS majors
This week, a classmate approached my friend and I to ask for advice in becoming a better programmer. We're all CS students, but my classmate, despite being a genius, claimed not to feel confident in his programming ability. I was flattered and wrote him this lengthy email. I figured others might like to read it, and would be open to any feedback or additional advice.
Hi! Let's just launch right in.
What's more important is deciding what you want to do. Python is a great general-purpose language, and you can do anything in it. However, more specialized languages exist out there--you're already familiar with Matlab, which is designed for scientists doing matrix shenanigans. (As evidenced by its 1-indexing, wtf.) If your desire is to program for the web, you can hack together a PHP script in a day. If your desire is to do nuts-and-bolts system programming--interacting with the hardware itself--then C and C++ are your game (which may be useful to learn anyway, as you need them for class.) C# (or something) is what they use in game dev. Java is your only realistic choice for Android apps; likewise for C# (I think?) and Swift for iOS. But Python is still amazing, and I recommend it unless you're really set on specializing.
[Codeacademy] has another course that might be more your style. But make sure you install Python on your home computer at some point; don't just do it through the web.
I'm pretty sure the way I started with Python was a textbook I bought in 11th grade. This was silly, and I retained nothing and built nothing (maybe a if-branching and while-loop text adventure game). What really got me started was Python the Hard Way, which you can zip through in approximately no time. (I see now that the author has published an expanded book version--that's not necessary to buy, the link I sent you is the perfect base for anything you want to do.
After that, like I said, it's a matter of specializing.
- You've expressed an interest in web programming. This is the traditional route, and the way most people get started. However, there's one big drawback to this--programming for the web is not as simple as learning one language. To some extent, you will have to learn HTML, CSS, and SQL. If you want your site to do anything flashy, you'll have to learn Javascript. You'll have a lot of disparate knowledge-gathering to do, and for me, when I was first learning, it wasn't easy to tell what knowledge was extraneous. Your best bet is to:
- Run through HTML (do not bother with the tables section--table-based layouts are not good practice, I get so annoyed by this!) / CSS / SQL on Codeacademy. Codeacademy will just barely give you enough knowledge to do anything; it is not a thorough course. However, you could spend a year mastering front-end web design or SQL. You'll want to come back at some point to get a better grounding in this stuff, but this is enough to get started.
- Run through this Flask tutorial.
That's really all you need to build your blog. (I say that's "really all", but in reality I just gave you at least 40 hours of work. Like I said, web dev has some real disparate knowledge requirements.) Ideally, edit what you built in the tutorial (or build the whole thing from scratch for the sheer practice of writing it, and reference what you built in the tutorial.) It won't be a pretty blog. After that, you'll probably want to go back and solidify your knowledge in HTML and especially CSS. Then comes Javascript (and its infinite number of useful libraries), which is a real programming language like Python, which again you could spend years studying and never really "know". And then there's Bootstrap, a thing which hastens CSS development. And so much more--you could not possibly learn it all. It depends how deep you wanna get into web dev.
But, learning web dev will make you useful at hackathons. A lot of jobs out there aren't much more than very simple web dev (or "CRUD: apps). Before long, you'll be able to throw together a blog in just a few hours. It's a really useful thing to learn.
You might consider ignoring everything I just said, and going through a full fledged online course. These exist en masse. This course teaches PHP and SQL--you could conceivably learn HTML and CSS and then hop right into this. There's this. I tried this, but it didn't stick. My first experience with web development, at twelve years old, was actually this. (But I'm not a childhood whiz kid or something; I forgot all of this and had to learn it again a couple years ago. And the website I built at twelve was just HTML/CSS with no backend; I just wanted a place to post my stories and articles.) Finding a university course lectured online might be more your style. I know, though, that I would get bored and never finish it. (When I do do courses, I tend to watch them at 1.5x speed, but I do pause to take very good notes and complete the exercises. I think most people fly through them without really absorbing the material like they would in an actual classroom, which is why they have no respectability whatsoever. That said, a lot of these courses on Coursera (and its ilk) says they should take a month or more to complete, and I like to blast through them over the course of a week or so depending on their difficulty.)
- You might be into game dev, in which case pygame would be fun to learn (and probably a lot quicker / less overwhelming than web dev.) I was never interested in game dev, but this is how I taught my little brother programming. (Who is waaaaaay smarter than me.)
- Web scraping is cool--building scripts that can scrape data off the web--and has been surprisingly useful. I've used it both in both of my jobs, and it impresses people. You'll need to know HTML, and it requires a knowledge of how whatever website you're building is structured (requiring research.) But I've built a few fun project that way, including one I'm particularly proud of that automated an assignment in a gen ed course. This tutorial looks fine. (I forget the one I used.)
- You can build bots that interact with Twitter, Reddit, and most social media sites, if you can think of something clever to do with that. You need nothing more than basic Python for that. You'll have to Google that; "How to build a Twitter bot with Python for beginners" or something. (I have built a twitter bot, but the library I used is no longer supported.)
- You are a math guy, so you might be interested in the course I'm in now. It's about parsing data and building attractive visualizations out of it using Python libraries. It requires nothing more than Python. (It later gets into machine learning. The usual recommendation for that (which I second) is Machine Learning with Andrew Ng, who is minorly famous, and that goes into the nitty-gritty more than other courses (but less than an actual university class). It uses Matlab, which you might prefer.)
These are just some ideas of directions to go in. By far, the best thing is to decide not on a technology you specifically want to learn for your resume or something, but on a project you want to build, and let your desire to complete that project drive you to learn. I keep a notepad on my computer of projects I want to work on. Keep an open mind and actually write down your ideas, and you'll have more than you could possibly ever act on. (Even if most of them are crazy or not terribly impressive. It's about learning, for us, at this point. We'll likely never have this much creative freedom in our careers.) Then, come to us or somebody relatively experienced for pointers, or look online for how you might get started.
There's something [Friend] and I have disagreeing approaches to. [Friend] is methodical, and like to understand things fully before applying them. He likes to work through courses and get his material in a structured way.
I'm the opposite. I get a creative itch to build something, and learn the bare minimum to build that thing. I learn on the fly, with a billion and a half reference pages usually open.
[Friend]'s way is probably better in some ways, because it doesn't leave one with with massive, fundamental knowledge gaps. I've built projects in languages and with frameworks I don't understand before, just by pattern-matching code, and A) it probably shows and B) I left without learning all that much. (Just recently, I've started a data analytics course in Python, and it kills me that there are libraries out there that would have been extremely useful and time-saving for projects I've worked on, had I researched them.)
The issue lies in actually motivating yourself to learn things thoroughly, and also in remembering it all. If you work through an entire book off HTML5 and CSS, and an entire book of Javascript, and an entire book of Python (with all the esoteric minutia that comes with learning an entire language)--you'll have forgotten the Javascript by the time you finish the Python book, and a year will have passed, and you'll have little to show for it. Also, there's the confidence you get when you build things in the real world, which makes you sure you can build other things, which snowballs. (And I don't want to exaggerate by making the gaps in knowledge you get by not doing courses worse than actually is--programming is a bit like math or like scuba diving in that practicing it really is the only way to learn sometimes.)
Point is, take what I say with a gigantic grain of salt, and follow your own learning style. Do what actually works for you. By far, the biggest learning block most people have is not a lack of resources or a bad teacher, but a lack of motivation to learn. Do what it takes to stay motivated. Even if it's silly. Sometimes, I'll force myself to go to the library only by making a deal with myself to buy chocolate milk from the store along the way.
You'll also want to make sure you've got the general programming skills. This is not stuff you'll want to do right away, for the most part. (You may want to get the basics of Git down, so you can show off your projects and link to them on your resume--but just the basic three commands, not the complex stuff you'll need when you're working as a team. It will take an hour, tops.) You might want to work on applying Data Structures and Algorithms on Leetcode and with Project Euler problems. (Whenever I learn a new language nowadays, I do a few problems on Project Euler rather than running through an entire tutorial. I learned C that way before taking Low-Level, and it gave me an advantage in the class.) You'll want to work through the books Cracking the Coding Interview _and _Clean Code. (The video series Clean Coders goes even more in-depth than the book and is a lot less boring--though it's really wacky in its presentation--I have the first 18 videos of the series if you like.) Plan stuff out, do some pair programming. You'll want to learn Test-Driven Development, SOLID principles, Git, how the Internet really works, etc. You'll want to install some version of Linux, probably Ubuntu, and really learn it, meaning the command-line and bash scripts. (I deleted Windows when I got my first laptop at 16 in order to eliminate the temptation of using it. I did learn Linux, but now I kind of forget how to use Windows.) A lot of people say to read code to learn other programming styles, and contribute to open-source projects. More generally--just stretch yourself a little, and occasionally do things the hard way just for the practice. (For example, it's sometimes okay to copy-paste code when you really want something done--you're essentially doing that every time you use a library--but you don't want to do that all the time.) This is the stuff that will make you a mature programmer. They're a bit boring (unless you're [Friend]), but it's like eating vegetables. You've just gotta do it.
Oh, and it's good to skulk reddit.com/r/cscareerquestions and reddit.com/r/learnprogramming. Probably some others I'm forgetting about. Read the sidebars, sort by top. Read the comments. Take everything you read with a pinch of salt, but try to find the good advice. (And don't get addicted.) This will give you a link into the hacker culture/community, will help you pick up a lot of general knowledge and will inspire a lot of thought/introspection in a way that's hard to define, but is definitely useful. You can do this at any point; there's no particular reason to wait.
It's a lot of work. More work than anyone sees. I spend, on average, about and hour and a half a night on courses or projects on top of my schoolwork, and more since [Friend] and I started on a project that has a large learning curve. Once you get in the habit, and you have something to be focused on, it's not a terrible pace. (It's pretty great that now I am functionally paid to learn for my work. And it's not to hard to build projects based around what you're doing in class--the machine learning course I completed, for example, has gotten me to brush up on linear algebra that has come in useful during our Math Concepts II class.) However, there's no need to go that hard unless you come to really love it, or unless you're aiming for a Big 4 (Google, Facebook, Microsoft, Amazon) sort of position (which you would be well-suited for, with your math-y background.) (We really are in a good field; a lot of anthropology students would envy us only needing to work only a half hour a night to be a competitive graduate with good job prospects.) And while each project is going to be inevitably harder than it seems when you first were planning it out, eventually you'll find yourself doing things in hours that once took you days or weeks. You'll walk into job interviews and they'll comment on how relaxed and confident you seem. And then, at some point, you'll find yourself being the person people come to for advice, and you'll be writing them lengthy emails at one in the morning.
Let us know how we can help. And please come to the hackathon! (And for goodness sake, please force me to come to this stupid CS career stuff, I really should be going. But I'm not wearing a damn suit!)
Sincerely,
[ /u/serimachi ]