[ACCEPTED]-What is the antonym of encapsulation?-encapsulation

Accepted answer
Score: 21

The antonym is "C".

Ok, just kidding. (Sort 2 of.)

The best terms I can come up with are 1 "expose" and "violate".

Score: 10

The purpose behind encapsulation is to hide/cover/protect. The 1 antonym would be reveal/expose/make public.

Score: 5

How about Decapsulation..

Though it aint 2 a computer science term, but in medical 1 science, Surgical removal of a capsule or enveloping membrane.. Check out here..

Score: 2

"Removing/Breaking encapsulation" is about 12 the closest thing I've seen, honestly.

If 11 you think of the word in the English sense, to 10 encapsulate means to enclose within something. But 9 in the CS sense, there's this concept of 8 protection levels and it looks like you 7 want to imply circumventing the access levels 6 as well, so something like "extraction" doesn't 5 really convey the meaning you're looking 4 for.

But if you just think of it in terms 3 of what the access levels are, it looks 2 like you're making something public so, how 1 about "publicizing"?

Score: 2

This is not such a simple question - Scott 10 Meyers had an interesting article to demonstrate 9 some of the nuances around encapsulation 8 here.

I'll start with the punchline: If you're 7 writing a function that can be implemented 6 as either a member or as a non-friend 5 non-member, you should prefer to implement 4 it as a non-member function. That decision 3 increases class encapsulation. When you 2 think encapsulation, you should think non-member 1 functions.

Score: 0

How about "Bad Idea"?


Score: 0

The true antonym of "Encapsulation" is "Global 1 State".

Score: 0

The general opposite of encapsulation is coupling and we often 36 talk about systems that are tightly coupled or loosely coupled.

The reason 35 you'd want components to be encapsulated 34 is because it makes it easier to reason 33 about how they work.

Take the analogy of 32 trains: the consequence of coupling the 31 railcars is that the driver must consider 30 the characteristics (inertia, length) of 29 the entire train.

Obviously, though, we couple 28 systems because we need them to work together.

Inverted encapsulation and data structures

There's 27 another term that I've been digging for, which 26 is how I came across this question, that 25 refers to a non-standard style of data structures.

The 24 standard style of encapsulation is exemplified 23 by Java's LinkedList; the actual nodes of the list are designed 22 to be inaccessible to the consumer. The 21 theory is that this is an implementation 20 detail and can change to improve performance, while 19 existing code will continue to run.

Another 18 style is the classic functional cons-list. This 17 is a singly linked list, and the idea is 16 that it's so simple that there's nothing 15 to improve about the data structure, e.g.

data  [a]  =  [] | a : [a]  deriving (Eq, Ord)

-- Haskellers then work directly with the list
-- There's nothing to hide because it's so simple
typicalHaskell :: [a] -> b
typicalHaskell [] = emptyValue
typicalHaskell h : t = h `doAThing` (typicalHaskell t)

That's 14 the definition from Haskell's standard prelude though the report notes that isn't 13 valid Haskell syntax, and in practice [a] is 12 defined in the guts of the compiler.

Then 11 there's what I'm calling an "inverted" data 10 structure, but I'm still looking for the 9 correct term. This is, I think, really the 8 opposite of encapsulation.

A good example 7 of this is Python's heapq module. The data structure 6 here is a binary heap, but there isn't a 5 Heap class. Rather, you get a collection of 4 functions that operate on generic Python 3 lists and you're responsible for using those 2 methods correctly to ensure the heap invariants 1 are maintained.

More Related questions