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

Incapsulation is a very questionable concept as well. However what C++ does provide is the generic programming: in C you will have to copy and paste implementation of List for every data structure as well as the algorithms. As suggested in the comment there are no inherent deficiencies in C++ and there is an implementation of intrusive lists in Boost. You don't have to use incapsulation if you don't want to.


Incapsulation is a very questionable concept as well.

One can live without it on a smaller scale. But for anything that will have any lifetime whatsoever it's absolutely essential. Distinguishing between a module's intended interface and its implementation details is what makes it possible to amend the implementation should the need arise. Without proper encapsulation every change must be assumed to be a breaking change, software maintenance costs go through the roof, module interactions become unpredictable, and that upstart kid who wears Chucks to work but knows how to write testable code eats your Wheaties.


Well, incapsulating algorithms is great. But incapsulating of the data is not always. Languages like Haskell completely go away without it.


The two are not separable. If people can monkey around with the data structures that your algorithm relies on, then the algorithm is not encapsulated.

Languages like Haskell rely on it as heavily as any other well-crafted system. Imagine Data.HashTable it were originally implemented using linear probing, and someone wanted to modify (upgrade?) it to use cuckoo hashing or hopscotch hashing instead. It wouldn't be possible to do without breaking existing software if users were permitted to directly access the underlying data structures.


Incapsulating, in this context, isn't a word.

You want encapsulate. Encapsulation. Encapsulating.

The "en" prefix means put into or on something. You're saying you're putting something into a capsule or "isolating it".

The "in" prefix in English usually is the negative, or "not".

Intolerable: not tolerable.


Thanks for correction. I am not a native English speaker and in Russian(my native language) the word Encapsulation starts with Cyrillic "и" to which the closest analogue in Latin is "i" - hence the confusion!


> I am not a native English speaker and in Russian(my native language) the word Encapsulation starts with Cyrillic "и" to which the closest analogue in Latin is "i" - hence the confusion!

I figured, I'm a native English speaker learning Russian, as it happens.

Будем здоровы




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: