8 ms·
DHH: How do I learn to program?
- tnorthcutt 16y agoSpeaking as a non-programmer, this is spot-on, for me. I've tried to go through various tutorials and start learning to code over the past few years (all the while wishing I'd gotten a CS degree rather than finance), but could never force myself to get through a whole book and really start to understand what's going on. Recently, though, there's been a need within my business for a small, (theoretically) simple application to handle part of our workflow. I finally have a concrete end goal in mind, and have been flying through a PHP book (Head First PHP and MySQL, which I quite like so far), because I actually want to learn enough as quickly as I can to put together a working version of this application. Granted, I'm still following the tutorials in the book and going through the admittedly hokey examples, but now I can see how each of the different elements I'm learning will actually help me build something useful. It's a whole different experience for me, learning to code when I actually know what I want to build.
- jacquesm 16y ago> all the while wishing I'd gotten a CS degree rather than finance That's interesting, the prevailing opinion here on HN seems to be that being in 'finance' is better then in CS. Why is that different in your case?
- secretasiandan 16y agoI don't get that sense from posts. But even if being in finance is better than being in CS, in places where performance is rewarded being in finance with a CS degree is better than being in finance with a finance degree.
- jacquesm 16y agoJust one sample: http://news.ycombinator.com/item?id=1613347 http://news.ycombinator.com/item?id=1613347 There are many more besides it.
- barry-cotter 16y ago>That's interesting, the prevailing opinion here on HN seems to be that being in 'finance' is better then in CS. I strongly disagree, as to HN's "conventional opinion". I think most participants and probably most lurkers, would say that finance is probably, on average, a more lucrative field, but a CS degree from a no-name university would probably be better for getting into finance, the field, than an equivalent finance degree. This assumes you're working for someone else. A finance degree is less useful for a technology/coding business/startup than a CS one. This is the raison d'etre of the forum. I would also contend that for getting FY$, personally financially independent rich, a startup is probably at minimum equivalent to working in finance. As such, neither is a bad choice, but the CS degree has better options.
- ajaxian 16y agoI work in finance and have an undergrad CS degree. It's common for folks in finance to have undergrad technical degrees (e.g., physics, math, CS) and graduate degrees in something more closely related to finance such as an MBA or MS in quantitative finance. (Although the pure quants will usually have a PhD in math or physics.) But frankly if you're a technical person IMO finance is a ghetto: once you're in, it's hard to get out. In no other industry can you make as much money to do work that generally speaking is substantially behind the curve technically (e.g., pre-STL C++ is the standard development language and mindset, and most of the time you're just moving stuff to and from CSV files and databases). But if you're disciplined with your spending it's a great way to save seed capital if one day you want to jump ship and try a startup.
- barry-cotter 16y agoRFI: What do people think of quant finance Bachelors and Masters? Obviously it depends on the programme and school, but what do Ph.D. mathematician or pfysicist quants think of them, and otoh, what do traders and such think of them?
- loganfrederick 16y agoI don't get the sense from HN that being a finance major in school, especially as an undergraduate, would be better than CS. As someone who is doing both finance and CS courses as an undergrad currently, the jobs for finance majors all end up being analyst positions. A CS degrees gives you much more, better options if you're good at it, and allow more flexibility if you want to go out on your own. Finance is only glorious if you're one of the handful of people who get a potentially soul-crushing i-banking job as an Excel drone with opportunity to move up or do an Ivy MBA.
- jacquesm 16y agoIt's not from the glory point of view, not even from the interesting work angle but simply from a money making perspective.
- tnorthcutt 16y agoIt's different in my case because the traditional finance career bath does not appeal to me. I went to a large state school in a (relatively) small city, got married, and stayed here, which doesn't bode well for a career in finance. I got a job at a small regional bank in commercial lending, right when the credit crisis was hitting its stride. Stayed there for about 6 months, then left to start a company with my wife. My finance education has come in handy running the business, but I feel like I would have also benefited from some CS education as well. A half CS/half finance program may have been a good fit for me (not that something like that exists where I went to school). I hope that makes some sense. Obviously it's hard to say where I'd be if I had gotten a degree in CS (or if I'd have made it out alive!); hindsight is of course 20/20.
- jacquesm 16y agoThat makes perfect sense, thank you!
- tnorthcutt 16y agoYou bet. It's very much an individual thing, but I also think that with a CS background, you're more likely to be able to create a "sky's the limit" situation for yourself financially. More potential for knocking something completely out of the park, if that makes sense. Of course, the very best people in finance will also be able to write their own ticket. I think the real focus should be on what makes the most sense for an individual given their personality, learning styles, and situation.
- katovatzschyn 16y agoIt seems many simply wish they had gotten a different degree in general. It may just be a "grass is greener" scenario. Or like somebody who learns a lot of math knows: when you finally understand something and look back it seems trivial. Following that, worth less than some not understood problem.
- nerfhammer 16y agoYou need smallish goals and little projects that you actually care about. Start with javascript for some UI effect for your blog, for example. Starting with a whole PHP/MySQL site may be too much at once. And let's face it: the first few sites you create are going to barely work. I am a database expert but it took me a really long time before I understood SQL well enough to be comfortable with it, and a really long time after that before my skills could gel enough to really take off quickly. But along the way I had a continuous need to use databases. After time your smallish projects get increasing ambitious. Javascript can't do something you need, move up to PHP. I "learned" languages by reading books or even taking classes but I have long since forgotten everything that I never actually had a need to use in the real world. I "learned" C but I remember things from javascript that I learned 12 years ago because I've actively used javascript on and off since then. You need a CS degree to answer some programmer interview questions and as a quality indicator for kids right out of school, but plenty of really solid developers started learning by taking up smallish web dev tasks that became increasingly and increasingly ambitious over time. To get really good it takes years and years of doing this though.
- GBKS 16y agoTwo things come to mind for me. Flash 6 was how I learned programming. I realized I could create visual patterns and animations through code that I could never do by hand. The visuals were my goal, coding was what I had to learn on the way. Copying and stealing is the best way to learn for me. Whatever I need to do, somebody has done something similar. So before I start, I find a code example or tutorial. First thing is to get it to run, then I make small changes until it does what I need it to. This second approach works great for other things than coding, too. Taking apart and imitating successful designs, for example, is a great learning experience.
- jgrahamc 16y agoThis doesn't just apply to programming. You need to have a concrete goal when learning anything. That's what'll motivate you to actually spend the time learning. That's how I learnt to speak French. It wasn't because I wanted to speak French, it was because I needed to. And you can only learn something by doing it. That applies to coding and speaking a foreign language.
- orblivion 16y agoAs DHH said, that's not true for everybody. Some people are really just curious, and aren't afraid to "waste" the time it takes to play around with it. I'm exactly like you though.
- wccrawford 16y agoI guess I took that for granted. I never read things expecting it to teach me to program. I read things to figure out how to do what I currently wanted to do. Now, I read things to see what new ideas and libraries are out there... But it when it comes time to learn them, I use them.
- atldev 16y agoDisaster can also be a great teacher: Long ago, I started work at Oracle with 2 cohorts. We were asked to install the product locally as a sandbox to work in and learn. The install went flawlessly for my 2 buddies. My install was a disaster, and it was the best possible thing that could have happened. I learned more over the next 2 days of frantic troubleshooting than most learned over the course of 6 months. My cohorts laughed at the time, but they never caught up.
- sahillavingia 16y agoExactly. You can't program by "ok, let's learn the syntax, now let's move onto strings, now objects..." you need a project, and then it's 100x easier to learn what you need to know. You'll never know everything, but that wouldn't have happened if you went the other way anyways. Even after a year of iOS programming, I still consider myself a beginner, and I probably always will be. There's nothing wrong with that. :)
- edw519 16y agoWhat made it click for me was programming in anger. Programming because I needed to. Programming because I gave a damn about what I was writing and I wanted it done sooner rather than later. What made it click for me was programming in fear. Programming because I needed to. Programming because I gave a damn about my customer being satisfied and I wanted to get paid sooner rather than later.
- points 16y agoI don't understand anyone who doesn't learn because they're curious. Because it's fun. Because they enjoy it. Intellectual curiosity. It must be very odd programming 'professionally', only as a job and not as something you love first and foremost. The problem with learning anything IMHO is when you don't enjoy it enough to want to learn it. And maybe that's a good signal that you shouldn't. Things are so much easier when you love what you do.
- mahmud 16y agoYep. Same here. I waited tables and coded on my break for fun. Didn't even think it could be a career, since I was self-taught.
- BrandonM 16y agoLearning to program is pretty darn fun. Learning brand new paradigms is pretty awesome. Building things in new, better, easier ways as you get knowledge and experience is wonderful. Learning how to program in a language with a similar amount of power to one that you're already intimately familiar with is pretty darn frustrating. It's hard to be intellectually curious when you're just learning new rules for the same game. It must be very odd programming in your spare time, not getting paid for something that is inherently laborious and valuable. There are too many other people, places, and things that I love first and foremost to list programming for free as one of them.
- points 16y ago> " There are too many other people, places, and things that I love first and foremost to list programming for free as one of them." This is something I think that is a great sign of someone who you should/shouldn't hire. The best interview question is "So what side projects are you working on out of hours?". If they shrug and answer 'none', politely show them the door, yet it's surprising just how many programmers don't seem to have/want side projects - I guess they're doing it for the money rather than the love of it. Definitely, life's about balance - spending time with family, living, eating, sleeping, etc but it seems like real hackers genuinely enjoy hacking, and want to play - even out of hours.
- jrockway 16y agoThis is more a description of "how to type in code that appears to solve today's problem". But that's not programming, that's code monkeying. To learn how to write real programs, you need to read real programs. Is Emacs bugging you? Open the source and see how it works. Web server crashed? Read the source and fix the bug. Not sure how to configure cron? Take a look at its config parser! Many "programmers" spend their entire life treating everything as a black box. Take a look inside the box! That's how you really learn to program.
- jshen 16y agonice strawman. If you have a real concrete goal, and your web server crashes, you'd try to fix it just like you say.
- helium 16y agoActually, I don't believe that was what DHH meant. Everyone is going to write a spaghetti mess starting out. The only way to learn from that is to write more and more code(that you'll need to maintain) and teaching yourself what well designed code is and why it matters.
- BrandonM 16y agoDefinitely this. I got a BS in Computer Science and started along the path of Software Engineering while working towards my Masters. Learning some good fundamentals helps, but my code was still a mess. Writing code that you'll actually have to look at again is the best way to become a good programmer.
- awakeasleep 16y agoYou could disagree with anything if you tried to. But can you see any merit to the 'need a goal to guide your learning' point of view?
- shadowsun7 16y agoThat wasn't the point of his counter-argument. That a stance has some merit does not raise it above criticism.
- fohlin 16y agoI've just left a workshop at our CS department, where we discussed new and old issues with teaching programming. Tutorials and assignment, based on completely made up cases and requirements, are still very much at the core of introductory programming courses. This is in sharp contrast to what DHH says in the post, as well as comments here and elsewhere. May I be slightly selfish, and ask a question to all of you who have a CS degree? Did you learn programming as part of your CS education? Regardless, what's you opinion about the way programming was taught?
- ghurlman 16y agoThe best CS classes I had drove a single project through a semester, with the lessons applying to the next development tasks you needed to undertake. By the end of the course, you had a reference project that you could carry forward, and even continue to work on if you wanted to.
- jbarham 16y agoI studied CS at the University of Toronto in the early 90's and in hindsight I'm amazed that we never formally taught how to program. (The one exception I can recall is a "theory of languages" course that gave us a brief exposure to half a dozen languages, but it was an optional course and wasn't part of the core curriculum.) We were basically given assignments by the profs and it was assumed that we would pick up programming in the tutorials with a little help from the TAs! Personally I had the benefit of having done a fair bit of programming in high school and on my own (Amiga AMOS FTW!) so I survived but I know it was very difficult for students who hadn't had any programming experience prior to university, and the drop-out rate from the CS program was very high (> 50% IIRC).
- fohlin 16y agoThat's very interesting! With that hindsight, can you identify any quick wins that could have lowered the drop-out rate, or helped your personal understanding of programming?
- 16y ago
- mironathetin 16y agoWell, sound a lot like Peter Norvigs "Teach Yourself Programming in Ten Years". Enjoy: http://www.norvig.com/21-days.html http://www.norvig.com/21-days.html
- Locke1689 16y agoIntellectually curious for the sake of it. I envy you. Is this really that rare? I think I've always been that way.
- orblivion 16y agoI feel the same way. Though I wouldn't call it angry. I really wish I could learn out of intellectual curiosity (I'm trying to do so with Haskell at the moment) but I can't help feeling like it's a waste of time. I'd rather do something useful. Or at least interesting, as an end. I love reading about new languages, I just can't seem to take enough interest to learn them. I'm going to try to do my next non-critical project in Haskell, see if that works.
- ptn 16y ago"Programming in anger" is a very odd way to put it. I think it's best to say "programming because you need it".
- ziadbc 16y agoLearning to program is a function of interest, need and willpower. It is fun to dabble and be curious, but curiosity will not get you through some of the minutia that it takes to build a real app, and thats when need and willpower get you through to learning. One breakthrough for me was realizing that programming is now a social activity. You have to meld with the hivemind to really get anything done, and while its good to have a mental framework of whats under the hood (I recommend the book 'code' by charles petzold for those without formal engineering training) it's more important to realize how to model all the abstractions that are part of modern software. As paradoxial as it sounds, understanding abstractions is often works out to be alot like 'code monkeying' than theoretical computer science.
- zackattack 16y agoI learned to program to solve problems or create things. I don't enjoy learning a new language for its own sake; I might invest some time doing proactive learning because it will help me solve problems down the road, but that's it.
- aneth 16y agoI think this is generally true of anything not involving mortal danger. If you want to learn how to do something, just do it. You will always fail at first, but you will learn.
- jarin 16y agoThat is exactly what I tell everyone who asks me that question!
- zwetan 16y agolet me add a little something programming is about languages and tools, whatever is your anger or need, some are more approachable than others my dark beast for 10 years have been C and by extension C++, got this kind of stupid idea that to be a "real" developer you have to know how to program in C and true for 10 years I tried to learn C/C++, just learning it for fun or curiosity, and for 10 years it went nowhere, could not wrap my head around it I was just giving up after a couple of weekends, losing interest, and that was to blame on the fact I was just trying to learn it for the sake of knowing it, I didn't really needed it and then on a somewhat big open source C++ project I found a little bug (really a shit of bug that can be fixed in 2sec), I could compile the project but not really write C/C++, but still could fix that bug that's what I would call "anger", knowing that this stupid little bug can be fixed in no-time by someone like me (being a total noob) but from this "anger" came a very unexpected thing on my day to day work, wether it's ActionScript, Java, PHP, Python, etc. I can code it in my sleep, sure there are still some bugs and complexities, but still nothing that I can consider impossible because trying to add features to that big C++ code base, was something very hard to do for me and to some extend "impossible" or "how the hell I gonna do that", it ended up being extremely rewarding and a kind of an obsession so my little contribution would be to add: it's not only about the anger and the need, it is also about how hard it is for you to do it yep, hard is fun the harder the better ;)
- city41 16y agoWhy is this post receiving so much attention, just because DHH wrote it? It has basically no content and is extremely fluffy. I find the 37signals blog in general is often like this. Sometimes I wish HN stories could be downvoted.
- code_duck 16y agoGood question - HN doesn't usually go all weak at the knees for 3 paragraphs.
- omnigoat 16y agoMy first, my very first C++ project, started in Year 9 - coming from VB6 - was a 3D graphics engine. Yeah, that failed. It failed 5 times (fun fact - the fourth rewrite occurred moments after exclaiming "oh those are references!"). But the 6th one was pretty neat! I'd written a file-loader for 3D Studio Max, an event system, input, etc. The seventh rewrite would have gotten rid of the hardware T&L and used shaders instead. I was in Year 12 by then. Then I went to uni, studying CS, and afterwards got a job at a video games company, implementing a 3D graphics engine. Honestly, sometimes you just have to do it, even without any training. Maybe do it six times.
- bl4k 16y agoHe might want to adjust the grammer of the title so that it is past-tense Or he could leave it and I am sure a screenshot of it will pop during a flame war about rails :) (or somebody will respond 'Try PHP, David')
- ojbyrne 16y agoFrom 2000-2004 I was kind of a dabbler in the web dev world. Built crappy sites for many clients that really didn't go anywhere, and so I concentrated on doing things as cheaply and as fast as possible. Then the whole Digg thing happened. I learned about scaling "in anger." And keeping up with programmers that were smarter than me at the task at hand. I probably learned more in 2 years than I had in the 20 years before that. Now I find myself dealing regularly with programmers that didn't go through that experience (and managers who embrace that "cheap and fast" ethic). I try to control my disdain.
- meric 16y agoPowerpoint was how I got into programming. I tried to make an adventure game out of powerpoint slides and hyperlinks, see, but when I hit the limit of powerpoint "programming" I started on BASIC, which worked much better.