Ask HN: Is there a way I can learn programming within 4 months?
For absolute beginners I always recommend:<p>If you don&#x27;t have a Mac and are not on BSD or Linux:<p><pre><code>  * set up a Linux machine (this can be a computer running Linux or a virtual machine)
  * install (usually it comes pre-installed) GNU AWK aka: &#x27;gawk&#x27;.
  * head over to https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;gawk&#x2F;manual&#x2F;html_node&#x2F;index.html and start with https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;gawk&#x2F;manual&#x2F;html_node&#x2F;Getting-Started.html#Getting-Started
  * also make sure to read https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;gawk&#x2F;manual&#x2F;html_node&#x2F;Basic-Concepts.html#Basic-Concepts either early on, or when you switch from &#x27;declarative&#x27; to &#x27;imperative&#x27; (see below)
</code></pre>
Why &#x27;awk&#x27;?<p>It is one of <i>the</i> standard, classical UNIX utilities. Learning how to use it will teach you how to use all command line utilities, including &#x27;man awk&#x27;. Since you use the GNU implementation, you will also learn both short and long options&#x2F;arguments.<p>You will also gain basic knowledge of the terminal (navigating paths, etc.)<p>You will also learn the concept of StdIn, StdOut and StdErr.<p>You will learn what a &#x27;stream of data&#x27; is, on a basic level.<p>It has been co-authored by Brian Kernighan. He also co-authored C. The &#x27;awk&#x27; language is a C-family language, which means, that, once understood, you will be able to read the control flow of C, C++, ObjectiveC, C#, PHP, Go, Swift, Javascript, Java, R, D and many others: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;List_of_C-family_programming_languages" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;List_of_C-family_programming_l...</a>. The familiarity to Javascript is exceptionally striking: by just changing a few little things one can run some basic &#x27;awk&#x27; scripts on a Javascript interpreter. Here is an example from [Rosetta Code (100 Doors)](<a href="http:&#x2F;&#x2F;rosettacode.org&#x2F;wiki&#x2F;100_doors#AWK" rel="nofollow">http:&#x2F;&#x2F;rosettacode.org&#x2F;wiki&#x2F;100_doors#AWK</a>):<p><pre><code>  BEGIN {
    for(i=1; i &lt;= 100; i++)
    {
      doors[i] = 0 # close the doors
    }
    for(i=1; i &lt;= 100; i++)
    {
      for(j=i; j &lt;= 100; j += i)
      {
        doors[j] = (doors[j]+1) % 2
      }
    }
    for(i=1; i &lt;= 100; i++)
    {
      print i, doors[i] ? &quot;open&quot; : &quot;close&quot;
    }
  }
</code></pre>
Now remove the &#x27;BEGIN {}&#x27; part, replace the &#x27;#&#x27; with &#x27;&#x2F;&#x2F;&#x27; (or remove the
comment altogether), change &#x27;print i&#x27; into &#x27;console.log(i)&#x27; and put a &#x27;var
doors=[]&#x27; at the beginning of the script. It should look now like this:<p><pre><code>  var doors=[]

  for(i=1; i &lt;= 100; i++)
  {
    doors[i] = 0 &#x2F;&#x2F; close the doors
  }
  for(i=1; i &lt;= 100; i++)
  {
    for(j=i; j &lt;= 100; j += i)
    {
      doors[j] = (doors[j]+1) % 2
    }
  }
  for(i=1; i &lt;= 100; i++)
  {
    console.log(i, doors[i] ? &quot;open&quot; : &quot;close&quot;)
  }

</code></pre>
save it as &#x27;100doors.js&#x27; and execute it with NodeJS.<p>&#x27;AWK&#x27; is more than just a programming language. It is a processor, that has a programming language &#x27;built-in&#x27;. For a novice this means, that the learning curve is very shallow: before you start programming, you will learn some more basics:<p><pre><code>  * what patterns and pattern rules are
  * how to use pattern substitution
</code></pre>
All this happens on the plainest data format, which exists: human readable text! As you have understood these two concepts, and how &#x27;awk&#x27; handles them, you have gained knowledge, that you immediately can use in your everyday&#x27;s computing extravaganza. Much better than learning examples for &#x27;factorial&#x27;, &#x27;fibonacci&#x27;, etc.<p>You should have understood these things in your first few days, if you are totally new to working with a computer on this level, if you already have some primitive knowledge, it is just a few hours.<p>Congratulations, you now are able to do &#x27;declarative&#x27; template programming! Declarative means, that you tell the computer, <i>what</i> <i>you</i> <i>want</i>, <i>not</i> <i>how</i> <i>to</i> <i>do</i> <i>it</i>. It also means, that you do not need to care for file-handling, parsing and string tokenization, etc. yourself.<p>Once you got this, stuff becomes more serious. You now will learn &#x27;imperative&#x27; programming, which means to tell the computer <i>how</i> to do it!<p>&#x27;AWK&#x27; is a very good first language, because it has dynamic typing (which means, that you do not need to care for variable declarations and, especially, typing, which can become a whole topic on its own, so better to leave that for a time, when you are more secure) and only knows about three different types:<p><pre><code>  * string
  * number
  * array
</code></pre>
The function catalog is also very basic. And these functions will reappear, the one way or the other, in all other languages, later on.<p>&#x27;awk&#x27; is &#x27;domain specific&#x27;. The &#x27;domain&#x27; being &#x27;line based text streams&#x27;, which means, that &#x27;awk&#x27; sees the input as a stream of text lines, processes one by one, calling them &#x27;records&#x27; and separating all the words within a line into &#x27;fields&#x27;. Very square, very simple to understand. And you always can load the text into your editor or into a reading program. Or simply dump it to the terminal...<p>We have chose the GNU AWK implementation. This one comes even with a step-by-step debugger built in. This will help you a lot in understanding what went wrong in your program, should that be the case.<p>All in all, you should be able to learn basic programming within 10 hours, plus those hours, that you need to exercise. I would recommend:<p>One hour a day, reading the docs, with half an hour of practice after that and half an hour to an hour of exercise before you go to bed. After about two weeks you should be already quite competent. Just make sure, that you do not start learning the imperative part (that is, the &#x27;AWK&#x27; language itself) before you did not understand &#x27;awk&#x27; as a processor, which means, the declarative part.<p>Of course, you could go directly to Javascript. However, today&#x27;s Javascript is a complex beast, bearing so many concepts and paradigms, that the learning curve is steep. If you know AWK, you already have flattened the Javascript learning curve a lot.<p>It&#x27;s funny, that this topic came up yesterday, because it was just a few days ago, that I realized, how valuable of a didactic vessel GNU AWK (and its <i>excellent</i> documentation!) is for a newbie. As an experiment, I even started to port the AWK functions into a Javascript shim, so porting of pure AWK code becomes even easier!