How is information hiding different from information shyness

  • Slides: 10
Download presentation
How is information hiding different from information shyness • CACM May 1972: A technique

How is information hiding different from information shyness • CACM May 1972: A technique for the specification of software modules: Hide implementation data structures. • Later: CACM Dec. 1972 Secret = design decision which a module hides from all the others. • Shyness: hide a concern (e. g. , structure) information hiding = implementation detail hiding

Protect Against Changes. • Protection against changes in data representation and interfaces. Traditional technique:

Protect Against Changes. • Protection against changes in data representation and interfaces. Traditional technique: information-hiding is good to protect against changes in data representation. Does not help with changes to interfaces. • Need more than information hiding to protect against interface changes: restriction through shy programming, called Adaptive Programming (AP). Implementation Interface Client Representation Independence Shy Programming Information Hiding

Strengthening Information Hiding? may change in limits Implementation Interface Representation Independence Client Shy Programming

Strengthening Information Hiding? may change in limits Implementation Interface Representation Independence Client Shy Programming Information Hiding

Problem with Information Hiding • Shy Programming builds on the observation that traditional black-box

Problem with Information Hiding • Shy Programming builds on the observation that traditional black-box composition is not restricting enough. We use the slogan: information hiding is not hiding enough. Blackbox composition isolates the implementation from the interface, but does not decouple the interface from its clients.

Cover unimportant parts of the interface • To permit interfaces to evolve, selfdiscipline is

Cover unimportant parts of the interface • To permit interfaces to evolve, selfdiscipline is required to prevent from programming extensively against the interface. Certain parts of the interface are best left as if they were covered. Implementation Interface Representation Independence Client Shy Programming Information Hiding

Shy Programming = Adaptive Programming • This disciplined programming is referred to as shy

Shy Programming = Adaptive Programming • This disciplined programming is referred to as shy programming. Shy programming lets the program recover from (or adapt to) interface changes. Shy programming is also called Adaptive Programming (AP). This is similar to the shyness metaphor in the Law of Demeter (Lo. D): structure evolves over time, thus communicate with just a subset of the visible objects.

Decoupling of Interface • We summarize the commonalities and differences between black-box composition and

Decoupling of Interface • We summarize the commonalities and differences between black-box composition and Shy Programming into two principles. – Representation-Independence Principle: the representation of objects can be changed without affecting clients. – Shy-Programming Principle: the interface of objects can be changed within certain limits without affecting clients. • It is important to notice that the Shy-Programming Principle builds on top of the Black-Box principle.

Layers • The interface of one layer becomes representation for the next layer.

Layers • The interface of one layer becomes representation for the next layer.

are the program (a, b) is the abstraction a*x+b

are the program (a, b) is the abstraction a*x+b

AOSD • Tradeoff – Spurious – Brittle generic specific • Advice obliviousness • Join

AOSD • Tradeoff – Spurious – Brittle generic specific • Advice obliviousness • Join point obliviousness