79574253

Date: 2025-04-15 01:44:30
Score: 1
Natty:
Report link

I've always felt like "internal" should be the default. Unless you're writing a public library there's no need or reason to expose anything at all to the world at large. So many people here have said "You only need to use internal when you want to hide something from the outside world" but I'd turn that on it's head - you only want to use public for stuff that you expect to be called from the outside world. Unless you're writing a public library, that usually means nothing at all. That said, it does make some things easier where other types of program such as serialization or unity tests require explicit access to your stuff but even there there's almost always a workaround though sometimes it's a bit more difficult. I really regret that most code just mindlessly uses public for all sorts of stuff that nobody is particularly anxious to publish to the world. Sometimes I just throw my hands up and acquiesce because so much stuff is geared towards you making stuff public but I think that this is a sad, almost accidental historical mistake rather than a well thought out strategy.

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: user2183130