👨‍💻
Software Engineering
Tidy First?: A Personal Exercise in Empirical Software Design
Tidy First?: A Personal Exercise in Empirical Software Design
  • Tidy First?
  • Foreword
  • Preface
  • Part 1: Tidyings
    • 1: Guard Clauses
    • 2: Dead Code
    • 3: Normalize Symmetries
    • 4: New Interface, Old Implementation
    • 5: Reading Order
    • 6: Cohesion Order
    • 7: Move Declaration & Initialization Together
    • 8: Explaining Variables
    • 9: Explaining Constants
    • 10: Explicit Parameters
    • 11: Chunk Statements
    • 12: Extract Helper
    • 13: One Pile
    • 14: Explaining Comments
    • 15: Delete Redundant Comments
  • Part 2: Managing
    • Coming soon
  • Part 3: Theory
    • Coming soon
Powered by GitBook
On this page
  1. Part 1: Tidyings

5: Reading Order

You're reading a file, you get to the end and there it is! The detail that would have helped you understand all the rest of the file.

Reorder the code in the file in the order in which a reader would prefer to encounter it.

Resist the temptation to apply any other tidyings at the same time! They can come later. Don't mix.

Be Careful: Some languages are sensitive to order.

No single ordering is perfect. Sometimes you want to understand primitives first and then understand how they compose. Sometimes it's the API followed by the implementation. As the reader, use your best judgement and experience.

What order would you have liked to encounter? Give the gift of that sequence to the next reader.

Previous4: New Interface, Old ImplementationNext6: Cohesion Order

Last updated 9 days ago