Rockwell Schrock

Home // Posts // Projects // About


Rubber-Duck-Driven Development

April 17, 2023

Today, I sat down to some code I wrote a week ago. I came across the assignment:

loading?: true

"Huh," I thought. "This is confusing. This isn't really an indication that anything is actually loading. In fact, we show a fake loading state for 500 milliseconds, while we sleep and wait for the text input to debounce before actually loading anything. This variable just controls if the indeterminate spinner is visible. I should document that."

+ # Controls if the spinner is visible
  loading?: true

"Wait a second..."

- # Controls if the spinner is visible
- loading?: true
+ spinner_visible?: true

And magically, through the power of rubberducking, it was made better.

As always, Jeff Atwood already nailed it.