News for hackers. Stuff that matters.
Re:Java memes which refuse to die by lukev on Monday August 27, 2012 @11:34AM (#4439285)
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

There are no comments on this comment yet.