Can I use mvc without getters and setters?
问题 If I don't want to expose the state of my object, but I still need to display it (in HTML, XML or JSON let's say), how would I go about doing that in an MVC environment. Does it make sense to have an export method which exports a dumbed down immutable object (a "data class" if you will). What about adding in a render method which talks to an interface? Are there any other approaches to this problem? 回答1: The render method comes the closest to not exposing state. Another method (well-known to