-- Leo's gemini proxy

-- Connecting to sotiris.papatheodorou.xyz:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

The pre-book learning stage and awk


JBanana mentions the importance of the pre-book learning stage:


> I think there may be a pre-book stage that's important but often ignored. I knew what git was before I used it, but often that's not the case. For example, today I saw a mention of Jupyter notebooks. The Wikipedia page starts off by talking about how to pronounce it, how it's related to some other projects, how it pays homage to Galileo, [...] That's all great, but I still have no idea what I could do with it. What's it for? The project web site is no more helpful.


I wholeheartedly agree, before starting to learn something a general overview of what it is, what it can do, what it's useful for, is needed. One great example of this is in my opinion "The AWK Programming Language" (1988) by A. V. Aho, B. W. Kernighan and P. J. Weinberger.


These are the book's very first sentences:


> Computer users spend a lot of time doing simple, mechanical data manipulation – changing the format of data, checking its validity, finding items with some property, adding up numbers, printing reports, and the like. All of these jobs ought to be mechanized, but it's a real nuisance to have to write a special-purpose program in a standard language like C or Pascal each time such a task comes up.

> Awk is a programming language that makes it possible to handle such tasks with very short programs, often only one or two lines long. An awk program is a sequence of patterns and actions that tell what to look for in the input data and what to do when it's found.


Within the first four sentences you learn that:


Awk is a programming language.

Awk is useful for data manipulation.

Awk programs are typically shorter than those of other languages.

Awk programs consist of patterns searched for in the input data and actions that happen when the patterns match.


Or to put the above in more general terms:


What it is.

What it's good for.

What it does better than other approaches.

How it works.


I think this is a great intro to learning awk. The book then continues in an order similar to "Pro Git", by having the first chapter consist solely of example programs of increasing complexity. This approach worked really well for me, possibly because the relatively simple concepts of awk lend themselves well to being explained by example.


If you've never used awk or only copy-pasted awk snippets after an Internet search I suggest reading the first chapter of this book. Awk is a really elegant design and great at its intended use case, data processing.


Sotiris 2022-06-30


JBanana's post

"The AWK Programming Language" on the Internet Archive.


Update


As very correctly pointed out by Sandra, it's not really pre-book learning if it's in the actual book :D. A more accurate name would be early-book learning in this case. The pre-book learning concept just reminded me of how much I liked the intro of this book and how it helped me understand awk. Up until that point all I knew about awk was that it was some weird scripting language sometimes used in Unix pipelines. Maybe as a community we can do a better job at awk awareness and pre-book learning.


Personally I've done both steering-wheel-first and engine-first learning. Which works best in my case I think depends largely on the topic. Topics that easily lend themselves to abstractions like software or digital electronics I can learn with a steering-wheel-first approach but for others such as mathematics or electromagnetics I find more amenable to engine-first learning. And then there are those things I can never seem to learn, at least for more than a week, like probabilities, statistics or analog electronics.


In any case, I think it's useful to be aware of these different learning types, especially when recommending learning resources or teaching. In that sense "Pro Git" is great because it can cater to both crowds. "The AWK Programming Language", is written in a steering-wheel-first, example heavy manner but I wonder if it could be read in an engine-first order by swapping the order of chapters 1 (examples of useful programs) and 2 (full description of the language with examples).


Sandra's post

-- Response ended

-- Page fetched on Sun May 19 07:03:07 2024