Getters
In programming, a getter is a method or function that retrieves the value of an object's attribute. Getters are a form of encapsulation, allowing code to access internal state without exposing the underlying representation directly. They are commonly used in conjunction with setters, which modify the state, to form a controlled interface for an object's properties.
Getters can return stored values or compute a value on demand. A stored-value getter simply returns a
Naming and syntax vary by language. In Java and C#, a getter often appears as a method
Best practices include keeping getters inexpensive and free of side effects, avoiding heavy I/O or long computations
---