Sunday, November 17, 2019

Variables, for non tech folk

Brace yourself for a walk on the wild side.

I was rabbiting on the other day about some aspect of work or another, and after a good 2 minute monologue, got asked: "But, what's a variable?" I realised: devs are like D&D nerds, Accountants or English Lit Majors: there's Jargon. To regular people we might as well be saying "hold on! Frang the meembs before you granang the pfreem".

The concept of variables is much simpler than the concept of say, Money, or Quantum supremacy, but let me have a go at confusing you with a crappy metaphor.

A variable is a holder of some information we care about, and will use later on.



This one is called "TODO"


It now contains some information

That information has changed


... and it's about as simple as that. Make no mistake, we've found ways to turn this whole thing into a huge, complicated issue, but basically, that's it: a thing we name and put stuff in, so we can use it later on.

One of the hard problems in Computer Science (tm) is "naming things". Variables are part of that. We spend a lot of time thinking about things like what to name the variable, using it, and then changing the name to something better once everything's up and running. I'm pretty bad at it. I've named variables "data", "info" "shasummink", "bleeb" etc. And I feel bad about that. But I'm over it now.

No comments: