There has been a lot of discussion of why people should learn to code, or more accurately program. Yes, it is good for them because it teaches how to think and how to plan. But the real reason for learning to program is known all to well to all us programmers but we try hard not to mention it in such discussions - POWER!
What motivates people to learn science, engineering and similar subjects?
If you want to be high minded about such things then you can ramble on about how knowledge is a reward in itself and the persuit of knowledge more so.
When it comes down to it, however, things are a little more basic. What knowledge provides is power - power over the world and over other people.
Why do you want to be a chemist?
The honest answer is to blow things up and perhaps at a slightly more acceptable level to impress people with bangs and flashes.
Happy 4th of July!
Why do you want to be a physicist?
See chemist only bigger.
Why do you want to be an mathematician?
OK, the argument breaks down here.
Perhaps this is one reason why people are so happy to admit that they don't get math even though nearly all of the time they really mean arithmetic.
There are times when we take up some activity or behavior because it is intrinsically rewarding, but much of the motivation for young people getting involved in STEM subjects is because they provide a route to power that is otherwise denied.
You can get power over other people by being strong, tough, charismatic, good looking and so on. But if these things are not in your grasp then being a geek is a good alternative. In other words< if you can't be any of the obviously desirable things just be useful. Going a tiny bit further if you can be useful you can also be in control.
OK, scientists can blow things up - what can computer scientists do?
If we interpret this as a more general "knowing about computers" then the answer is a lot. An evil geek can destroy your life (in theory at least) and a good geek can win it back for you (in theory at least). Knowing about computers can make you useful to people in ways that convey tiny bits of power to your persona - think of it as power points in a game.
This is what attracts people to learn about things - anything.
Think how much more useful and powerful it would be not only to know how to switch a computer on but to talk to it and command it to do things.
This is real power.
Being able to program gives you a much better internal model of how the computer does things and as such it generates a "mechanical sympathy" that means you can solve problems that others don't have a clue about. You have sympathy with the way that the machine works and as such you know a bug when you see one.
But there is more.
As a programmer you can make the computer do new things and at no additional material cost. The theoretical physicist is the most privileged of all physicists because they only need something to write on to explore the universe. All the others need to ask grant committees for large sums of money to do what they want to do.
The programmer has it even better - they only need a programming language to build mechanisms that really do something. You don't need a lathe or a milling machine you can create new gadgets just by writing code. Of course recently even this has moved on a stage and now with 3D printing you can create really real things with nothing but code (and a few reels of thermosetting plastic).
As the enthusiastic programmer moves on in life they discover that not only can they obtain power points from their peers but real money from just about everyone. The mythology of Bill Gates, Steve Jobs and now Mark Zuckerberg blur into the idea that with software you can make the transition from a penniless nobody to a billionaire somebody - and all you need is code
You literally can go from nothing to something with code (in theory); the fact that few manage it isn't really relevant.
Paul Allen and Bill Gates at work
Today this myth is becoming tarnished by the idea of the "startup". Instead of creating your masterpiece on your own time - like Bill Gates and Paul Allen or Steve Jobs and Steve Wozniak - and then selling it, you pitch an idea to a group of investors and then use their money to create the product.
This seems to be a perversion of the process, designed to allow non-programmers to use other people's money to do what they cannot do alone.
Fair enough, but it is important to keep the myth, that the programmer can do anything from nothing, alive and well - otherwise why not just go and get a education in business and how to pitch an idea.
The real reason we program, is for power and the ability to create money from nothing.
if we want to encourage students to be students of programming we need to show them the "big bangs" - or at least appeal to them as something achievable.
Yes, of course, you will be able to hack the bank and steal all the money you want.
Intercepting the emails of your biggest enemy - no problem.
Create a website where lots of people with sign up to be your friend - easy.
Write something that does something cool with music - yes.
Program a killer robot - with a little help with the electronics, but yes.
OK, none of these things are with in the reach of a beginner (and perhaps not the expert) but it's motivating just like the promise of creating TNT when you start chemistry by boiling some water in a test tube.
We don't need to make programming cool - it already is, of course.
What we need to do is point out how learning to program is a way to, in the words of Dale Carnegie, win friends and influence people.