(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