I’ve seen the question many times “Why do you care so much about reuse?” So giving my reusable answer I say “when you do something from scratch you have a new chance to make the same mistakes.” (1) If you look at your daily work, you will see we already reuse more than we realize.
When I go looking for images for “reuse” what I find most of the time are clever projects where you take a used plastic bottle and make it into a planter, or an egg carton becomes a place to start seeds.(2) What I want to talk about today is reuse for the same purpose, e.g. reuse like a hammer, a tool that you use to pound and shape the environment over and over.(3)
Why do I care about reuse? Reuse is a company’s greatest asset; it is the accumulated knowledge over time. No one talks about “reusing a wheel” but that is what we are doing, we are reusing a highly successful concept.
So how do we get into the wheel house?(5) The first step is to identify a need, something that you (or ideally many people) need to use / do regularly.
When writing tests I frequently need to get my model to a given “state” before the test can begin. Creating the test vectors to do that manually is time consuming and error prone.
Once you have done that, think if there is a way that the task can be automated.
The solution I found was to leverage an existing tool, Simulink Design Verifier, and use the “objective” blocks to define my starting state. The tool then finds my initial test vectors to get me to where I want to be.
As described right now, this is a “proto-wheel.” It is a design process that I use (and have taught customers to use) but it is not fully reusable (yet). Why is that?(6)
Horseshoes and hand grenades(7)
This fails the “wheel test” in 2 fundemental ways
- It isn’t universal: every time I use it I need to recreate the interface, e.g. manually define the goal state
- It may not work: there are some conditions for which this approach will not find a solution.
Becoming a wheelwright: doing it right
If you want this to become “wheel like” you need to address the ways in which it fails. Here is how I plan to do that.
Create a specification language: by creating a specification language I, and my customers, will be able to quickly define the target state. Further, the specification language will ensure that errors in specification do not enter into the design
Analyze the design space: when a tool doesn’t work there is a reason; in some cases it can be deduced through mathematical analysis, in others, through analysis of failure cases. I am currently “tuning the spokes” on this wheel.
But will it roll? What is my (your) role (8) in making it happen?
In the end, a good idea and strong execution is not enough. The key to widespread reuse is getting it used by people outside the original (in this case testing) community. Until you do that it is only a specialty hammer.(9)
Getting those outside people to adopt a new tool or method is about getting people to care about the problem and the solution.(11)
Picking up a “hammer” is a 4 step process
- Know you have a problem: sometimes when you have been done something one way for a long time you don’t even realize there is an issue.
- Know there is a solution: if you don’t know hammers exist you will keep hitting things with rocks. It gets things done but your hand hurts.
- Have time to try out the solution: even the best hammer can be slower than your trusty rock the first few times you use it.
- Give the hammer maker time to make you a better hammer: chances are even the best tool will need refinement after the first few users.
Final comments: Why now?
Reuse reduces the introduction of errors into the system. Remember, “when you do something from scratch you have a new chance to make a the same mistake.”(13) And when working remotely during Covid, the chance to do so increases. Start looking at the tasks you do regularly and ask the need and automation questions.
- My wife Deborah always raves about my strawberry rhubarb crisps. But even after making over 100 of them over our 25 years together, I still can get the sugar to corn starch to lemon ratios a bit wrong if I don’t watch what I am doing.
- From a total energy usage I do question if we would be better off just recycling the bottle and egg carton.
- I started to think of the song “If I had a Hammer.” As it is a Pete Seeger song, it isn’t surprising that it is about civil and social rights. As a kid, the line “I’d hammer out love” seemed odd to me; hammers were blunt tools. When I got older I saw the other uses of hammers, to bend and shape things, to knock things into place. When you write software, write it like it’s a tool that can do all the things you need it to do.
- As a child of the 80’s “U Can’t Touch This” (hammer time) was at one time on nearly constant replay on the radio.
- First, make sure you are developing in an area that you know well so you know what needs to be done over and over.
- When I started this blog, I referenced the serial novels of the 19th Century. There are times I am tempted to end a blog post on a cliff hanger, but not today.
- When I first wrote the section title I thought “this must be a modern phrase” as while horse shoes have a long history, hand grenades are relatively new (e.g. 200 year old?) I was wrong. The earliest version can be traced back to Greek fire (or earlier)
- Homonyms, as a lover of puns, have always been something I have loved.
- If you thought I was done with the hammer metaphor you were wrong, I’m bringing it back at the end to drive my point home(11)
- Because that is what you do with hammers
- A blog post about this methodology would be one way of getting people to know about it.
- And in the spirit of reuse, I reused this from the start