Pat Shaughnessy patshaughnessy.net

To learn a new language, read its standard library  ↦

This post by Pat Shaugnessy echoes Matt Rickard’s sentiment that we discussed in-depth on The Changelog 463:

The best way to learn a new programming language, just like a human language, is from example. To learn how to write code you first need to read someone else’s code. But who is the best person to learn from? Which code should we read? Where should we look to find it?

Pat was looking into Crystal and found its standard library to be excellent reading. I think his conclusion generalizes pretty well, with caveats.

  1. Older languages often have areas of the standard library that were written prior to new language features, so they are no longer idiomatic.
  2. Some standard library code is necessarily low-level, even dipping into the underlying language or using esoteric features. This can make for some tough sledding.
  3. Standard library code is used so frequently that it’s often highly optimized for performance, which reduces readability.

Discussion

Sign in or Join to comment or subscribe

0:00 / 0:00