Skip to content

Instantly share code, notes, and snippets.

@emackinnon1
Last active February 21, 2020 18:13
Show Gist options
  • Save emackinnon1/516525d174e7db8b4872c2f7d6f5c9c5 to your computer and use it in GitHub Desktop.
Save emackinnon1/516525d174e7db8b4872c2f7d6f5c9c5 to your computer and use it in GitHub Desktop.
Learning Fluency

Do you know how to problem solve? Well I sure as shit don't.

But I'm getting there.

Today I had an exercise in problem solving from start to finish with an assigned partner at my coding bootcamp. We were given a series of javascript exercises to choose from and we chose this:

Write a function that takes an Array of Booleans and Strings. This function should return a String - the first string that appears in the array that was passed in.

Example:

var variousThings = [
  true, true, true, false,
  true, true, 1, true,
  true, false, true, false,
  true, 'hello', false, true,
  true, true, true, true,
  false, false, 'world', true
];
findFirstString(variousThings);
// => 'hello'

Here was our pseudocode:

-Write a function that takes an array
-Iterate through the array
-Check if it's a string
-If it is, return it

And this was our code with a couple different arrays to pass through:

function getFirstStr(arr) {
  for (var i = arr.length; i > 0; i--) {
    if (typeof arr[i] === "string") {
      return arr[i];
    }
  }
}

var randomArray = [true, 1, 18, false, null, 'fox', 3];
var rado2 = [true, 1, 18, 'truck', false, 'fox'];

We got the function to do what we want, but it was the process through which we got there that was the most important takeaway to me. I personally wanted to put an emphasis on our pseudocode because of how important it is to break your code down, talk about what you it to do in plain English and then translate it to Javascript.

As we become more fluent in Javascript and programming, I see so many parallels from which to draw on in terms of learning a new skill.

I have been teaching myself German for a while now, and one of the techniques I use is writing letters. I start by writing a letter in English and then translating it to German. Laying out my ideas in a language I already understand fully helps to organize my thoughts and be intentional with what I want to say (or in the case of Javascript, what I want to do). Eventually, I'll be able to just write what I want in German.

When I was learning how to play soccer as a kid, we did lots of drills. SO many drills. All the drills.

At first they were to practice the basics. Drills to pass, drills to shoot, drills for headers, drills for controlling a pass, etc. As we got better, those became more complex. We did drills to control a ball out of the air and shoot, drills to receive a ball with a defender on your back, make a move to beat them, and take a shot, drills to drop into the hole to receive a ball and then play first touch passes into space when you see a teammate making a run. We got better at putting the basics together so we didn't have to think about them, and we could make these parts of our game more fluid. Or more fluent, so to speak.

I took a lot of drawing lessons growing up. We had exercises in negative space and exercises in depicting the proportions of a subject accurately. We had exercises in drawing in only shadows, and only light. We broke down all these aspects of the process and did them over and over again until we could do it without having to draw the negative space, then the proportions, then the shadows, then the light; we could do it all at once in one smooth process.

This idea of fluency has become a fascinating process for me as I go through it with more and more things. It's frustrating at times, maddening at others, and can induce a lot of negative feelings about yourself when you aren't where you want or think you should be, but holy shit is it a cool thing when you realize you've made progress, even the smallest modicum of it.

Break it all down and build it up, baby.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment