One of the questions you ask yourself when you do anything that involves programming computers, is when to write a computer program, and when to just do things manually.
Suppose, for example, you need to put a list of names in alphabetical order. If there are only five names, it’s easiest just to move them around in your text editor. But if there are a million names, you definitely want to use a sorting program. Somewhere between those numbers there is a crossover point.
For tasks as common as sorting, you usually don’t need to do any coding — somebody has most likely done that for you. But there are many cases where nobody has written a program for you. And then you have a choice to make.
How do you decide when a situation calls for writing a computer program? I used to think this was a question that called for cool headed and dispassionate logic.
But now I realize that there is usually another factor to consider: Programming is fun! Even if it takes longer to do something by writing a program, I might decide to write a program anyway. After all, something can take longer, yet still make the day go faster.
On the other hand, it might be interesting to come up with a real solution to the question of when to solve a problem with code, as opposed to brute force. I think I might just have an algorithm…