

Ask HN: How did you learn to code? - rsearles

I&#x27;m fairly new to HN, and have recently started teaching myself to code. So far I&#x27;ve used Codecademy and General Assembly&#x27;s DASH tool. I&#x27;ve also heard good things about One Month Rails.<p>What would you all recommend as far as inexpensive online resources? Or would you suggest I save up the money for a hacker bootcamp? Thanks!
======
srean
I apologize for the length of this post, I post this only because this might
bring a perspective that might be a bit new here: of Linux in India way back
then.

If its not appropriate here I wouldnt mind at all if its downvoted so that it
does not take visible real estate. This is from a mail I wrote some time ago.

\--

As you would know my background is not in EE or CS but in manufacturing where
we had very little hands on experience with computers. We had a course where
we learned FORTRAN and that was about it. In those days, a pc magazine used to
distribute redhat in a CD. I think the first one I got my hands on was version
5.2. The mighty 486s in college used to command a lot of respect, and as lowly
undergrads we weren't allowed to touch them. I owe Linu[x|s] and Stallman a
lot of gratitude because much of what I learned about how a computer works was
not from a course but actually digging through the linux and GNU system.

This was also quite normal for all linux users then. The whole point of using
Linux was to figure out how things work and change things to your liking.
"Change" meant editing a file and compiling, not pushing mouse buttons. If you
wanted a system that worked [or not], there was always windows. It was very
confusing to hear anyone complain that not everything worked right out of the
box on Linux. The whole point of Linux then was then to poke around and re-
tool it, it was not even expected that everything will work. It was a
rudimentary car, that came with an excellent set of tools, a workshop and a
manual.

If I were to choose a single word to desribe the linux user base that would be
"curiosity". A lot of that has changed, now many use linux not because it
allows them to learn and tinker, but because its a better windows. I dont
begrudge the fact, it shows Linux has matured.

One of my first forays into personal programming was because of a printer.
Printing would always make me cringe because I could not get economy mode or
two-up. I barely new C. Over multiple trips to the printer room to check if
the patch worked, I finally got it to run. In the process I learned the the
entire path from the point one types "lpr filename" to the bits dumped on the
network. I also learned how pretty code can be. Deutsch's ghostscript code is
one of the most beautiful C code around, atleast to me then. I think only way
to pick up good coding style is to read good code.

To give an example how bad the scenario was then: if you wanted to install
something that was not on the CD, doing an apt-get install (or rpm) was out of
question over the 2B/s dialup we had then. So I had to hack up a p2p file
distribution system for rpms. It did signature verification and multiple
parallel downloads of the same file broken up into chunks. All I can say is
that it did not become napster :) But I learned a lot. Till before that I did
not much know what a network even was.

I wrote it in TCL (writing that in C would have been way beyond my league) and
contributed a patch for TCL's FTP client. Given that I was a complete novice,
and that this worked at all and that I, a complete clueless newbie could
actually contribute anything was unimaginably gratifying for a manufacturing
engineering undergrad.

TL,DR Was taught quite a bit by the GNU and Linux sources

------
luckydude
I think I learned to code by having login on slovax. slovax was a VAX 11/750
at the University of Wisconsin-Madison during a time when there were a ton of
hackers there. Many of them went on to Sun.

slovax was the machine that had the 4BSD source on it and somehow, I have no
idea how, I got an account on it.

Blah, blah, blah, all my memories don't mean shit. What is maybe interesting
is how you might learn from reading source. Most of it is pretty boring,
<string.h> I'm looking at you, the kernel source is getting more interesting,
but for me the place where the light came on was the bowels of libc. At the
time I was too dumb to get the kernel stuff, that was over my head, but I
could figure out libc. Until I came to popen(). It called fork(). My head
exploded - I had never ever thought of creating a subprocess to do my bidding.
Yeah, I'm old, all you guys got this, but at the time (.5MHZ VAX was what I
was reading the code on) the idea that you would spawn a process to do
something in libc was out there. It was the first time I realized that you
could do pretty much anything with a computer.

