4 ms·
I disagree, depending on the context. Data is an acceptable variable name to refer to binary blobs that don't have a type, eg, this is roughly the low level cla
by reitzensteinm 17y ago
I disagree, depending on the context. Data is an acceptable variable name to refer to binary blobs that don't have a type, eg, this is roughly the low level class that holds data that I'm streaming in (files may either be in a pack file or downloaded while the game is played):
class packFile {
var name:String;
var location:String;
var downloadPriority:Int;
var data:Array<Byte>;
}
There may be a better name than data, but I can't think of one off the top of my head, and it's certainly not a bad one.
- rlpb 17y agoSimilarly, when dealing with a small finite number of data, an integer at the end makes sense too. For example: int add(int operand1, int operand2) { return operand1+operand2; }
- cperciva 17y agoI generally go with buf for a buffer containing unstructured data. It seems a bit more logical, although I'm not really sure why.
- khafra 17y agoIt's more informative. "buf" gives you a few more bits of information about the source and purpose of the data than "data" does.
- dmlorenzetti 17y agoAnother example: in my work group, "data" specifically means "measurements made in the real world." Numbers generated by a computer simulation don't qualify. So in our code, "data" could be a perfectly meaningful variable name. Personally, the worst variable name I've ever seen was "C". This was a vector of concentrations. Unfortunately, the language was Fortran-77-- where a "C" in column 1 indicates a comment line.
- reitzensteinm 17y agoWow, I think you actually may have won. That's a terrible name for a variable given the context. You would probably have nightmares for years after maintaining a project like that :)