Tag: imperative

Using Inductive Vs Deductive

Oh was I stuck!

Today I continued an exercise that asked for me to write Underscore functions. The exercise gave me a description of what the function is supposed to do and then it gave me test cases.

I tried to write code that was generic enough to cover all the test cases. I was using deductive reasoning. I was stubborn and stuck on it for an hour! I did have intrusive thoughts that this exercise was too hard, and I was way over my head and that I won’t get farther. Yet I also felt that I could do this!

I took a 30 minute break.

When I came back, I decided to take smaller steps. I decided to work inductively (which to me feels like working backwards). I took 1 specific test case and wrote it out imperatively. Then I rewrote it to be less specific from the 1 test case and more generic.

I did this with each test case, and I completed the function!

I have more exercises to go, but now I recognize I can try deductive or inductive thinking to figure my code out!