

Ask HN - what is the best method to learn how to code? - pennyfiller

I'm a business guy but I want to learn how to code as a frontend developer.<p>Which method is more effective?<p>1.  Should I learn by doing?  I have a website and want to improve it.  Will I be able to teach myself by trying to fix features?<p>or<p>2.  I pick up books and start from scratch?  And only then, after reading the material I will be ready to make something happen?<p>Please advise.  Thanks!
======
clyfe
I'm not sure what you mean by "frontend" so I'll make a wild guess.

Start with some lightweight tutorials about creating web pages (static
content): <http://www.w3schools.com/html/default.asp>
<http://www.w3schools.com/css/default.asp>

Creating dynamic content (programming) is a whole different issue (
<http://norvig.com/21-days.html> ).

Start with learning procedural programming:
[http://ocw.mit.edu/courses/electrical-engineering-and-
comput...](http://ocw.mit.edu/courses/electrical-engineering-and-computer-
science/6-00-introduction-to-computer-science-and-programming-fall-2008/video-
lectures/)

<http://www.greenteapress.com/thinkpython/thinkCSpy/html/>

And then experiment with a simple web framework:
<http://webpy.org/tutorial3.en>

The learn workflow shold be a combineation of: read some -> do some -> try
some -> read some more -> experiment some -> read some -> continue

This is just a startingpoint, there are many topics to web development, from
javascript for interface interactivity to distributed systems, message queues,
scaling ( I'll write this link again just for kiks
<http://norvig.com/21-days.html> ) etc.,

The resources are for the Python language, personally I prefer Ruby, but the
resources for "learn programming" are more evolved in Python as it has bean
adopted as a teaching language by many schools/universities.

PS. Exercise oriented: <http://learnpythonthehardway.org/>

~~~
pennyfiller
wow! this is really helpful!

------
gdl
It depends on your goals and learning style. If you're just looking to be able
to tinker a little bit with existing code, or learn best by doing, then
jumping right in is probably the way to go. If you want a deeper
understanding, and to avoid making as many beginner mistakes and poor
decisions, books are a great way to pick up "best practices" without wasting
time going through all of the worst practices first. But lots of people have
found success with each approach so if one way fits your learning style
better, by all means go with that one.

And really, the _most_ effective route is to do both. Focusing too much on
doing without the book knowledge results in creating terribly awkward
solutions to problems that have been already been solved. On the other hand
It's easy to follow along with a book and fool yourself into thinking that
everything makes sense while lacking the experience needed to figure out how
to put all the little pieces together to create something useful. As is usual
in life, balance is key.

------
hasenj
A combination of both.

When you try to do something, you'll always find yourself stuck in the middle,
and that's when you'll google stuff.

And then you'll find tutorials, or blog posts, or what have you. And as you
read more of those, you'll see references to books and other
tutorials/posts/essays.

Start by just doing, and you'll eventually end up reading a lot.

------
eswat
Both? Many books have coding exercises in them and I find it very difficult
personally to retain all the knowledge I’ve glanced over in a book and be able
to apply that in execution without having done any coding in-between.

------
zootar
New to programming, you should probably get a book, start reading it at the
beginning, and do some of the exercises. As soon as you think you understand
how to do something, try it on your website. Pretty soon, you'll find you know
enough to learn by doing, reading tutorials, etc.

What you want to avoid, whether you choose method 1 or 2, is the idea that you
can write your first lines of code as a useful part of a real project. To
learn effectively, you have to be willing to implement some examples,
experiment, and throw some code away.

------
dpio
It's a constant cycle of learning and applying. You can't retain the knowledge
without actually doing the coding. I'd say, read enough to know the basics
(maybe chapters 1-2?) and then jump into your IDE and code away, then when you
hit the knowledge wall go back to the books and continue the cycle. I guess my
main point is that 1 and 2 go hand-in-hand. hope this helps!

------
drallison
It's complicated. The art includes much more than just "leaning to code"--
design, algorithms, analysis, testing, interaction styles, psychology, and
more. I believe the best approach is an apprenticeship. Find someone who is an
expert and work with her/him on several complex projects.