Same tl;dr: as the other guy. Read the source, lots of good stuff there.

------
chrsm
I hate to be "that guy", I think that taking courses online is a waste of
time.

1\. What do you want to learn? Web development? Systems programming? Native
application programming (whatever the platform)? Figure out what your target
is.

2\. Go to your local book store after you solve no. 1, pick a book up that
involves that general topic, and read a few pages to see if it works for you.
Don't buy a "learn x in y hours/days" book. Buy something you can use as a
reference.

I've found that it is easier for me to focus and understand things when I am
not actually trying to do them at the same time.

3\. Specifically about Rails: I'm not hugely qualified to speak about Ruby,
but the friends I _do_ have that use Rails daily have always told me that
Rails has grown pretty hard for newbies to jump into immediately. Of course, I
could be wrong. I wrote a small project using Sinatra, which is a really easy
way to jump into using Ruby & writing a web app at the same time.

I wouldn't recommend putting any money into bootcamps. You can teach yourself
everything you need to know. The majority of bootcamps I've seen are fairly
expensive for someone without any real understanding of what they're getting
in to, and I would go as far as to say I have seen 0 that would teach anything
useful beyond "learn language x", which you can do on your own - every popular
language has excellent documentation. You should want to learn the
fundamentals, and try to figure out how to apply that knowledge to any
language or situation you come across.

(Hope that helps a bit.)

------
munimkazia
My school exposed me to HTML, VB, and later in high school, C and C++. I got
interested in website development, so I started with ASP, but quickly moved to
PHP because it is easier to get free hosting (I was still a kid with no
money!). I learned everything from my school library books, and free online
resources.

I was exposed to Java and C# in my computer science engineering course, but I
never actually learned much apart from the basics which I needed for the
course itself. Ironically, I didn't pick up on the very things which I was
thought formally.

I learned basic javascript and more PHP stuff (MVC, OOP, templates et all)
when I got a chance to intern in a small start up. I did a few small freelance
jobs after that.

I learned some basic Python and Ruby by myself, and learned advanced
Javascript when I got exposed to Node.js. I learned more Ruby when I got a
small Ruby/Sinatra gig. More Node.js when I got employed as a Node.js
developer. MongoDB/Redis/everything else was mostly on the job.

Linux/Bash was a lot of experimentation, and a lot of practice.

As you can see, the pattern is that I learned mostly by myself: By trying to
do things, and by using online resources. I never read a full book (apart from
the Javascript the Good Parts), and never finished a full online course. I
learned as I worked.

I am not condoning this method, and I don't know if its the best, but it's
what worked for me.

------
geophile
I spent a lot of time teaching myself (in the 70s). Then college courses,
where I learned about data structures, algorithms, structured programming (all
the rage, back then, a precursor to objects), and many other subjects. Then
grad school, and more research, and then a few startups. I kept improving
through all of it.

tl;dr: Do it, study it, do it some more. Do it a lot.

P.S. "One Month Rails" sounds like something you'd want to do later in your
career. If then.

------
chill1
The best way to learn is to have a need to learn. What made you initially want
to learn to code? Is it a business idea? An idea you had for an app or game?

There are many different types of programming; as well as many different
levels.

Web programming isn't going away for a while, and it can be useful for doing
quite a lot of things. I wrote a quick start guide for beginners like yourself
[1] a while ago, that you might find useful.

I didn't even know HTML six years ago, and have been working full time in the
industry for almost three years now. I started out trying to force a piece of
forum software into being a community-based website. I quickly got into
writing custom add-ons for that forum software. I just kept moving further and
further up the food chain until I got to where I am today: being paid to build
multiple, complex web applications.

The toughest part about learning something _completely_ new is not knowing the
right questions to ask. It can be insanely frustrating at times. But if you
can stick with it, all the anguish, self-doubt, and sleepless nights will be
worth it. If you really want something, you can do anything.

