top | item 46411186

(no title)

chrisoverzero | 2 months ago

> […] it shouldn't take long at all for people to learn the highly consistent naming conventions that tip you off to what type of data is being handled.

I’ve used languages with an approach like this. The difference in what I’ve used is that you separate the conventional part from the rest of the name with a space (or maybe a colon), then only refer to the value by the non-conventional part for the rest of the scope. Then the language enforces this convention for all of my co-workers! It’s pretty neat.

discuss

order

fuzztester|2 months ago

I don't get your 2nd sentence: "The difference in what I’ve used" ... Can you give an example, and name the language used?

chrisoverzero|2 months ago

Sure! Let’s say I want to enforce that a variable only ever holds an integer. Rather than put the conventional prefix and the name together, like this:

    var intValue = 3;
…I separate the conventional prefix with a space:

    int value = 3;
…so now my co-workers don’t need to remember the convention – it’s enforced by the language.

(I hope this makes the joke more obvious.)