2 ms·
What about only providing methods named after fields for outside use? That way you can extend that class to provide either field-based access or anything else y
by kaba0 5y ago
What about only providing methods named after fields for outside use? That way you can extend that class to provide either field-based access or anything else you like. E.g. in scala there is no syntactic difference between method and field access so code will compile with both person.age and person.age(), while implementation can be both “sparse and dense”.