Hacker News new | ask | show | jobs
by Jtsummers 2617 days ago
Depends on the book, but in general type in every programming snippet and do most (not necessarily all) of the exercises they offer (if they have exercises, if not make your own by changing the provided code to do something else).

I have a habit of using Org mode and creating an outline of the book. Then I type in the code as I go along and use org-tangle to kick out source code that can be run. Sometimes I go ahead and set up monitors (fswatch) to see if files or directories change and run `make` or whatever is appropriate in a separate tmux pane. Stupid simple example, if it were a lisp book and one of the first programs was hello world:

  * Chapter 1
    Functions are declared with `defun`. Everything is in parentheses. Function being
    called first, then the parameters separated by spaces, no commas. "Hello world"
    looks like:

    #+BEGIN_SRC lisp :tangle src/hello.lisp
    (defun hello-world ()
      (format t "Hello, world!~%"))
    (hello-world)
    #+END_SRC
`C-c C-v C-t` would spit out that file so I can run it somehow, or `C-c C-c` would execute it (since emacs and common lisp work very well together).

Ultimately, the key to learning programming is to program. You can learn a lot about a language just by reading a book, but it won't be internalized until you use it.