Live data from Hacker News

Ask HN: I want to learn how to code. Can anyone tell me how to start learning?

news.ycombinator.com

1–10 of 59 posts

Ask HN: I want to learn how to code. Can anyone tell me how to start learning?

#1
Greetings,

I am a recent college graduate (as of this past May) and I studied chemistry and physics. I have plans to go to graduate school within a year for theoretical and computational chemical physics - that's basically fancy talk for predicting physical interactions between molecules using high performance computing. I have some experience in the field from working as a research assistant as an undergrad and while I never had any problems with the physics, I struggled a little bit with the coding aspect because of lack of previous exposure.

I also read this post "To founders who can't code"

http://news.ycombinator.com/item?id=1761530

It really hit home. I have had two failed ventures thus far which likely would have taken off better if I had the coding abilities to make my own demo. Instead I took the seed funding I received and hired people to do it for me - long story short things didn't work out; I lost money and disappointed people.

The author of the aforementioned post recommends that noncoder founders should: "Take 6 months off and go learn how to code (day and night, weekends including)." This is what I would like to do but I am unsure as to how to begin. Sure, there is a wealth of sources but I am unsure of which ones are quality sources and also what languages to learn first. I am not trying to be a coder or hacker overnight and my approach is methodical: I will devote 8-10 hours per week to learning. I generally pick up things fast; the key though, is having interesting problems to solve which increase in order of difficulty.

If anyone can give me a few pointers on how I can start learning (what resources are good, what language to begin with, a good program of studies) that would be much appreciated as it would help me develop my future ideas on my own and would probably also help with my research. I thought a cool initial project would be an applet which queries each line of a word document with book titles (I keep a running list of all the books I’ve read, one per line in a doc) and searches the net for a picture of a book cover and imports it into the app. Apologies for my ignorance but would this be a realistic project within 6 months?

Lastly, I did run a search on this but didn’t find any related threads; I apologize if this Q has come up before.

Thanks for your advice, AKD

Re: Ask HN: I want to learn how to code. Can anyone tell me how to start learning?

#2
I think it best to learn how to code by working on an actual project. You seem to already have a project in mind, and I think that would be a fine project.

Break it up into steps. First write a program that opens a file, reads the book titles and displays them on the terminal. Then write a program that makes some sort of network connection; maybe download the HTML contents of a website. Etc., etc., until you've learned how to do the various subtasks involved with your project, and then assemble it all together.

I'd suggest that Python would be a good language to start with. I personally like the O'Reilly book Learning Python, though there are many options.

Re: Ask HN: I want to learn how to code. Can anyone tell me how to start learning?

#3
I'm new to coding as well, but so far what I've gathered is that WHAT language you learn is less important than actually sitting down and getting dirty with code.

When I was trying to decide what to learn I narrowed the search down by just heading to the book store and flipping through some books on various languages. Ultimately, I ended up with a choice between Ruby and Python. I couldn't tell what the major differences were, so I just decided to pick Ruby. I figured that there was no real way of recognizing the nuances of ANY language until I actually had one under my belt and could better understand what makes each one tick.

I'm fully aware that this was a somewhat cavalier method of choosing the pal I'd be spending the majority of my waking hours with, but I think that starting anywhere is better than stalling because you can't decide.

So far I'm satisfied with my choice. I think I would have been satisfied with Python too.

Re: Ask HN: I want to learn how to code. Can anyone tell me how to start learning?

#4
I'm actually 2 months into learning to program Javascript for the Unity3D engine. I've learned a lot in 8 weeks, and I'm happy I took the time to commit to it. I could actually start prototyping my own basic mobile games with Unity, something I never thought I'd be able to do.

So I guess from my experience: - Find a single good source or book for tutorials and learning. Its best for the coding style and teaching style to be consistent. I used a fantastic series of free video tutorials produced by the Walker Brothers, which included 3 entry exams, and a series of lab assignments after each tutorial set. I had to submit the work in order to get access to the next set.

- Find a good Q&A source like Stackoverflow, forums, or a site more specific to what you're coding in. When you get stuck or don't understand something, go and ask (search first). +1 if you have programming friends to ask too.

- Keep a journal (really!) on Google docs. At the end of the night, you can quickly re-hash what you learned (cs concepts, or cool functions you learned), or often write out the things you don't understand. That way, when you start up again, you can do a quick review on where you left off and get back to figuring out things you previously were stuck on.

- Try not to skip past things you don't understand. If you don't understand them, take the time to practice out the code, or look up documentation. A big key point: its always worth it to invest the time to figure little problems out. I once spent 3 hours trying to get some timer controllers working just perfectly the way I wanted. They were actually OKAY to begin with and I was considering skipping past it for the sake of productivity, but in hammering out the problem, I gained confidence and had the satisfaction of solving a problem.

- Get your things WORKING! As beginner programmers, our first concern is making what we want happen. Not pretty code, not computer science theory. Just results. Getting results fast gives you the confidence to try harder things, which will naturally take you into the world of organized code and computer science.

