L
LP
After a code review one coworker insisted that global are very dangerous. He
didn't really give any solid reasons other than, "performance penalties",
"hard to maintain", and "dangerous". I think that I am using them
appropriate in class in question. One typical example: This class initiates
TCP session, keeps sending commands to the server app and gets messages and
codes back, message and code are stored in global variables to be preserved
them between method calls.
He insists I should not have any global variables, but instead passes them
from one method to the next. I think it's dumb. What's so bad about global
variables?
Thanks
didn't really give any solid reasons other than, "performance penalties",
"hard to maintain", and "dangerous". I think that I am using them
appropriate in class in question. One typical example: This class initiates
TCP session, keeps sending commands to the server app and gets messages and
codes back, message and code are stored in global variables to be preserved
them between method calls.
He insists I should not have any global variables, but instead passes them
from one method to the next. I think it's dumb. What's so bad about global
variables?
Thanks