I have a new, secret software project. Secret because I fantasize about actually making money off of this one and it's still in the early stages and I don't want some goomer with lots of free time taking the idea and building it before I do. Let's just say it's music-related, but also ties a lot of my other interests together.
But what I came here to say is that:
There are two types of magic in programming
1. Controlled Magic
This is when you tell the computer to do something that seems hard and complicated, but it manages to do it anyway, with minimal instruction on your part.
I like this kind of magic. It makes life easier.
Examples:
- Traditional Unix commands
- apt-get
- Deno
- JQuery
- Makefiles, if you avoid implicit rules
- My secret project
Of course in the process of doing its work, any program will do things you didn't explicitly ask it to, like allocate memory, write to caches, 'do IO/O', make your CPU hot, and so on. What makes it controlled is that these side-effects ('non-functional side-effects', I call them) are somewhat standard and contained. *every* program uses the CPU. So long as the CPU doesn't overheat, running a program will not functionally interfere with other programs.
You might not even call this magic, reserving the term for the second type. Maybe you just call this "automation", "useful abstractions", or "a handy library." But I think it's useful to mention it here to differentiate it from the other kind, which is
2. Auto-Magic
This is when the computer goes and does a bunch of stuff without you telling it to. Sometimes you're glad it did it, but it leaves you not knowing how to control it.
Examples:
- PHP magic quotes
- Smart bulbs that talk to servers in China
- Web browsers that guess how to interpret HTML based on heuristics
- "user-friendly" Linux distributions from the early 00s (they often had installers or GUI apps that set things up to 'just work', such that the best way to get things working again after you changed some hardware was to re-run the installer)
- What every PHP framework I've ever used aspires to do
- Gradle
I really don't like Gradle.
Can I just not 'apply plugins'? Is that where the magic comes from? I will try it.
I think bad programmers like 'auto-magic' stuff because they don't know what they're doing anyway, so as long as the computer's just doing random stuff without the programmer understanding why, may as well have it do more random stuff!
Anyway, I know there are loads of examples of either types. I should add more as I find them.