3 ms·
An API is an interface, which in this case exposes data. Yes. The confusion comes from complecting[1] an object api and data. In general, having a class that i
by lukev 14y ago
An API is an interface, which in this case exposes data.
Yes. The confusion comes from complecting[1] an object api and data. In general, having a class that is both a data structure (a bean or a struct) and a service class is a bad idea.
My contention is that if a class is Just Data, exposing public fields is fine. And if it is a service class that needs a consistent, stable API, it shouldn't be exposing fields via getters and setters either.
[1]http://www.infoq.com/presentations/Simple-Made-Easy http://www.infoq.com/presentations/Simple-Made-Easy