Dec 23, 2024
Yes, it's not always the best, but in this context, it is better than exposing fields directly. Using getters/setters provides flexibility for future changes (like validation) without breaking all the callers, which direct field access would do.