Solutions: The Principles of Code Age

Here are the solutions to the exercises in Chapter 5, The Principles of Code Age.

Cores All the Way Down

TensorFlow’s core/lib/core has low package cohesion and could be separated into smaller and more cohesive packages. The threadpool module would go into a concurrency package, while the arena and refcount modules are related to managing heap memory and could be contained together in a new allocation package.

Deep Mining: The Median Age of Code

To calculate a median value, we need to get the age of each individual line of code. This sounds like a job for git blame. We could even add the --porcelain option to make it easier to consume the output.

Get Software Design X-Rays now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.