Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What you’re talking about is good design but has nothing to do with encapsulation. From Wikipedia:

> In software systems, encapsulation refers to the bundling of data with the mechanisms or methods that operate on the data. It may also refer to the limiting of direct access to some of that data, such as an object's components. Essentially, encapsulation prevents external code from being concerned with the internal workings of an object.

You could use encapsulation to enforce only valid states, but there are many ways to do that.



Well whatever that is, that's what I like :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: