Skip to Content
Tidy First?
book

Tidy First?

by Kent Beck
October 2023
Intermediate to advanced
124 pages
1h 58m
English
O'Reilly Media, Inc.
Content preview from Tidy First?

Chapter 17. Chaining

Tidyings are like potato chips. You eat one, and you’ll want another. Managing the urge to keep tidying is a key tidying skill. You just tidied; should you tidy more? It depends (we’ll get to what it depends on in Part III).

How big you step will be up to you, but I encourage you to experiment with sticking to tiny tidying steps. Optimize each step. From the outside it will look like you are running, but, like the centipede, you will know you’re taking many little steps.

Tidying becomes a game of chess, with moves visible ahead. Let’s look at how tidyings set up further tidyings:

Guard clause

Once you’ve set up a guard clause, the condition may benefit from being turned into an explaining helper or extracted into an explaining variable.

Dead code

Once you’ve removed the clutter of dead code, you may be able to see how to sort the code into reading order or cohesion order.

Normalize symmetries

Once you’ve made identical code identical and different code different, you may be able to group precisely parallel code into reading order. I did this once with a file containing several web entry points. Once they all looked alike, it was natural to group them at the top of the file as a kind of table of contents to the rest of the code.

New interface, old implementation

Once you have your shiny new interface, you’ll want to use it. If you don’t have the automated rewrite tools to convert all callers, you’ll need to convert them one at a time. This is the first ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Building Micro-Frontends

Building Micro-Frontends

Luca Mezzalira
System Design Masterclass

System Design Masterclass

Rohit Jain Sweet Codey, Suresh Gandhi, Shubham Chandak

Publisher Resources

ISBN: 9781098151232Errata Page