Learn to Code: Recursion

in #technology7 years ago

DrawingHands.jpg

What I Learned from Rereading "The Little Schemer"

A few years ago, I tried to work my way through "The Little Schemer," a popular book for beginner Computer Science classes. I read in a review somewhere that the book taught what recursion was all about.

I thought I understood recursion--it was just looping over something, repeating a process until you're done, right?

But a few weeks ago, when I picked up "The Little Schemer" again, I realized that I had missed the main point. Recursion, in programming, is the process of building complex things from very simple things.

For example, in math, you can start with zero, the number one, and addition. And from those three simple things, you can build every whole number. Add one plus one, and you get two. Two plus one gets three.

And then you can add subtraction to get all the negative integers. And then throw in division, and you get fractions. With a few starting things, you get a very complex system.

So as I worked my way through "The Little Schemer" for the second time, I realized that's what the book is all about. They start with a few simple elements, which are called primitives. They are also known as data types and operations. And with these, they build an entire programming language.

And then I realized that all computer languages are built this way. It's just that when we start learning to code by learning a higher-level language (like Javascript), we learn all the functions that are useful. We learn how to do things with the language, but not about programming itself.

We can miss out on learning design patterns, which are (according to Wikipedia) "general, reusable solutions to commonly occurring problems within a given context."

And that is what "The Little Schemer" is all about. When we see how to start with simple things, and the ways we make more complex things, we learn the design patterns. So when we approach new programming tasks, we start to recognize where we can use a design pattern; it will be different from language to language, but the ideas are the same.

This doesn't mean that everyone should start by reading "The Little Schemer." Personally, that definitely did not work for me--I was frustrated, and didn't figure it out until after I had worked with Javascript. That's when it all made sense.

In other words, sometimes the best way to learn something is to find the way that you enjoy the most, that makes you the least frustrated. For me, adding the theory after practicing building things with the language, and enjoying it, made the most sense.

Sort:  

Congratulations @jonwilson! You have received a personal award!

1 Year on Steemit
Click on the badge to view your own Board of Honor on SteemitBoard.

Upvote this notificationto to help all Steemit users. Learn why here!

Congratulations @jonwilson! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

SteemitBoard - Witness Update
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Congratulations @jonwilson! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

You got more than 10 replies.
Your next target is to reach 50 replies.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Hive Power Up Day - May 1st 2021 - Hive Power Delegation
Support the HiveBuzz project. Vote for our proposal!