Profile picture
Michael D. Hill @GeePawHill
, 21 tweets, 3 min read Read on Twitter
how long?

what amount of time passes between you saving the file you just changed and you seeing the results of that change?
if that answer is over 10 seconds you might want to wonder if you can make it shorter. if that answer is over 100 seconds, please consider making a radical change in your approach.
thinking is the bottleneck, not typing, we've been over this a bunch. but waiting you can bypass -- *all* waiting you can bypass -- is waste.
i know firmware folks who routine wait 20 minutes from save to run. why? because they are running on the target, and that means sending the image to the target, stashing it in the NVRAM and rebooting. every time.
wow, that must be some intricate h/w-dependent rocket science stuff they're working, eh? and sometimes the answer is yes. but i'll let you in on a secret. not usually. usually it's logic that's got almost nothing to do with the peculiarities of their h/w target.
i'm not joking. http and ftp servers, things like scheduling -- *calendar* scheduling, not multi-task scheduling.
before we all pile on, tho, maybe we better check ourselves on this.
do you have to bounce a server or a service inside a container to see your results? do you have to switch to a browser? do you have to login and step through three pages to get to the right place?
do you have to manually or automatedly clear the cache or wipe the database? do you have to go look up stuff in a special place?
do you have to edit a config file, or just quick like a bunny bounce to the shell and type in those same 87 characters again (except for the three in the middle)?
hmmmmmm.
and checking the results. do you do that in the browser, too? or maybe you study the log output. or, again, bounce to the shell and tweak 3 characters of the 87. of course, maybe you don't check the results at all, one does see that from time to time. "it ran, so it worked."
if i don't know whether my change did what i wanted in 10 seconds i get grouchy. sometimes i suffer it for an hour, cuz the change i'm making is the one that will free me to get the faster feedback. but generally, long wait-states between change & results turn me into Bad GeePaw.
the answer, nearly every time, is to use one of several techniques to move your code-you-want-to-test from a place where that takes time to a place where that's instant.
sometimes doing this is a heavy investment the first time. most non-tdd'ed code is structured in one of several ways that make this difficult.
demeter wildness, intermixing awkward collaboration with basic business logic, god objects, dead guy platonic forms, over-generalization, primitive obsession, all of these work against readily pulling your code apart for testing it.
the trick is always one step at a time. remember the conversation the other day about supplier and supplied? start there.
you're either adding a new function or changing an old one, yeah? if you're greenfield in your tiny local function's context, try this: put it in a new object that only does that tiny thing. it sits by itself. declare one in a test and call it. lightning speed.
if you're brownfield, you can do the same thing, but it's harder. the key is to first extract just exactly as much of the brown field code you need to its own method. then generally pass it arguments rather than using fields. now rework it for supplier/supplied changes.
finally, once again, pull it to a new class. note: you don't have to change the existing API to do this. that API can new the object and call it, or if it's of broad use, new it in the calling site's constructor.
the hardest problem you'll meet: high fan-out methods or classes. these are classes that depend directly on every other package in your universe. for these, well, don't start there. :) legacy rework is not for sissy's.
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to Michael D. Hill
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member and get exclusive features!

Premium member ($3.00/month or $30.00/year)

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!