Friday, May 4, 2007

Encapsulation in the Model

Looking at the above code you can see that the submission service is injected into the application. Encapsulation is more than just hiding data, but also is about protecting the client from having to know more than it needs to. I know it sounds like I said the same thing, but when writing the code if you focus more on hiding data than protecting the client then you might run into something like the following: The code needs to extract a boolean value from the validator then pass it back into the application. The original code did all this in the application object.