Photo by Hans-Peter Gauster on Unsplash
Let me start by admitting that the ‘algorithm’ in the title is not an algorithm at all. It’s a loop, the ostensible opposite of an algorithm. I just thought the title was really clever! It is inspired by the quote that motivated me to become a teacher:
“Teaching is the profession that makes all other professions possible.”
Oh yes, it’s an acronym! If you were drawn in by my clickbaitish title, you love acronyms. Let me be clear that I am totally ripping this stuff off! This post can, and should, be viewed as my refined reading notes of a classic text. If this piques your interest, please read How to Solve It, by G. Polya. Even if I haven’t piqued you interest, read the damn book!
Make certain you understand the problem. Read it again. Rephrase it in your own words. Inquire of the person presenting the problem if your assessment is correct. What if that person is you? This is where step one bleeds into step two. Write down all your thoughts on the nature of your problem.
“He who has a why to live for can bear almost any how.” ― Friedrich Nietzsche
If the problem is abstract, make it as concrete as possible. This is the step where you do your homework, research, whatever you want to call it. Who has solved this problem, or one like it in the past? What is the unknown? What are the givens? How is this like other problems you have seen or, better yet, solved in the past?
If you fail to plan, then you plan to fail! This is too pithy and cute not to be true. Pseudo code. There is value in a written plan. An algorithm itself is merely a written plan!
Carry out the plan. Take the step you are able to take in the moment. Work on, and give your full attention to, the step you are taking right now.
This is the step that I, and I think most people, usually skip. It’s probably the most important, but it takes an exercise of willpower to take this step. Another ‘R’ word my fellow aspiring coders could substitute is ‘Refactor.’ This is the step that keeps my little formulation from being a true algorithm. The old adage is that programmers are lazy. I am the first to admit that I fall squarely in this category.