- Abbey Normal Tech
- Posts
- Writing Code as Writing Experiments
Writing Code as Writing Experiments
A Strong Hypothesis Can Improve Your Code
Writing Code as Writing Experiments
Luciano, writer of the Fullstack Bulletin, recently featured a great article called To be a better programmer, write little proofs in your head. It’s got a lot of great tips, but it is heavily math-based.
If you know me, you know my background is not math theory, but it is experiment design theory. So instead of proofs, I’ve been writing hypotheses. I remember being surprised when I found out other people weren’t doing that.
A Strong Hypothesis Can Improve Your Code
To design an experiment, you start with a question.
Will adding an aria-live
attribute produce the right amount of announcements for a screen reader user?
Will fixing this typo fix this error?
Does my red border not show on this <p>
element because of another border declaration somewhere in my CSS?
Then, you turn that question into a hypothesis, or proposed explanation in a short, clear sentence. Because we’re not looking to gather statistics to measure the relationship between variables, I find my coding hypothesis is usually an if/then (or when/then) statement or direct statement.
If I add aria-live
attribute to this <div>
, then a screen reader user will get an announcement when the text inside the <div>
is updated.
If I change “varaible” to “variable”, then the error will go away.
The red border is not showing up on my <p>
element because there is another CSS declaration overriding the red border declaration I just wrote.
A good hypothesis starts with what we know and what we want to find out. It provides a clear way to test it.
To test this, I will add an aria-live
attribute to this <div>
, turn on a screen reader, and trigger an update to the text inside the <div>
. I’ll know it worked if the screen reader announces the new text.
To test this, I can rewrite “varaible” to “variable” and see if the error is gone.
To test this, I’ll use DevTools to toggle off every declaration that could affect my <p>
element. I’ll know it worked if I see a red border around my <p>
element.
Approaching writing code and troubleshooting this way makes it a lot easier to keep track of what you tried. Like writing proofs, it’ll “hone the kind of logical thinking that will serve you well when working with complex systems.”

Feed Your Brain
Tech | AccessibilityAnimal of the MonthWe attended the Georgia Aquarium’s Sips Under the Sea, a late night event. I loved seeing all the sleepy animals. A couple of my favorites were these alligators, basking directly underneath a heat lamp. ![]() |

Maintain Your Brain Jar
Physical HealthThe tea drinkers may be on to something - l-theanine has some surprising health benefits. | Mental HealthThis month, I learned that people often do literally nothing during their breaks, so I’ve added the peak neurodivergent self-care activity, floor time, to my repertoire. |
Reply