The Programming Trifecta: Three Tips for Absolute Beginners
Many people ask me one question about programming when we meet for the first time: “How do I get started?” I think this is the most important question I can answer for anyone out there thinking of trying programming, and this is my shot at that.
This isn't a post about how to program. There is no code in here. If you want that, tell me and maybe I’ll go into more technical detail on the three steps below in different posts. My goal with this post is to explain what steps a new programmer might take when they get started from Day 1. What are the big pieces of the puzzle, and how do they all fit together?
By the way, I’m no expert programmer. I've been programming for a while, and pretty seriously for a few years, but I think I’m at a unique place to share what I know with people just getting started. I still remember all the painful points of becoming a programmer when I got started. Those are the painful points I’m going to try to help you with below.
Below is just my list of tips you can use to get started as a programmer, as well as a few opinions I have on the subject (I promise, I’ll try to keep those to a minimum). If I utterly fail at everything else, I’m at least giving you a lot of great things you can Google to get you started!
P.S. This post is long. But it took me longer to write it than it’ll take you to read it, so I promise you’ll survive. Medium is mobile friendly so you can finish it in the bathroom after your lunch break.
Tip 1: Learn Some Program Syntax
It’s important, but not all there is.
Program syntax is the nuts and bolts of programming. It’s the thing we as programmers argue over for hours on end, struggle everyday to keep up with the changes that are made in new language releases (seriously, Python 3?) and will spend way more time than we should working on one single line of code just to make it “beautiful”.
I have met a number of programmers who are great at this step, but pretty awful at the stuff in the other steps, which is really a shame. I think this is due to the abundance of material out there on learning program syntax and the lack of resources relating to how to store data or display it to users.
Another reason for this is that program syntax is really cool! I think it might be the sexiest part of being a programmer. Well, processing tens of millions of data points every day is pretty bad-ass too, but it doesn't do as much for you on your GitHub profile unless you’re going to rewrite mrjob.
But syntax is important, don’t get me wrong. I see just as many programmers who cannot write good, clean program code to save their life. Syntax is the foundation for everything else you’ll do as a programmer and helps you gain exposure to principles that will help you improve overall as a developer.
Pick a language, any language!
Ask Quora what language you should learn first and you’ll cost thirty programmers the rest of their day writing answers (kidding, you’ll get slammed for asking a question that already exists).
If you learn Ruby as your first programming language, you’re making a mistake. Ruby is an awesome language, albeit a little to magical at times. But it’s too disconnected from the hardware your code is actually running on.
My advice? Start with C++ or Java. I can’t say too much about Java because I've barely used it — I started with C++ and haven’t regretted it.
You can hate me for it all you want, and you probably will. It’s painful to start with. You will get the most annoying, difficult to understand error messages when you start for the first time, but as they say what doesn't kill you will make your mind so messed up you’ll actually be able to understand what they mean after a while.
And more importantly, you’ll start to be able to pick up similar concepts in other languages. Ruby is a walk in the park after C++. Even though I don’t “know” Java, I can write at least a little Java because I've worked with C++.
I haven’t worked with C++ in a while, but I still remember all the principles it taught me really well. Maybe there’s a little Stockholm Syndrome thing going on, but I seriously recommend you try it before all other languages.
More than one ways to skin a… Eww.
Program syntax is pretty neat because it can take so many different forms. Reading someone else’s code who decided to be clever and not follow industry standards (see “Style It.” below) is annoying as hell so make sure you don’t be one of those people if you start writing code for other people to use. However one of the best things you can do after writing a few programs of your own is to go read someone else’s.
There’s this awesome site for that… we call it GitHub. The people who created it do too (awfully nice of them). Try out their search, and be picky about the code repositories you read (check the number of stars it has). You don’t want to read someone else’s crappy code, you have plenty of that right in your program. You should check out top repositories in whatever language you are writing in (*cough* C++ *cough*) and see how they approach certain problems.
Copy / paste some of their code into a new project. Try it out. Comment out lines, break it, put it back together and then Google a bit. Don’t try to master all of their code. Just get the basics, incorporate part of it into something you’re working on, and then move on with your life.
This is where you start learning how not to be one of those people who write illegible code.
“Anyone” can write code. Writing clean, readable code that other programmers can look at and work through takes true talent. — Me
It actually doesn't take any talent. Well it did, from the guy who wrote this thing called a “linter” for you to use. Google “<your language here> code linter”, download the program and run your code through it. This will help you write better program syntax and you’ll learn a lot more than you think.
It’s still bad.
Yeah, program linters are great, but you still have no idea what you’re doing. But that’s completely okay, because you’re still farther along than some freaking large percent of the population when it comes to developing a valuable and exciting new skill.
Time to put your code in front of someone who at least pretends to know what they’re doing. Best way to do this? Get an internship at a startup where you think you’ll get lots of good experience with people a few years (or more!) ahead of you.
But first, read the rest of this article. There’s some at least half-decent stuff below that’ll help you out.
Oh, and learn the basics of another language or two. Something sexier like Ruby or Python (or Scala, yeah, learn Scala!).
Your list of things to Google:
- getting started with c++
- basic program data structures
- compiled versus interpreted languages
- program language comparison (wikipedia has a good one)
- learn python the hard way (all the Learn the Hard Way books are excellent, and free to read online)
- project euler (great problems to test your skills)
- gradetrain (shameless self promotion, I co-founded a startup where you can code online for free if you want to get started fast)
Tip 2: Figure Out How to Store Data
Why store data?
Because all the cool kids are doing it, duh!
Seriously though, learning about databases was when it all came together for me. It put everything I’d learned about program syntax at that point in an entirely new light because it started to show me all these awesome ways I could not only code, but create.
Up until this point, you have been the only person in your world of programming. But learning about databases shows you that that’s doesn't need to be the case anymore. It gives you the power to store something (aka data) people give you, the power to do things to the data they give you (with the syntax you already learned, and a lot more you’re going to learn) and soon you’ll have the power give them data back (usually in the form of a website, which we talk about in the last tip).
You’ll also probably need a website to get the data, but I highly recommend building a database before a website. People really get mad when stuff they type into forms just disappears into thin air.
SQL, that’s how. Or “structured query language”. Storing data involves creating a database using a program like SQLite, PostgreSQL or MySQL (there are LOTS of other databases, but those are the basic ones), all of which you interface with using a form of SQL.
“Interface with a database? What the hell does that mean? Damn it, Saul, be specific!”
Okay, okay! Storing data and working with databases, at its core, is a more complex form of asking structured questions (yet simpler than some questions you’ll get asked as soon as you start touting your new programming skills, so beware!). Interfacing with a database is done using what is called a database adapter which allows you to read data into a program (written in a language like Ruby, for example) and then write that data back to the database.
Some examples of things you might ask your database are “show me all the users who signed up in the last day” or “show me all the posts by users who live in New Zealand.” It might not sound as interesting as the things you can ask Siri, but when you get back your first set of results (or perform your first JOIN statement) you are allowed one excited shout regardless of location.
But just one.
Good database design, when you get to that step, is done best when you are thinking about the questions you’ll be asking your database from the get-go. The types of databases we’re talking about here are all about relations, so thinking about what data will need to know about what other data is key here. Do you need to track what post a user belongs to? Should you store the company data with the post or the user?
To get started, I recommend actually writing down a few of the questions you’re going to end up asking your database. In fact, write down every single one you can think of. Then write the tables that will be able to answer those questions. Then write the code that will ask the questions.
There are quite a few different databases out there for you to pick from. Call me old fashioned, but I certainly recommend with starting with a relational database like the ones I mentioned. SQLite is by far the easiest to get setup with, but you’ll need to learn how to work with one of the big dawgs if you want to be taken seriously (use PostgreSQL, for Christ’s sake — you’ll hate transactions right up until the minute you love them, and then you’ll love them forever).
Installing most databases on your laptop really aren't that hard, and there are plenty of guides out there to get you started.
Yay, more Google-ables!
- postgresql tutorial (don’t use the official documentation, yet, this site looks good though)
- sql data types
- what column type to use for a zip code (the answer might surprise you)
- inner join versus outer join
- getting started with rails (you’ll learn a lot about how to access and manipulate data)
- amazon rds (example of a cloud-based data storage platform, something good to keep in the back of your mind)
Tip 3: Make a Website, aka. “What the World Sees”
Put it in the page.
This is the point in your programming career where you are going to either discover that you love making stuff people see or you completely hate it and it makes your blood pressure skyrocket every time you have to work with it out of sheet frustration (that’d be me).
Either way, the name of the game here is HTML, or HyperText Markup Language. This is used for building basic scaffolds of webpages that you can layer other things on top of. HTML allows you get the content of a website into a page, whether that is generated dynamically using a web framework like Rails or statically if you’re just making a few pages.
Colors, colors everywhere!
Next in your arsenal of frontend tools should be cascading style sheets, which the experts are calling CSS. This will help you make all that HTML you just put on the page not look as horrible as it does right now, add some pretty colors, move around where it is in the page and change the size of it.
Sounds basic, right? Hah! Wrong. Just throw a framework like Bootstrap into the mix and you’ll soon discover just how frustur—er, exciting it can be!
Woo, animations. Yay.
And now, more Google-ing! (how many of you just skipped to this?):
- web servers
- css precedence (this will bite you at some point, I guarantee it)
More Things You Should Know
Well, that pretty much wraps up this post! If you enjoyed it let me know and I’ll try to dream up a few more to share with you, or go into more depth on some of the things covered in this one. In the mean time, I’ll leave you with a few more things to Google:
- how to build a computer
- programmer salaries ;)