I tried to find if someone had asked this before, and they probably have, but since the words "separated" and "spaces" were involved, I could only find questions on how to separate a string with space characters.
I guess what I mean is, when reading other people's code, I've seen lots of times that some tend to write among the lines of
a=1+(3-sqr(1/567));
or
for(int i=0;i<=limit;++i){}
or
if(val1>=val2&&val1<=val3) {
doSomething(arg1,arg2,arg3);
}
I think you get the idea.
The thing is, I personally find this style harder to read. I have even found myself making a copy of the code I'm trying to read and writing the spaces just so I can read it more easily. For example, I would go from
a=1+(3-sqr(1/567));
to
a = 1 + (3 - sqr(1 / 567));
which I'm almost certain is objectively easier to read, at least easier for me. And suffice to say, I tend write my own code in this "easier to read" style.
So, am I wrong for doing this? Is it just matter of style? Or is there a bigger reason for this? Is it compiler or interpreter related? I'm sure it wouldn't hurt performance to write with separation when writing in c or similar languages since the source code will be compiled into machine code anyway. But, would it hurt performance if I did this when writing in Javascript or Python since they are interpreted on the fly? I've seen some developers write a minified version of their scripts with single character variable names and almost no separation, which is no doubt harder to read. Does this increase performance? And, even if it did, wouldn't it be worth it to write clearer since, although it would slow performance a bit, it would increase readability and therefor speed up development?
Thanks for your answers.