(home)

🖊️
reddit comment on encapsulation vs abstraction


this is a classic example of the 'encapsulation vs abstraction' thing that programmers are constantly getting wrong

If you're hiding information, you're encapsulating. The opposite of encapsulation is "openness."

If you're providing choice, you're abstracting. The opposite of abstract is "concrete."

A value like x = 3 + 2 is concrete, while x a = 3 + a is abstract, specifically abstract in a.

from a linguistics perspective, since a ton of people get it wrong, then it's descriptively okay-ish to use abstraction to mean encapsulation. but from a precise terminology perspective, where the two words are pretty different in meaning and practice, well, we should get it right

(especially since Haskellers tend to be awful about encapsulation but very good about abstraction!)

Backlinks