DEV Community

Discussion on: What common programming concept has the wrong name?

Collapse
 
stilldreaming1 profile image
still-dreaming-1 • Edited

Pretty much everything in programming could be named better.

class -> type

I think classes reap the greatest benefit from renaming them. It is not helpful to think of things are being in that "class", in the traditional sense of the word. And somehow this also makes people think of hierarchies of classes, but that is not the primary point of classes. They should be called types. The main advantage of classes, is you are not stuck with the types built into the language, you can make your own.

method -> operator

Another way in which classes are actually allowing you to make your own types is they allow you to define the "operators" that work with that type via methods. So methods should be called operators or operations. In existing languages, a type has operations you can perform on it, and that is basically what methods are. Even the order things appear in is the same: name of variable/value/object, operator/method, other variable/value/object if relevant.

object oriented programming (OOP) -> type oriented programming (TOP)

With that in mind, the form that object oriented programming has taken in modern languages like Kotlin and C#, would be better called type oriented programming, or TOP.

function -> action

Functions should be called actions, and a good keyword might be "act" or "action". I think the analogy to math is less helpful than just calling them actions.

variable -> box

A friend of mine was recently learning how to program. He was confused by variables at first, and then later asked why they are not just called boxes. While "variables" does make some sense, once again I think the analogy to math is not the most helpful thing, and "boxes" would be a better name.

Collapse
 
mebble profile image
Neil Syiemlieh

I think calling them types makes a lot more sense than classes. But as for variables, I don't think "boxes" would be appropriate since generally, many variables can be aliases to a single object.

Collapse
 
stilldreaming1 profile image
still-dreaming-1

At first I didn't agree with what you said about variables, but after thinking about it for while, I think I do agree. Perhaps in the case of variables, the analogy to variables in an equation is pretty helpful. I'm still somewhat torn though. Variables in equations typically don't change values, wheres the value stored in a variable can change. Then again, that is mutable state, which is typically an anti-pattern. So maybe you are right.