Information Hiding vs Encapsulation
来源:互联网 发布:战略忽悠局 知乎 编辑:程序博客网 时间:2024/06/05 11:08
These are two of most important concepts in software design.But it is a pity there are no unified
definitions for the two concepts.
These days I am reading the Code Complete 2nd Edition by Steve McCDonell.There are wonderful
points of these two concepts in the book.But personally I tend to enjoy the description from
http://c2.com/cgi/wiki?InformationHiding
The following description is copied from that link:
-----------------------------------------------------------------------------------------------------------------------------------
InformationHiding is a principle first published by DavidParnas in his seminal paper
OnDecomposingSystems.
The basic idea is that if code chunk A doesn't really need to know something about how code chunk B
(which it calls) does its job, don't make it know it. Then, when that part of B changes, you don't have to go
back and change A.
It is widely recognized as the most important criterion for judging the quality of a software design, although
many more people think of it under a different name. The current phrase "if we do X we increase coupling
between A and B". Increasing coupling is equivalent with breaking InformationHiding.
Encapsulation, strictly speaking, means something different; it means collecting a bunch of stuff together
and putting it in one box, or capsule. The box may or may not have opaque walls, so this may or may not
involve information hiding. In practice a "class" will both encapsulate (ie bundle code and data together)
and hide information (namely, implementation detail), and some people get so used to doing both at once
they no longer bother to distinguish. A few pedants still care, though.
----------------------------------------------------------------------------------------------------------------------------------------
See the following links for more discussion:
http://www.javaworld.com/javaworld/jw-05-2001/jw-0518-encapsulation.html
http://www.toa.com/pub/abstraction.txt
- Information Hiding vs Encapsulation
- information hiding & encapsulation DEMO
- python encapsulation & information hiding demo
- 信息隐藏(Information Hiding)原则
- 信息隐藏(Information Hiding)原则
- 【转贴】java overriding vs hiding
- encapsulation
- Java学习笔记之信息隐藏(Information Hiding)
- mutual information vs cross-entropy
- Reflection vs Encapsulation – Stand Off in the Java Module System(1)
- Reflection vs Encapsulation – Stand Off in the Java Module System(2)
- Reflection vs Encapsulation – Stand Off in the Java Module System(3)
- Reflection vs Encapsulation – Stand Off in the Java Module System(4)
- Reflection vs Encapsulation – Stand Off in the Java Module System(5)
- Activity stream software vs. information architecture
- VS error retrieving information from user datastore
- XML Encapsulation
- good encapsulation
- 微软发布Foxpro 9.0
- 分布拒绝式服务攻击击倒Alldas.de
- 防DDoS攻击11招
- [原创]ASP.net下DataGrid的单项选择控件
- 国内首次抓获DDoS攻击者
- Information Hiding vs Encapsulation
- 关于sizeof操作符的理解和总结
- 新西兰电信昨遭DOS攻击 31万用户无法访问网站
- 人生就像这样
- Java的时间处理(续)
- 无进程DLL木马的又一开发思路与实现(转载)
- C语言测试:想成为嵌入式程序员应知道的0x10个基本问题
- 论瀑布模型、Rup是否适用于一般的国内软件公司。(二)
- 用AutoLoad显示位图按钮