Learn to Code: Recursion
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.
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.
Congratulations @jonwilson! You received a personal award!
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:
Vote for @Steemitboard as a witness to get one more award and increased upvotes!