I become a transparent eye-ball; I am nothing; I see all; the currents of the Universal Being circulate through me; I am part or particle of God.

Ralph Waldo Emerson

Wearing Socks to Starbucks

I hate writing tests. I so hate writing tests. They're just gross. Pretty important, of course. A lot of gross things end up being pretty important.

 

When I was interviewed for the job I currently have, they had me talk to about half a dozen different people over the course of a couple hours. A few normal engineers, a few senior engineers, the VP of engineering, and some 'culture fit' rep. Everyone except the culture fit rep (?) (!) asked me about tests.

"How would you write tests for this?"

"What testing library do you like to use?" 

"You familiar with TDD?"

"Do you usually write tests?"

"Do you code and then test or test and then code?"

 

Whatever dude. I hate tests. 

You see, Test Driven Development is all the rage right now. All the rage. What it means is that basically you write tests for your function/app/program/whatever before you actually build your whatever. Like if we were going to make a calculator or something, we might write a test like this:

describe('Calculator', () => {
    describe('add function', () => {
        it('should add two numbers', () => {
            expect(add(2, 2)).to.equal(4);
        });
    });
});

Blegh. That might not even be a well written test. I'm not a natural. Anyways, the idea is that you write a bunch more of these puppies and they all fail. And then you can start building your actual whatever, and you build and build and build until all the tests pass. And tests are pretty helpful in the long run. Like if you want to add a feature or fix a bug or something, you can know with some certainty that you didn't mess things up too badly if your tests still pass when you're done. 

 

Writing tests kind of frames the whole 'building something' journey so that it becomes, "Ok, what is the thing that will pass these tests?" It helps shape the new thing in slightly more concrete terms. Whereas the calculator we were going to build might have initially entered our heads as "It's done when it can do math problems for us!", now it's more like "It's done when it passes these tests." It helps to be forced to think very carefully and methodically about the requirements of the result. This kind of thinking helps with big goals in life, too. 

 

To innovate or reinvent, I think you've gotta get down to the fundamental requirements and play around with them and question them and chew on them for a bit.

Recently I bought some... footwear. They are called Skinners.

Colors_white-600x600.png

Admittedly, I haven't met anyone who says they look good and most of everybody thinks they're pretty lame. I really like them, though. Skinners' website says "Socks or shoes? Neither, yet both." Which is about the most unhelpful classification of all time ever. Are they shoes?

 

If we set out to build a Shoe, then we probably ought to write some Shoe tests. Our Shoe will be a shoe if it passes our tests. What kind of tests would be appropriate here? We could say our Shoe is a shoe if it has shoelaces. But of course that's silly. A lot of shoes don't have shoelaces. Shoelaces are a feature of some other kind of shoe. There must be something deeper that our future Shoe and that other kind of shoe share for them to both be called shoes, yet not both have shoelaces. Well one property shared by all shoes seems to be that they go on our feet. See, that's a good start. It's a good start because it's so basic it almost feels like we shouldn't have to say it, but I'm telling you we can't build anything if we aren't willing to drop everything and go down to the most fundamental requirements. 

describe('Shoe', () => {
    it('should go on feet', () => {
        expect(Shoe.location).to.be('feet');
        expect(Shoe.location).to.not.be('arms');
    });
});

A lot of possible tests we could write for our Shoe would end up being aesthetic-specific. They wouldn't really help us get down to the very basic requirement of a shoe. We could test for shoelaces, we could test for rubber soles, we could test for leather soles, we could test for complete inflexibility like the old wooden shoes, or we could test for complete flexibility... shoes you could bend and twist in every direction. Hm. Hang on. Those sound like socks. Well that doesn't really matter because one thing could fall into multiple categories just like I'm a husband and a father and a son and a brother all at once. But if you have a completely flexible shoe, is it still a shoe? Or is it only a sock? 

How do socks and shoes differ? Maybe that will tell us if a completely flexible shoe could still be called a shoe. Here are some ways socks and shoes differ that I came up with:

  • Shoes are durable. You can walk for years on all manner of surfaces and your shoes are ok. Socks would be damaged if treated like shoes.
  • Shoes protect feet from the ground. Socks provide some superficial protection, but it doesn't feel like their intended purpose is protection. I am not scared to walk on things that would hurt my bare feet if I'm wearing shoes, while I would be scared if I was only wearing socks. 

If you strip away all the aesthetics, maybe a Shoe is a 'thing' that you put on your feet to protect them from the ground. Something that doesn't fall apart when things get rough.

...
it('should protect feet', () => {
    let FootInShoe = Shoe.applyTo(foot);
    expect(FootInShoe).to.be('protected');
});
it('should be durable', () => {
    expect(Shoe.lifetimeInDaysOutside).to.be.above(365);
});
...

And maybe since Skinners meet these requirements we can call them shoes?? Your call. 

 

First day of work I find out I'm on a team of 5 and one of the guys is there just to write tests. GO FIGURE. 

Where are you going?