What is Programming?
I will try to explain this as simple as I can. And I want to start by saying that I'm no expert. This is just my humble attempt at simplifying something that may look frighteningly complicated.
Let's initially not involve computers at all. It is a way to tell someone what to do. But you need to give the other person all of the instructions up front. For example imagine you are hiring someone to cook for you but the person you are hiring doesn't know anything about cooking. What will the instructions look like? They will look very much like a recipe. The method described in the instructions should be enough, if followed literally by your helper, to produce your desired output. If it doesn't, the fault is not with the helper but with your instructions.
Let's bring back the concept of computers. Imagine a helper that doesn't know anything about the real world but just a few very simple instructions. Like add a number with another one. Or compare two values to see if they are the same. This is fundamentally what a computer is. And your instructions are its program.
Somewhat simplified there are just X types of instructions that a computer understands.
- Simple arithmetic like addition, subtraction, multiplication and division.
- Comparing of values to see if they are the same or different, or bigger or smaller than each other.
And in turn the computer can perform these actions:
- Output - it can communicate with other computers or users of the computer, or internally between different programs it is running. Another sort of output is to its long term memory, also known as storage. A program can instruct the computer to save something to its long term memory.
- Input - it can receive input from all of the above to guide it's actions.
With this at the foundation a computer can achieve a lot of stuff like handling credit card payments, running your smartphone and keep your car in the right lane.
The art of programming then is to tell a computer what to do so that it can perform a certain task in a reliable manner. If the problem you are solving is small the instructions might be simple. If the problem is bigger like keeping a car in the right lane, you might need to write multiple programs so that multiple helpers can coordinate their efforts to perform the task correctly.
In all of its simplicity this is fundamentally what programming is and how computers work. You use the above fundamental abilities of your helper to achieve countless things. And the difficulty lies in transforming a real world problem with all of its nuances and intricacies into a form where it can be solved with the just the above instruction set.
Because a lot of problems are recurring some people have written instruction lists that can be reused by other programmers. This saves programmers from rewriting the basics and lets them focus on higher order instructions.