7 ms·
How to begin to teach yourself how to code, starting from scratch
- sumeeta 17y agoHow’d that work out for Reba? And why did Reba want to learn programming in the first place?
- jrheard 17y agoHopefully it works out pretty well - I haven't heard back from her about it yet what with school and all, but hopefully she'll have some questions in a week or so, and working through them would probably be really educational for both of us. I think she was probably interested for a couple of reasons. * First, the house we live in has a strangely high proportion of coders, and so she hears us get really excited in our discussions about programming on a pretty regular basis. I think this is probably one of the main reasons that other people who live in the same house have, in the past, asked me the same question she did. * Second, she thinks coding seems pretty practical; it comes up in a bunch of fields, so it's probably a pretty useful skill to have. I think that most of the people I know either have no idea what coding is and see it as a foreign and scary thing, or, like her, they think that it must be pretty useful, and are curious about it. It'd be pretty nice if we were able to convert those in the former camp to be in the latter, but I think that what's even more important than that is that people who are already curious about programming should immediately be made aware of the fact that programming is fun as hell.
- adelevie 17y agoThere needs to be more content geared to people who know nothing about programming. Those people have the highest hurdles to jump, as they don't even know what they don't know.
- sumeeta 17y agoI couldn’t imagine jumping into programming (or even wanting to) without a problem to solve first. That’s the whole point of programming, anyway. If someone wants to learn programming, maybe we could help by directing them towards a problem they’d find interesting.
- jolie 17y agoWhat about those of us who are insatiably curious and love to learn for learning's sake? I'd find it more frustrating than anything to be confronted with a significant problem right out of the gate.
- sumeeta 17y agoI don’t think a problem has to be significant to be useful to someone. I just think it’d be ideal to work towards a product (no matter how trivial) that the beginner could feel proud of and actually appreciate how it’s helping them. Learning programming “for learning’s sake” sounds great, but it also sounds damn hard without goals.
- jrheard 17y agoYou've got a good point! The post under discussion actually contains a slightly modified version of the email I sent to my friend. The original version had a paragraph toward the end that more specifically tried to show her a few ways that programming could be relevant to her daily life - she's got a job that would particularly benefit from some automation in the form of a few self-rolled Ruby scripts. I've given a variation of this "how to start programming" email to someone else before, and with that person I made the mistake of not pointing out how programming could be relevant to their daily life; I think that email was significantly less useful as a result, so I'm trying to iterate a little bit.
- aohtsab 17y agothat's been the most difficult part for me, actually -- finding fun problems that I could work on that aren't completely impossible. I spent a lot of time reading books on Python when I should have just been playing with code.
- sumeeta 17y agoI learned programming by hacking on other people’s code – manipulating it to fit my needs. Try to find an open source project you can mess with. I can’t say for sure how much fun this’ll be for you: The next time you think to yourself, “I wish this thing worked like this” or “I wish this thing had this feature”, if it’s open source, just load up the code and start playing with it. Your problem might be easier to solve than you’d think.
- steveklabnik 17y agoThis is exactly the point of Hackety Hack. I need to wrap up this OSX and Windows stuff so that I can actually promote it.
- jrheard 17y agoI've never been able to successfully use Hackety Hack, as back when _why was still actively developing it and I was still on a Windows box, it would always insta-crash on my machine, but it's always sounded like a great idea, and I'm definitely looking forward to 1.0!
- steveklabnik 17y agoThanks. The cross-platform nature of shoooes is a lot of work, and it's been holding up the 1.0 release for a while. It's looking like a Shoooes 3 release may happen soon, though, and that should help. I'll certainly let you know when it's usable.
- Major_Grooves 17y agoI started a little blog about trying to learn to code from scratch: http://newbiehacker.wordpress.com/ http://newbiehacker.wordpress.com/ As that blog post says, it is really difficult finding resources for people who want to learn but really have no programming background whatsoever.
- jrheard 17y agoThat's a great blog - it's really interesting to see what the code-o-sphere looks like to a newcomer! I saw that you were having a little trouble dealing with some of the proper-noun Concepts thrown at you in Beginning Ruby, and that you weren't entirely sure where to go next in terms of finding exercises not already in the book. As far as the Concepts go, it's probably best to approach them all as a bunch of different ways of solving the one main problem in programming: complexity[1]. When you're coding anything longer than ten lines, you're usually tackling a problem that's too big to fit into your head all at once. So, you need to break the problem into a bunch of little chunks. Coders do this by building abstractions. All an abstraction is is the act of deciding you've got a problem ("I need a way to print the contents of the screen!"), solving that problem (by writing code that grabs whatever's being output to the screen, translates it into something the printer can deal with, and prints it), and then hiding that solution from anyone who has that problem. The key here is that you're hiding the solution, but you do expose an interface - a "print_document" function, say - that allows them to benefit from your hard work without having to think about it[2]. That's really what nearly every programming technique is all about: minimizing complexity. So when you see big scary words like Encapsulation and Polymorphism and Mix-Ins, just remember: they're almost certainly just different ways of minimizing the amount of stuff you have to think about at any point in time, and if they're any good at letting you do that, they're probably worth learning about. Oh! And as far as finding fun exercises to work on goes: Try writing something that'll automate a chore in your daily life. Say, an automated grocery list, or a "books to read" list, or an apocalypse-detector that checks every five minutes to see if Google's down. You know what they say about the sky and the limit and all that :) - [1] “Managing complexity is the most important technical topic in software development. In my view, it’s so important that Software’s Primary Technical Imperative has to be managing complexity" - Steve McConnell, Code Complete [2] "Civilization advances by extending the number of important operations which we can perform without thinking about them" - Alfred North Whitehead
- meox 17y agoI am trying to learn; currently reading how to think like a computer scientist on Green Tea Press.
- jrheard 17y agoBest of luck! Sounds like a pretty good idea, actually - I just grabbed the .pdf for the manuscript of the Python version of the book from http://greenteapress.com/thinkpython/thinkpython.html http://greenteapress.com/thinkpython/thinkpython.html and sent it off to my Kindle for a rainy day.
- jsz0 17y agoAs someone who's never really been able to break into coding my biggest problem with most of the learning material is it does not tackle a broader perspective on problem solving. Learning syntax and libraries is easy. Knowing where to apply them and how to architect your program is the really hard part. I'm not sure how you learn that other than experience and for a novice that means countless hours of work before they can produce anything unique and useful.
- jrheard 17y agoUnfortunately, that does seem to be the case at this point, although if anyone has any good references for novices, I'd certainly love to see them. So far, the best I've ever seen the situation summed up has been in the top comment on http://news.ycombinator.com/item?id=90782 http://news.ycombinator.com/item?id=90782 .
- andrewcooke 17y agohave you tried "how to design programs"? http://www.htdp.org/ http://www.htdp.org/ i haven't used it, but i think it's aimed at this kind of problem (where to apply them and how to architect your program).
- el_dot 17y agoI would also suggest Introduction to Computer Science and Programming from OpenCourseWare: http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-00Fall-2008/CourseHome/index.htm http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Compute... It's the right approach, they teach you the concepts so that you can pick up any language and run with it. It uses Python but it's not about Python, which is a clean language that has a great support system (perhaps the most essential part in learning how to code).
- jsz0 17y agoThanks I'll check both of these links out. I'm designing a little Google Maps based web app that has already had two major architectural changes due to issues I hadn't considered. Before I go forward with it I want to go through these resources and try to get the third iteration right.
- yashodhan 17y agoShould I learn PHP or Ruby?
- jrheard 17y agoJust like everything else, the decision's based on nothing but trade-offs. Here's my analysis. If you learn PHP: * You'll be able to see results running in your Web browser a lot quicker * Your knowledge will be really relevant if you're looking to work on slightly older, more established Web sites like Facebook or Yahoo!, but * You probably won't learn very good programming practices on your own - PHP has been pretty notorious for this, but maybe this has changed with PHP5, I haven't been keeping up. If you learn Ruby: * First you'll have to learn the language, and then you'll basically have to learn a framework like Sinatra or Rails before you'll be able to do awesome Web things * Your knowledge will be really relevant to most startup-style Web sites begun since 2005 or so (e.g. Yelp, which is written in Python, which is basically sort of like a sister language to Ruby, give or take) * You'll be much more likely to learn a lot of really good programming practices as you go that will serve you throughout your career. Having worked with both PHP and Ruby, I'd recommend Ruby, because I think it's easier to learn, it's more fun, and it's a better investment; I'm pretty sure most HNers would agree if given the choice between those two languages, but your sample of respondents is probably pretty biased :)
- yashodhan 17y agoThanks for the response. I'd prefer to learn Ruby over PHP but I'm hesitant because it seems like PHP has a larger audience / more documentation that would help me in my quest to create web apps. Googling for help with errors in PHP would be easier I imagine, seeing as more people know PHP. Also, there are a lot of existing PHP scripts that I could build off of. Those are my concerns.
- jrheard 17y agoThose are definitely reasonable concerns! PHP has been more dominant in the Web world for a longer period of time, that much is definitely certain, and there's a lot of resources out there already. I think this Google Trends chart captures my impression of the relationship between the two languages, though: http://www.google.com/trends?q=php%2C+ruby&ctab=0&geo=us&date=all&sort=0 http://www.google.com/trends?q=php%2C+ruby&ctab=0&ge... In addition, although you're definitely right in that there must be much more PHP documentation out there, you're not going to have much difficulty Googling for Ruby errors either - just because there will be fewer results doesn't at all mean that there won't be any. Just like in any other programming language mainstream enough to be considered a good language to learn on, any problem you have in that language will have already been experienced by someone else, and there'll almost definitely be an easily found Google result that'll solve that problem. If you're really on a quest to create web apps and you'd like to invest in knowledge that'll help you and your webapps grow, I'd really strongly recommend learning Ruby (or Python) over PHP. edit: on closer examination of that Google Trends chart, it looks like a good chunk of the Ruby results are from non-programming-related hits, but I'd still be willing to bet that the overall trend is the same.
- zavulon 17y agoUsually "I stopped reading after..." is used as a metaphor, and the article still gets read. In this case though, I really did stop reading after "as a matter of fact, any self-respecting programmer you’ve ever met is mostly self-taught."
- jrheard 17y agoWhy?
- Confusion 17y agoI really don't think you should advise someone to read "_why's poignant guide to ruby" as an introductory text. The sillyness is very distracting, the humor doesn't suit everyone, it's not very well structured and the information density is quite low. I feel there's a ready chance it will be demotivating. I definitely didn't consider it a decent introduction to Ruby or programming. </heresy>
- jrheard 17y agoMuch as I love _why's works, you may have a point - I've been reading through http://pine.fm/LearnToProgram/ http://pine.fm/LearnToProgram/ on the suggestion of a couple commenters on the post, and I'm pretty impressed so far. I'm going to forward it along to the friend whose question spawned the post.