Tidying: Canonical Order
Deep Dives
Explore related topics with these Wikipedia articles, rewritten for enjoyable reading:
-
Code refactoring
12 min read
Tidying is a form of code refactoring focused on small, incremental improvements. Understanding the broader history and principles of refactoring illuminates why canonical ordering matters in software maintenance.
-
Coding conventions
11 min read
Canonical order is a specific coding convention. This article explores the history and rationale behind why consistent ordering of declarations (like variables x and y) reduces cognitive load and improves code readability.
Tidying: Canonical Order
I’m thankful for your support of Tidy First. Here’s a tidying that I don’t think I’ve talked about before. If you’d like me to give a talk to your team or organization, please:
int x, y
…
int y, x
What’s going on here? X is before y in the first line. That makes sense. Is there some difference in the second line that makes y come before x?
One basic princip…
This excerpt is provided for preview purposes. Full article content is available on the original publication.