How to Start Programming
Posted: June 29, 2016
Like with anything in life, starting is the hardest part. Here’s my advice to new programers or anyone starting a new project.
Step #1
Figure out what you want to make. The first step to any program is figuring out what you want the program to do. You don’t need to know everything but you do need to know the basics. Will it be a game? Will it be a command line utility? What does it let people do? How will people do it?
Avoid spending too much time on specifics here. Unless it’s a dead simple program it’s often best to feel your way around from a core set of goals. Try multiple solutions and figure out what the best one is.
Step #2
Pick a language. This also means the tools and libraries that come along with it. If it’s a command line tool you may use C but there’s a decent chance Python or even Haskell will be the best fit. Knowing what tool works best for a job is half the craft.
Personally I’d recommend learning C first as it’s worth while to know how your computer works. Higher level languages like Python, Ruby or Javascript hide these details from you or pretend they don’t matter. That can make you more productive for certain problems, and can prevent you from solving others.
Learning how computers work makes you a better programmer.
Step #3
Code. Refactor. Repeat. Start writing the specific code you need to solve the next problem you’re up against. There are usually known solutions you can try. If you don’t know what to do, just start coding the first one you think of. Remember that at the end of the day code is just a bunch of text files, and you can always change them.
Once you’ve found the solution you like, add assertions, fix any obvious bugs, turn repeated code into functions, you know… clean up. Then move on to the next problem. If you treat a program as a series of small puzzles, you’ll feel much better about progress.
Step #4
Don’t Stop. One of the worst problems you’ll face is stalling. You know, that day you just stare at a screen or pad of of paper for 8 hours and go home. That mostly comes down to second guessing yourself. Fixing this is simple. If you get stuck for more than an hour, start typing the first idea you have until it works.
This sounds like it would be terrible. In reality it’s much easier to change working code that you understand, than to start from a blank page. This is for the same reason you stalled in the first place: you spend a bunch of time debating with yourself over the “right way” to do something. When a solution is in front of you, you can see exactly what’s wrong with it and what to change to make it better.
Conclusion – Start Programming!
The truth is it’s not that hard to write code. Once you get over the initial learning curve, it’s really fun to make a computer do magical things. So go check out some tutorials on C or Python. Welcome to the wizarding world… of computer science!