A Code by Any Other Name

So, over the last several days, we’ve been learning many things that have a familiar feel to them. Struct, for instance, reminds me an awful lot of Class from my PHP OOP.

Today we learned that we also use Class, which is very similar to Struct, only you can do more with it. Makes me wonder why we needed Struct in the first place.

This made me think of questions I’ve always had about the way computer languages evolve over the years. For many years we’ve used functions to sideline repeated code. We still use functions, but when they’re inside a Class (or Struct), they’re called Methods even though we still create them with func keywords.

We’ve always had ‘variables’ for as long as I remember, but these days we have different types of variables – a ‘constant’ is, if you like, a non-variable variable.

When we use a variable inside a method (function) of a class (or struct) it becomes a “property”, even though we still call it a variable.

When we create a new reference to a “class”, we call it an “instance” of that class, except some people call it an ‘object’, apparently.

I sometimes wonder if those who create new computer languages redefine words just to make it seem more complicated and to put off the casual observer.

Then again, I’m so old that I pre-date “functions”. Don’t know what was wrong with a good old-fashioned GOSUB. And even that was considered a young upstart usurping the raw GOTO. Now, if you really wanted to confuse people with your code, litter it with lots of GOTOs. That’ll get ’em. Don’t need all of this renaming of similar elements to do it.