Good luck!

Re: Ask HN: I want to learn how to code. Can anyone tell me how to start learning?

#5
Grab yourself a copy of Racket (http://racket-lang.org) [also, the quickstart guide at http://docs.racket-lang.org/quick/index.html might be useful], the How to Design Programs textbook (http://htdp.org/2003-09-26/Book/), and most importantly, set aside some solid blocks of time to dive in. You will learn most by doing, and through doing you will gain understanding.

Re: Ask HN: I want to learn how to code. Can anyone tell me how to start learning?

#7
Set up a Linux computer (Ubuntu Linux is the easiest to set up), and spend the summer learning to program in Python.

Python is easy to learn (not much syntax), easy to read (explicit vs implicit), has a big ecosystem (more packages/libraries), is taught at universities so it's easy to find good programmers to help, and is used by many large websites/companies so it's a good language to know.

Here are some of the best online Python tutorials, including a link to videos and course material for MIT's introductory computer science course, which uses Python: http://www.quora.com/How-can-I-learn-to-program-in-Python/an...

Build something that you want to use so it will be meaningful to you. Do you have a blog? That's usually a good first exercise. It's easy to do using Flask -- follow the tutorial (http://flask.pocoo.org/docs/).

Here are some tips to get you started:

Use Emacs as the text editor to write your code -- it usually comes pre-installed on Ubuntu, and it has a Python mode. Here are some Emacs tutorials (there are some good videos on YouTube too):

http://philip.greenspun.com/teaching/manuals/usermanual/emac... http://www2.lib.uchicago.edu/keith/tcl-course/emacs-tutorial... http://www.gnu.org/software/emacs/tour/ http://cmgm.stanford.edu/classes/unix/emacs.html

Use PostgreSQL as your database. To install it on Ubuntu, use this command:

  $ sudo apt-get install postgresql
Use SQLAlchemy (http://www.sqlalchemy.org/) to connect your Python website to PostgreSQL.

Here's a good SQL tutorial: http://philip.greenspun.com/sql/

When you build a blog, you don't have to worry about building a public authentication and comment system if you use something like Disqus (http://disqus.com/) -- you just include the Disqus JavaScript tag at the bottom of the blog's entry page.

Here are some good JavaScript tutorials: http://www.quora.com/What-are-good-books-preferably-found-on...

Use StackOverflow to ask programming questions: http://stackoverflow.com/

UPDATE: Here are links to some commonly-used scientific Python packages (http://www.drewconway.com/zia/?p=204).

Re: Ask HN: I want to learn how to code. Can anyone tell me how to start learning?

#8
The best advice I can give you is to write as much as you can before you start coding. Putting a program or app together is 60% critical thinking, 20% writing, and 20% error management. If you've already got some ideas, try to break them down as much as possible.

As for specific languages to learn: startups in particular seem to love Ruby, but honestly, they all work the same way, fundamentally. I crashed through the basics of Ruby in a week, started learning JavaScript, and stopped shortly after realizing that the majority of it was the same code just written differently.

++ to keeping a journal. It keeps you in check, because even though you say will will devote so much time a week to it, you won't. I had to start setting personal goals on a daily basis. That drive alone is helping. Keeping a blog is great for peer support too. I don't get many comments on mine, but it definitely feels good when someone stops by to say, "Hey, this is cool stuff."

Hope that helps, and good luck!

Re: Ask HN: I want to learn how to code. Can anyone tell me how to start learning?

#9
post #2

I think it best to learn how to code by working on an actual project. You seem to already have a project in mind, and I think that would be a fine project. Break it up into steps. First write a program that opens a file, reads the book titles and displays them on the terminal. Then write a program that makes some sort of network connection; maybe download the HTML contents of a website. Etc., etc., until you've learn…

From experience, I'd definitely second the 'actual project' part, particularly around breaking it down/picking the right level of project. Ideally you want something that you can pull off in a day or two, then apply what you've learned to the next project, or extend your first project so that it does more.

plug: It's the tack that I took when writing Quick and Easy Python (http://manning.com/briggs/) - small bits, building on each other.

Re: Ask HN: I want to learn how to code. Can anyone tell me how to start learning?

#10
post #2

I think it best to learn how to code by working on an actual project. You seem to already have a project in mind, and I think that would be a fine project. Break it up into steps. First write a program that opens a file, reads the book titles and displays them on the terminal. Then write a program that makes some sort of network connection; maybe download the HTML contents of a website. Etc., etc., until you've learn…

Agreed. I'm self-taught and have been working in the industry for 12 years now. The way I got started was that I had a project I needed to do, so I figured out what I needed to know to get it done. The same is true with my iPhone app -- I knew nothing about Objective-C when I started it, and it's 3 years old now. Learning for the sake of learning is fine, but learning how to build something you want to build and really seeing it come to life is a pretty phenomenal way to learn.
Post reply on HN