Ask HN: Non-technical people, how did you learn to code?
I'm currently trying to learn to program with the traditional route (tutorials, books, screencasts and a lot of practice) but I'm looking for people who've tweaked this route. Stuff that supercharged their learning. I know this is a coder's community, but I also know that there are a lot of non-technical, very smart people reading.
So non-technical people (no math geniuses or coders who learnt coding when they were 8) how did you learn to code? What was an uncommon approach that helped you a lot? How would you mentor/teach a friend (who's completely non-technical) to learn programming?
Please don't get me wrong: I'm not looking for an easy, learn programming in 48 minutes approach. But I'm questioning the traditional route of learning to program.
(I also started a Forrst discussion about this, but aimed mainly at designers, here http://forrst.com/posts/Designers_how_did_you_learn_to_code-vtM)
57 comments
[ 4.1 ms ] story [ 130 ms ] threadThe biggest thing to remember is to have a real problem you're trying to solve with programming. Just going through tutorials isn't going to teach you how to program. And then Google until you figure it out. I found it works best to get something functioning, and then go back and read the documentation or book about why it works how it does.
In my case, I started a company and didn't have the money (or desire) to find a developer to work with. So I sat in front of my computer and struggled through it. I had an actual problem that I wanted to solve.
If you're currently puting reports together by hand, see if you can write a bit of code to do the repetitive part. If you need to filter a stream of articles, see if you can weed out the easy 80% using word matching, or some other heuristic you develop. If you have a spreadsheet to do your budgetting, see if you can replace it with a program that can fetch all the available data, and spit out relevant results.
Monetary motivations don't really count. No doubt it helps, but it won't compel or make you strive to become a better programmer or make something truly great.
Working with/getting personal help from someone more experienced than yourself is awesome. The trick is not to bother them with (to them) trivial questions, but show that you have put in the work and ask them for their guidance.
Look over experienced coders shoulders any chance you get, and talk to them, to understand their way of thinking. I think this kind of learning has a lot more leverage than doing yet another tutorial.
http://news.ycombinator.com/item?id=2995733
Luckily, I was tasked with developing a whole bunch of forms for a client-server application, which the IDE helped me out with a lot with its WYSIWYG editor, and the programming work was relatively easy (no I/O, no DB access, etc).
The keys for me were:
1. Having a mentor early on
2. Flattening the learning curve with an IDE.
3. Choosing the right project
[1] Copy examples, and tweak them to understand how they work.
[2] Program a game or a puzzle. (Here I'm talking about a simple game like Tic-Tac-Toe, not a full-fledged PS3 of XBox game). Programming something that is purely for fun provides a lot of gratification and reward. The joy of seeing the result is what propels you in spite of the frustration of error and failure. Plus, since you're in control of the project, you can focus on the fun stuff and postpone or skip boring things. For example, have a go at writing a Sudoku solver, or Cryptoquote, or Mastermind.
I learnt to code at 14 after asking my GCSE ICT (as in, Word, Excel, and FrontPage—that's the sad state of IT education in the UK) teacher what the "header files" I saw in the Deus Ex SDK were. He introduced me to Java, and, to be very cliché, the rest is history.
The main "textbook" I read was "Introduction to Programming Using Java"[1] (then in its fourth edition), which goes at a very easy pace and explain things well (I love this book, maybe its the nostalgia goggles but I'll never forget it and what it taught me). I'll add that I didn't have the Internet at home at the time; I had only a handful of resources to help me and all problems I encountered I had to solve by myself. Very "grindy".
If I were to start over, I'd probably go for a much nicer language such as Python, and use its tutorial[2] as well as Mark Pilgrim's Dive Into Python[3][4], and then move onto Django.
Basically, the best way to code is by coding—think of something to build, then build it, ideally trying a different way. Remember to read documentation and other (ideally smarter) people's code and follow (and, importantly, try to understand the reason of) best practices.
[1] http://math.hws.edu/javanotes/ [2] http://docs.python.org/tutorial/ [3] http://diveintopython.org/ [4] http://diveintopython3.org/
Then I took data structures and programming because I liked that first class so much. In between the two classes I taught myself from material for a 1 credit course that converted matlab people to Java.
From there, it's worth working on a couple projects. You'll have built a few by following the introductory Python tutorials, but pick something you're interested in and actually build it. It doesn't need to be a huge project, something small will do. Once you understand the syntax of the language and why you use specific concepts, building something helps cement that knowledge.
Once you've built a few of your own programs, you'll have a better idea of what you're actually interested in, and what you can do. You won't need to follow a specific route by then, you'll be able to learn what you want to learn. I'd suggest that you pick up a functional language next. Haskell does a great job of packing in a LOT of computer science concepts, especially on the functional side of things. Follow the same process you did with Python. Start with a couple introductory tutorials, then build a couple programs.
If you've got Python and Haskell under your belt, you're really ready to tackle anything you can think of. Learning a new language will be easy. You'll find deep library support for pretty much anything you could want to do. From there you really can pick anything you're interested in and built it or learn it.
I don't mean you should start solving equations in your spare time. I just mean find a concrete problem that you're motivated to solve (i.e. something fun), and then solve it.
Maybe you think AI is cool, so try to figure out what it takes to make an interactive chat with the computer (easier than it sounds). Maybe you think computer graphics are cool, so figure out how to make a web page that has a ball bounce when you click it.
Above all, make the path interesting and fun for yourself. You'll get a lot further that way than you will by reading books or watching screencasts that brainwash you into the author's (or the programming language's) way of thinking. Most of programming is a transferable skill set anyway.
That's what I mean by becoming "technical". Just make something you think would be cool, and when you're done, make something cooler.
And if you don't know where to start, just remember this: Google is your friend. Search engines will point you to plenty of material you can copy-paste, and will answer 99% of coding questions you could possibly have. After 15 years of coding, there's still not a day that passes when I don't look up how to do something.
And of course the biggest thing is to try to put in 1-3 hours a day of practice. Coding a problem you have solved before is not practice. Always be pushing yourself. At first this is very easy since everything is new, just code 1-3 hours a night. But as you get better continue to try to learn new things, code problems from a book you're reading, start learning a programming language that challenges you, implement new algorithms, refactor and improve something you've written etc. Essentially practice is very closely related to humility.
Put in enough hours of true practice and you will be a better programmer.
I also should add that I did find taking formal classes helpful (and it can help with pushing you to realize how much you don't know, force you to practice etc). People make a distinction between autodidactic and formal learning, but really the best solution is both, and they are not mutually exclusive so there's no reason not too.
That doesn't apply to actually programming. If you're building something, and you have the time, more hours in the day is generally better. If the focus is on learning, 1-3 hours is probably good for most people, and something that's easy to keep up with for years.
Somewhere along the way I found Perl, and the way from A to B was not paved with incantations. It took me a copy of Randal Schwartz's "Learning Perl" and a Christmas Holiday to get really hooked — the immediacy of thinking and doing and making mistakes and fixing them was paramount to my believing programming was not only for the initiated.
While I second all the recommendations for having a mentor and working closely with knowledgeable people, I disagree with putting IDEs in the middle and choosing PROJECTS (more on that on a second). I sincerely think there's a great benefit to shortening the path between you and running code, and I believe dealing with compiler errors and linker spewage can be detrimental to the overall purpose of getting acquainted with code and thinking about programs.
About projects: having something as a goal is definitely a must; I don't object to that, but to all the baggage the term _project_ carries. Have something around which you'll structure your thought, but allow yourself to tinker and to put it in the backburner if it proves itself to be not challenging enough or too daunting a task for your current knowledge level. If you're neither having fun nor being challenged, you won't improve.
If you want specific tips on what tech to use, it would perhaps be better if you told us what you want to achieve. Do you want to code for the web, to take your designs to the next step, to code simple workflows?
Practice. You'll think you understand something, to only realize a few weeks later you don't. Just gotta keep practicing until you really get it - it takes a few 'Oh i think i got it..nevermind's
When you get stuck, try to answer it for a while, but if you are truly stuck - raise your hand and ask for help. Ask friends, or Stackoverflow.
The great thing about Stackoverflow is that explaining why you are stuck will help you better understand the problem. As you get better, you'll notice your questions get better.
To echo what others have said, having a problem you need to solve is paramount to succeeding. If you're just reading a programming book, being introduced to totally foreign concepts that you never put into practice, you won't get anywhere.
Based on your background (looks like design and electrical engineering), I think you'll do fine.
Some of my first projects were: - A directory (basically just listings on a map) - A customer survey - A todo manager - A wordpress plugin
All simple projects, but all things I was able to use. When you first start, sometimes you have to reinvent the wheel a bit just to get some practice (it's not like any of the aforementioned haven't been done a thousand times). What you're looking to develop are fundamental skills:
- How to design a relational database - How to design a non-relational database - How to query said database - How to work with strings (splitting, imploding, etc.) - How to work with arrays and loops - How to work with objects etc. etc. etc.
As you keep adding new tools to your arsenal, you'll wake up one day and be really surprised with what you know.
...And as a few others also said - stay humble. You can be proud of the things you create - but just look around every once in a while and find someone better than you. You won't have to look very hard.
1. Do every exercise, type in every bit of code, DO NOT COPY-PASTE.
2. Make the code run, fix all the bugs.
3. Repeat until you are done. Do it 1-3 hours a night.
That's it. It's an old method: repetition and practice to build base fundamentals so you can apply them to more complex problems. For the very beginner this works better because the topics are incredibly simple, but their experience and understanding needs work. By making them just type it in, then explain it, I get them experienced and bust through a lot of fears about learning something new.
Hope that helps.
The short version: in 1999 I was a junior Graphic Designer and was given the task to build our first website. At the time i thought programming was too abstract. The site was done entirely WYSIWYG in Dreamweaver and total crap but it was online. After a while we saw some cool effect somewhere on the net and I had to implement it on our site. It wasn't that hard, actually, and it soon appeared to me that my way of using graphic design/dtp programs (I knew most keyboard shortcuts by heart, used almost exclusively the keyboard and numerical values to manipulate objects, didn't use rulers…) was actually quite abstract compared to what most of my co-workers and friends did.
After that I just gave myself tougher and tougher challenges until I "pivoted" to become a full time Web Developer.
The whole transition took 8 years of reading books and tutorials, trying, failing, trying again. But maybe you are more on a hurry?
Writing code is the real key- think of writing at least 50 lines of code a day.
This process takes about a year.
From there I changed the paths so the style.css pointed to its location in the folder. I'd do the same thing for any .js scripts. After getting it running locally I would deconstruct the site (remove and add back various pieces of code) to witness how one thing relates to another.
I myself, need to jump on frameworks. I'm too stuck in my comfort zone of design and front-end skills.
Before that, I tried every book I could find, religiously watched the latest Railscasts, Peepcode screencasts, etc. and watched every free tutorial out there. Until I started working on something that I needed and just plowed through it until it was built, nothing truly clicked. It also helped that I locked myself in my attic for three weekends straight to get my first "real" project done - setting aside that kind of time to focus is huge...
Just pick a small-ish project that is personally relevant and hack your way through it until it's reasonably functional. Also pick a language that is fairly simple and readable (I chose Ruby, but there are lots of good options) and a problem that isn't too difficult at first (e.g., a straightforward CRUD app will build confidence before moving on to bigger and better).
Also, you'll see a ton of recommendations for the "next big thing" (e.g., Node.js) on sites like HN and you'll be tempted to run from one new language or framework to the next. Try to avoid that if possible. I think the key is just picking anything that can get you as close as possible to solving the problem you're trying to solve. Later on you can worry about finding the ideal tool for the job.
I should note that I'm not a pro developer by any means, but I can hack together prototypes and simple apps fairly quickly coming from a similar background to you, and this is the way I went about it...