26
votes
Learning to Program
Hi folks,
I figured this would be a good place to ask a rather simple question.
Where do I start to learn to code?
I'm in high school, so I have (some) time to dedicate to it, and it seems there are a plethora of websites/resources out there, so I ask: what do you recommend, and why has it worked for you? I have no prior experience. I believe that this would really help out in the long run, as I will graduate high school with an Associate's Degree in Business. Thank you!
EDIT: Thank you for all your responses! I'll start with Python and move on from there. You guys have been a great help, and I'll vote you up or reply.
Many people will recommend different courses, paid or free. However I believe being able to learn for yourself without the help of a curated course is an essential skill for an aspiring programmer. To get started, I would recommend picking a super simple language, like python, read over the docs a bit, take a look at some code, and then try to create a project from scratch (something like hello world, tic tac toe, etc.).
I agree totally about not following a curated course.
I learned to code about 35 years ago, before operating systems were common on PCs, and so you were booted directly into a BASIC interpreter. I liked learning to program on there, just by screwing around, and I especially liked that you could write a couple simple commands and see something happen immediately.
Unfortunately it's difficult to find that experience these days. Computers and operating systems like Windows are designed to hide away details and give users an overly simplistic and restricted interface rather than one that can be programmed and controlled. You can get a development environment, but it requires downloading and installing, and is usually quite complex.
I agree Python is a good choice. You can get something going with only a few lines of code and see immediate results. Environments like PyCharm aren't overly complicated, either.
One other option I'll mention is Javascript. Everyone has a web browser available, and with only a few lines of Javascript, you can make something cool happen in your browser.
Javascript is terrible for begginer. It's complicated with it's weird object model, quirks that change browser to browser and the automatical type casting. The type casting is one of the most confusing things in JS I think.
However you're right, you can do magic with even a few lines of javascript. But this magic is way too confusing.
I'd recommend against JavaScript as a first language if you can help it. It has the appearance of being easy for beginners but it's really not great.
I've heard this is a good route, and I suppose I will start with Python and try to teach myself w/o help from curated courses. I'm usually pretty logic-driven, so I hope that will take me off. Thank you!
I think the most important part of learning is to realize that you're never done. You're not aiming for some point of perfection. You're aiming for the point where you can teach yourself the rest as you go. Learning to learn is important in any field, but it's particularly essential in the huge world of CS.
I feel that you are both very right and very wrong at the same time. You are completely correct when you say that being able to learn by yourself is a key skill. But computer science is built on fundamentals concepts that you have to make sure you completely understand, so someone who is starting out would be better learning in a more structured and social environment. Reading language docs will teach you how to code, but they're not the place to learn how to program complex projects. For example, it may teach you how to write classes and instantiate objects, but they won't necessarily explain why you would want to do that and why OOP principles are useful.
I agree. Sure, you can learn syntax and language by messing around, but there are a ton of paradigms, data structures, algorithms, and best practices that are essential. You don't want to reinvent the wheel. Build on those who came before.
I strongly recommend project euler especially if you're into figuring things out yourself.
Pick a language and start with problem one. Probably a lot of googling around till you figurout how everything works - but I tell you there is nothing more rewarding then putting in the awnser and seeing that green check mark.
Project euler is a site started in 2001 - they started posting progressively harder and harder math problems, nothing is language specific. They just ask for the awnser, so it's very much a case of figuring it out on your own. Some languages some of the problems are a breeze (python), others it's much more envolved.
Well you ruined my day haha. I saw this this morning and breezed through a couple and now I'm stuck and ripping my hair out! I've never been much of a math guy so this is good for me.
Stallman says it best.
How to learn programming
First, read a textbook about programming in some language, then manuals for several programming languages including Lisp. If this makes natural intuitive sense to you, that indicates your mind is well-adapted towards programming.
If they don't make intuitive sense to you, I suggest you do something other than programming. You might be able to do programming to some degree with a struggle, but if you find it a struggle you won't be very good at it. What's the point of programming if it is a struggle instead of a fascination?
After that, you need to read the source code of real programs (or parts of them) and figure out what they do. Then start writing changes in them, to add features, or fix bugs if you can find out about specific bugs to fix. Ask some good programmers who are familiar with the code of those programs to read and critique your changes.
If you fix a bug in a free program that people are developing, the developers are likely to be glad to get fixes from you and will tell you the way to write them to make them good to install. Look at their TODO list for features you would like to implement. You will find it is a great satisfaction when the developers incorporate your changes.
Do this over and over and you will become good at developing software.
Please use your programming capability only for good, not for evil. Don't develop nonfree software, or service as a software substitute. Design systems not to collect personal information, and to allow anonymous use.
Oof, with all due respect, this wouldn’t have worked well for me! I think it is important to start out writing programs — starting with simple ones! — from the very beginning. I’m usually the sort of person who likes to gather all possible information before diving in, but programming requires practice from the start, and mistakes can’t hurt.
Learning to program is hella hard for everyone. It’s not just because we’re bad at logic; we also need to get used to decades of conventions that are hard to explain directly. There are a million reasons that a textbook might not make sense to you besides “you don’t have the potential to be a good programmer”. The key is practice.
Adding on to your note about contributions to real-world software: that happens later. Don’t expect to get a feature accepted until you have some solid experience on (simple) side projects under your belt :)
I agree with this fully. I also think that spreading "if you're bad at programming, just stop" is dangerously elitist.
I learned by writing code. Some people have a use for textbooks, but that didn't work for me personally. There's no single way to learn besides tenacity.
I don't understand how an inherently interactive process could be taught through a non-interactive medium, but I'm sure those textbooks wouldn't exist if they didn't help someone.
If you think you're like me, try to start with an interactive learning method, like Codecademy, then move to personal projects when you feel comfortable.
I think that is great advice if you're like Richard Stallman: a brilliant individual with a natural aptitude for the exact sciences. That is not everyone's my case, but there are other jobs beyond writing the Linux kernel.
Whenever this question is asked, Automate the Boring Stuff is mentioned. And with good reason, you can get the full, selfpaced course online and it's a great introduction to python where you're going through all the important basics and go from making number guessing games to web scrapers. When you're done, there's still a lot to learn, but I found it to be a good guide for the basics and gave me some idea of how to move on.
There is also a good course on edx, but it has more of a computer science angle, which is undeniably important to gain a thurough understanding.
Here's the page for Automate the Boring Stuff, it's free to read online: http://automatetheboringstuff.com/
The author also has a few other free beginner programming books with different themes (creating games, cracking codes), if something else appeals to you more: http://inventwithpython.com/
I always feel dirty linking to reddit, but here is a subreddit linking various learning resources that you may find helpful, and here is its FAQ for additional guidance..
Think of it as linking to the work of helpful people, not to 'Reddit.' Reddit is just the company who organized and took advantage of the content, and while it may be theirs in a legal sense, in a more meaningful sense it has nothing to do with them.
Fair enough. That's certainly a more constructive mindset. I'll try to adopt that mindset more in the future :)
ict.social is great site for learning syntax. It is free (excersises are payed, but you don't need them) and, this is most important, structured. I highly recommend you to take a look. It teaches you what things that you write mean and what to write - but it doesn't teach you how to think. Still, for programmer that is learning new language (or begginer programmer that is learning his first one) is this a must. It'll teach you syntax, which is the most important thing for you right now.
After you learn syntax, I strongly recommend you to learn how to think - I recommend project euler, as @nsz recommended.
If you can, find a friend or two you can work on projects with. I learned a lot trying (and mostly failing) to make games with friends in high school.
It really depends on your learning style. While this is difficult to reflect on in high school (because you are basically forced into a single learning style), it's worth your time to consider the question and find what works for you. Some people will learn well from books, others from projects, others from working with peers, others learning from a mentor.
For me, it was a combination of taking a programming course in high school and also having an incentive to learn more playing around with MUDs and MUSHs.
One thing that hasn't been mentioned is free student recourses. One of them is the GitHub student pack. It has a ton of good resources, including a domain and free hosting for experimenting with web projects. You also get a bunch of free subscriptions to learning sites, and unlimited private GitHub repos.
Thanks, I didn't know about this one. Maybe we need a student deals thread.
If you have $25/mo available, I'd highly recommend Treehouse. There are free coding courses, but the quality of Treehouse is far beyond what they offer. I used it to completely change the direction of my career from English teacher to programmer, and honestly it's far more up-to-date than what most universities offer. For free instruction, CodeCademy is pretty decent.
If you just want something simple and the basics, I always recommended University of Helsinki's MOOC Java course. It'll teach you the basics and let you actually program on your own so you actually understand the knowledge instead of just reading and basing it off theory. The plugin they use will verify if your programming works with the exercises given and so you'll know instantly on how you progress.
For something that covers pretty much the fundamentals you can take a look at these two repositories as well.
https://github.com/ossu/computer-science/tree/dev
https://github.com/jwasham/coding-interview-university
Get a free shell account on sdf.org and learn Unix. Every Unix shell is also a programming language.
Quite a bit depends on how you learn. In a way learning how you learn best is a crucial skill in life that transfers to most areas.
People have already recommended Python which is a good choice. For me building programs that pushed my ability then seeing how better people did the same thing was really helpful.
Python Docs
https://docs.python.org/3/tutorial/index.html
Video I found helpful at the start.
https://www.youtube.com/watch?v=pofWfJc3Zog
Here are some resources I've bookmarked that you may find useful:
python learning resources
coding exercises
I've heard some good things about Harvard's CS50 MOOC.