We’ve all heard the term “Wolf in Sheep’s Clothing” before. It represents some malicious entity masquerading as something benign, hoping to gain some advantage. The other day, I came across something quite the opposite when working on HAPP. I was stuck on a problem for a long time, but I ended up with a solution born out of that dilemma. I found a “Sheep in Wolf’s Clothing”.
A lesson I learned a long time ago in software architecture is the idea that sometimes a deferred architecture is the best. Whenever you are faced with indecision in an architecture, it typically is a place where you should encode a customization point, because if you aren’t sure of it now, you can bet you will want to change it later.
The same thing comes up with roadblocks and problems. It takes some mindset shifting, but you have to treat these as opportunities in disguise. I was working on HAPP, trying to get voice commands to work on my new Linux Laptop. However, for those of you who have debugged audio on linux, it requires years of arcane black magic to make heads or tails of what you need. I spent a few days trying to get things to work, using pulseaudio, midi controllers, jack, and so on and so forth to no avail. I want to be able to run HAPP on my linux computer, but now I was finding I couldn’t.
The opportunity here is that maybe my input was too constrained. Yes, the whole point of HAPP is to voice-automate my house, but maybe I needed to expand. I allowed input to be handled in a separate thread from the console. I now had a way to inject commands, test them out, and see the results all though my console.
This opens up a whole new world of ideas. Rather than just making voice commands, I abstracted out the code to allow multiple input methods. Now, I could consider unit testing commands, without needing voice. I could distribute the voice recognition to other processing devices in my house ( like a phone, or what a great idea to start learning about something like a Raspberry Pi). Eventually I would like to have a distributed voice recognition network, so this was a great first step. This also provided a catalyst for me to create a config file to indicate which input methods are valid, which I will need for other things.
So next time you come across a problem, think about what opportunities it presents. Find a way to be creative and let that evolve your program. Don’t skimp requirements (I still have my main voice server working on Windows), but let the pain points guide you in what could be flexible. You may just find your own “”Sheep in Wolf’s Clothing”