MONTREAL — AFTER almost 20 years as a working book critic, I’ve come to accept that my line of work is basically a relic of another age. Book buyers now prefer the collective “wisdom” of Amazon reviews; newspapers and magazines, struggling to survive, are devoting less and less space to book matters; and writers are being forced by the economics of the Internet to give their opinions away for little or nothing.

The realization came almost two years ago, at the start of 2012, and if I’d had the option then of crawling into my dusty room of first editions and dying, I might have. But as the single mother of an 11-year-old boy, there was a life to build, and bills to pay. So I was motivated when I came across a magazine article arguing for the importance of “code literacy.” Inspired, I signed up for a yearlong programming course at Codecademy, an online educational start-up in New York City.

The first surprise of learning to program? I actually enjoyed it. Yes, programming is challenging, frustrating and often tedious. But it offers satisfactions that are not unlike those of writing. The elegant loops of logic, the attention to detail, the mission of getting the maximum amount of impact from the fewest possible lines, the feeling of making something engaging from a few wispy, abstract ideas — these challenges were familiar to me as a critic. By my third month, I had internalized a new logic, a different way of looking at information. By the time summer came around, I was learning about good web design by constructing web applications, taking them from simple prototypes to something sophisticated enough to test with users. And by the end of the course, I knew the basic structure of computer operating systems.

Now, I was never going to be a career programmer. Though I got into it with the idea of getting myself out of a financial pinch, it turned out to be unnecessary. I managed to transition from a book critic to a features writer.