When should i make a function private
and why is it good idea?
You should make a function private
when you don't need other objects or classes to access the function, when you'll be invoking it from within the class.
Stick to the principle of least privilege, only allow access to variables/functions that are absolutely necessary. Anything that doesn't fit this criteria should be private
.