To Boldly Go: Pairing into the unknown with Rust

One of the most important skills a developer can cultivate is the ability to face the unknown.

It is not possible for a developer to know all the things. Even if it were, her job is to build what hasn't been done before. This requires being comfortable in the presence of the unknown. She must use the resources at her disposal to define the undefined, and draw from that airy nothingness, a useful solution to a need.

“The poet's eye, in a fine frenzy rolling, doth glance from heaven to Earth, from Earth to heaven; and as imagination bodies forth the forms of things unknown, the poet's pen turns them to shape, and gives to airy nothing a local habitation and a name; such tricks hath strong imagination.”
- William Shakespeare

How is this best accomplished? Should she memorize reams and reams of theory, syntax, design patterns, data structures and absolutely every byte of techincal knowlege that is known to humanity?

It'd be helpful. But it's not Agile.

Massive front-loading of knowledge is not different from massive front-loading of technical specifications. It's wasteful. There are bound to be items learned that will not be used. There are bound to be other items that no matter how complete the list is, are overlooked. Time is the one real currency of development, and this method wastes time.

There is an additional problem: When she learns technical theory without any real practice, it becomes harder for her to leverage that knowledge in the context of actual creation. If she learns by doing, making mistakes as she goes, and fixing them herself, she'll learn not only the theory, but all of the unspoken additional details of using that theory to build something useful. In short, she does no rework.

Don't bother learning theory, then un-learning it so that you can re-learn it in practice. Just experience it, and learn by doing.

A more agile way of doing this isn't to spend 4+ years front-loading information. Instead, learn what you need just in time. Learn how to research quickly and apply that learning immediately. As you work this way, you'll develop two useful things.

  1. You'll build up a background of experience that is ready to use in the context of development.
  2. You'll develop your encountering-the-unknown kungfu and be ready to build something no one has built before.

But how far can we take this?

Should we really start with just no front-loaded information? Trust in our ability to figure it out?

I tried the extreme of this at Rust Los Angeles.

I know practically nothing about Rust. I don't know it's syntax or how it runs. I didn't even know it is a compiled language until I started using it. All I knew was that Rust is a systems language that combines the speed and efficiency of lower-level languages like C with the security and convenience of higher-level languages like Python.

At the meetup I paired with Krystal @kammitama5 on the first hello world problem from exercism.io. Before we could start, we needed to get exercism set up on her local computer. She had rust already.

reading carefully and following the instructions was all that was required here, but its surprisingly difficult to discipline yourself to do that and not try to jump ahead.

The set-up was successful, so we were able to $ exercism fetch rust which gave us the files we needed.

TDD, at least the kind used for exercism was not unfamiliar to me, but the syntax was. Krystal was more familiar with systems languages, so between us we had most of the tools necessary to succeed.

We read the GETTING_STARTED.md file, following the instructions, which were like the other hello world exercises I had done.

This got us to passing the first test. But the problem came with the next two. The readme did not include any more example syntax after the first test, so we needed to find resources to help us understand how to pass an optional variable into the function. Google searches were not helping as we did not know exactly what we were looking for. Our wording for the nature of the problem was wrong for google.

So we leveraged another resource. We asked the event organizer, Herman @hjr3. He helped out by explaining Option match and format!() and then offered a solution using them.

pub fn hello(name: Option<&str>) -> String {  
    let n = match name{
        Some(name) => name,
        None => "World",
    };

    format!("Hello, {}!", n)
}

The tests passed and we pushed it to Exercism, but in retrospect, I felt like it didn't count since we had to ask a human in the room. Silly? Maybe. The work got done. But you won't always have an expert standing there. The two of you need to be able to figure out the unknown from resources that are always at your disposal. Nonetheless, the help was appreciated.

What we got hung up on was the syntax. We needed to learn a little more about Rust's syntax in order to solve the problem on our own.

In this case, we could have come back to the issue after reading a little of The Rust Book. It wouldn't have been the exact same solution Herman came up with, but it would be valid and we would have understood the language better for doing it on our own.

So how far can you take pairing into the unknown? Pretty far if you --

  • Read carefully.
  • Follow instructions.
  • And don't get ahead of yourself.

Basically, be present and patient with the error message and the unknown. We could have taken this even farther if we brought our patience to the next level. If we had the patience to sit there and read The Rust Book together, we probably would have come upon a solution before long. Maybe 15 to 30 minutes of reading would have brought us to a good answer.

All-in-all pairing into the unknown is very useful. It doesn't mean you can know nothing at all. Some front-loading is still required, but you certainly need less than you think.