Solving The Towers Of Hanoi Mathematically And Programmatically – The Value Of Recursion

TowersMany programmers don't really understand recursion – it's a fact, I've seen it time and time again. Even when we understand how it works, we tend to only use it by rote, on problems that we expect to have recursive solutions. For example, we know that a recursive function is the best way to traverse a tree in order – it's in every textbook and so that is how we do it. There are other problems, that we can come up with, which have intuitively recursive solutions and we don't have too much trouble with those. It's when a problem is not intuitively recursive, but has a recursive solution, that is where the difference between being able to use it and really understanding it comes out. Incidentally, this also makes a very good case for the value of math skills in a programming context. Let me demonstrate by looking at Towers of Hanoi as a programming exercise.

You Don’t Need Math Skills To Be A Good Developer But You Do Need Them To Be A Great One

MathA little while ago I started thinking about math. You see, I've been writing software for quite a few years now and to be totally honest, I haven't yet found a need for math in my work. There has been plenty of new stuff I've had to learn/master, languages, frameworks, tools, processes, communication skills and library upon library of stuff to do just about anything you can think of; math hasn't been useful for any of it. Of course this is not surprising, the vast majority of the work I've been doing has been CRUD in one form or another, that's the vast majority of the work most developers do in these interweb times of ours. You do consulting – you mostly build websites, you work for a large corporates – mostly build websites, you freelance – you mostly build websites. I am well aware that I am generalising quite a bit, but do bear with me, I am going somewhere.