I'm relatively new to programming (July 2015), and I've always wondered why it's good programming practice to hide variables as much as possible.
I've run into this question mainly recently when I looked into events and delegates in C#. I searched around as to why I should use events rather than just a delegate, since they do the same thing it seems. I read that it's better programming practice to hide the delegate fields and use an event.
I decided it was time to learn why it was good programming practice, but I couldn't really find anything other than "Because it's good programming practice".
If you could provide some basic examples and maybe some pseudo-code that would be helpful.