In both cases one is trying to invoke various barely comprehended supra-(or sub-)human entities, with uncertain results. Magic is hacking gods. Programming is prayer to the machine. And this is not poetic or provocation. One of my favourite books is “Managers and Magic”, an anthropological look at the faith of business that convincingly casts accountants as priests and shareholders as deities. It is a scathing, funny and illuminating critique. Which is what magic, code, and hacking all aspire to. Or should.
Don’t limit your understanding for appearances sake.