[1]
[https://degreesofzero.com/article/70](https://degreesofzero.com/article/70)

------
alok-g
While I did not learn programming this way [1], I highly recommend the
following book to beginners of programming:

"Algorithms + Data Structures = Programs" by Niklaus Wirth:
[http://www.amazon.com/Algorithms-Structures-Prentice-Hall-
Au...](http://www.amazon.com/Algorithms-Structures-Prentice-Hall-Automatic-
Computation/dp/0130224189/)

While example programs are in Pascal programming language (that the author
created), it is still a very well written book that teaches how to connect
real world problems to programming from a beginner's standpoint. It assumes
the least out of the reader of nearly all programming books I know of. Check
out the reviews at Amazon.

[1] My story: I started programming at the age of 11 when my father gifted me
a computer, and its manual. That manual was so concise and precise that I
learned something new from it each time I read it. It ended with a chapter on
writing machine code, which led me to write short programs in machine code
straight by age 15!

------
karmelapple
Since the question is looking for recommendations on how to learn now, I'd say
try out an environment where you can see results that excite you the most. If
you want to see objects on a web page moving around, learn JavaScript. If
you'd like to see fancier graphics, look at Unity and one of its languages.
And if you like text output, you got a huge world of languages you can explore
- just find a topic and problem you want to work on. Being motivated to solve
something was what got me the most excited when beginning to program.

As for how did I personally learn to code?

HyperTalk in HyperCard. It was the best way to quickly see how different logic
constructs worked, since I could manipulate graphics onscreen rather than just
print out text. Shortly thereafter, Learn C Programming in 21 Days.

But once I learned what I could, I took some of the concepts from C and tried
to find some similar way to accomplish that in HyperTalk... which worked for
quite a few shareware projects.

------
avifreedman
Not sure why you're learning to code, but getting into a positive feedback
loop of (have idea, create, tune) is a great thing if you're doing it for more
than 'just a job'.

I'd get proficient with linear flow programming, then functions, and build
some things before worrying about object oriented programming.

Folks I've worked with have had good luck with perl but there's certainly a
strong argument for javascript between web dev and node.js...

Or if you want to go old school fire up BASIC and play with some programs from
[http://www.atariarchives.org/basicgames/](http://www.atariarchives.org/basicgames/)

Not suggesting you should stay at that level (BASIC, perl, etc) but building
the feedback loop of liking the process/having fun can be great to get at the
beginning of the learning process.

------
bobfirestone
I learned to code by reading lots of books, writing lots of code and getting
involved in a local user group.

If you want to learn Ruby and Rails a couple of good resources are Learn to
program by Chris Pine (an intro to ruby) and the rails tutorial by Michael
Hartl [http://ruby.railstutorial.org/ruby-on-rails-tutorial-
book](http://ruby.railstutorial.org/ruby-on-rails-tutorial-book)

Some other books I would recommend: \- Practical object oriented design in
ruby \- Computer science programming basics in ruby \- Agile web development
with ruby on rails 4 \- Eloquent ruby \- Design patterns in ruby

If you get on the [http://oreilly.com](http://oreilly.com) email list they
regularly have 50% off ebook sales.

------
GFischer
The title is a bit misleading :) I guess you don't want to hear about my
experiences with GW-BASIC :P

I think that, whichever choice you take, being motivated and actually doing
stuff will be the best :)

You have to decide on what you want to do first (do you have a startup in
mind? working as a programmer? why do you want to learn to program?).

With programming, just taking classes definitely doesn't cut it, the joy is
wanting to make the computer do something and overcoming the obstacles to get
there (and hopefully getting several "aha" moments along the way).

I think that if I had to start today, there are lots of awesome online
resources (but I don't know them, so I can't recommend any). No idea about
hacker bootcamps.

------
andrewflnr
Heh, "programming for dummies". That told me about how to run QBASIC from my
windows disk, which was a pain. Where I really got started was when the
aforementioned book told me how to do web programming, based on local files.
At that point, I was feeling the power. Someone told me about C++, and I got
"C++ For Dummies" for my thirteenth birthday. I wanted to do games, which led
me to DirectX and then SDL, and also gamedev.net, from which I learned a
metric crapton.

I stumbled on python a few years later, when I started playing with Blender.
The online tutorial for that was pretty good (at least for me, having
programmed before). If you want advice, you might start there and see how far
you get.

------
helpfulElf
I wanted to make things. First I wanted my own web page; so I learned HTML.
Then I wanted to make AIM robots, so I learned perl. First I modified the
source of programs that already worked, then I read the Llama which magically
filled in all the blanks (oh, that's why that keyword is repeated all over!)
Then I wanted to make Facebook apps, so I learned PHP. Then I wanted to get a
job, so I learned ruby, CSS and JavaScript.

I also went to ACE computer camp where I built crappy versions of Tic Tac Toe
in BASIC and completed numerous factorial exercises.

------
eddyparkinson
I would start with a skills test, try to use vloopup in a spreadsheet. If you
can get to grips with vlookup, then look for something that fits with how you
learn, a book, an online course or even making small changes to programs you
find on the web. Java script is probably a good c hoice, as there are online
example around that you can try. But as others have requested, please say why
you want to learn. edit:I started with games, changing code in simple games
created by others. But I was 13, games are important to a 13 year old ;)

------
mehuldesai
apart from actual coding, suggest a foundation like in CS 101. ie algorithm
books (eg O(n) binary/sort) kind of things, perhaps Design Patterns. for lower
level, Kernighan and Ritchie c language is a bible. structured and functional
(eg python) type programming are good to understand. there are tonnes of
cookbooks on the technologies you decide. LAMP and thin b'ends seem effective
for most web systems initially anyhow.

rails an phython are sometimes thought of as next generation languages.
Java/C+ suffer greatly from the amount of scaffolding to do something simple
like have a object used between layers. Python and I believe rails, says it
will do stuff like setter/getters (scafolding), you concentrate on the logic.
php also has some great use, they are untyped languages. typing for java/c++
can be argued as not as necessary as one may think, thats where python, php,
and I believe perhaps Rails (dont quote me on that) say again, concentrate on
whats needed and not having to type everything. if the web results in a
string, then no need to declare that throughout your stack.

anyhow, my 2 cents. not the fastest path necessarily, but over time you may
want to have good code, useable by others and designed reasonably so its not
as hard to get to next steps like scale...

------
CyberFonic
Buy and read "Structure and Interpretation of Computer Programs" aka SICP.
Download a Scheme environment and do all the exercises. Use the multitude of
resources to make sure you actually understand how, why, what.

Hacking with Ruby, Python, C#, Java, Objective C, etc, etc is fun, exciting
but you won't learn the foundation stuff which sooner or later comes up as a
stumbling block.

------
andrewhillman
I learned basics by understanding html + then I dug deeper in dhtml. I
remember looking at demo source files to learn how they worked. I studied
simple code that I could implement. I did this for a couple years. Rather than
read books, I read code then figured how to write my own.

------
teni
The for dummies or Head First Series are good. I generally pick a technology,
have a feel of it(meaning, just learn it on the surface by poking around it)
then learn it in depth if i really need it. Most IMPORTANTLY, NOTHING, I
REPEAT NOTHING BEATS PRACTICE.

All the best.

------
meerita
My level of programming is really low but I've learn to code by having the
need of solve things. I just started to read and practice to solve an idea I
had.

------
davidjnelson
The most important part was reading "learning perl" in 1997.

------
mattkrea
Codeschool and/or Treehouse + reference books will help out most.

------
mycousinvinny
rsearles, are you me? Seriously, this post blew my mind. I'm new to HN, and
have been using codeacademy and DASH (finished full html/css tutorial last
week). Already looking into that One month rails thing and reading the replies
here!

My question would be the best way to plan for developing an iOS app? Should I
be bothering to learn the basics of JS or just skip to jquery tutorials? C++
basics important? Thanks!

