DEV Community

Discussion on: Stop Using "data" as a Variable Name

Collapse
 
thebuzzsaw profile image
Kelly Brown

I later noticed that I do occasionally use data as a variable name. The scenario often seems to be passing along an opaque byte array. I suppose I could add a little flavor to it by way of receivedData or httpData or whatever context, but I don't know how to improve on that name when that particular method is not in charge of decoding that data.

Collapse
 
dcwither profile image
Devin Witherspoon

I think that falls well into the exception category. byteStream or byteArray may be helpful for describing the nature of the data, but if there’s not a clear intent to the data then I suppose the next option is to make sure that name for it is as short lived as is reasonable.