Recently, I read a lot of good articles about how to do good encapsulation. And when I say "good encapsulation", I am not talking about hiding private fields with public properties; I am talking about preventing users of your Api from doing wrong things.
Here is two good articles about this subject:
At my job, the majority a our applications are not destined for other programmers but rather to the customers.
About 80% of the application code is at the top of the structure (Not used by other code). For this reason, there is probably no chance ever that this code will be used by other application.
An example of encapsulation that prevents users from doing wrong things with your Api is returning an IEnumerable instead of IList when you don't want to give the ability to the user to add or remove items in the list.
My question is: When can encapsulation be considered simply OOP purism, keeping in mind that each hour of programming is charged to the customer?
I want to do create code that is maintainable and easy to read and use, but when I am not building a public Api (to be used by other programmer), where can we draw the line between perfect code and not so perfect code?