Open Closed Principle (OCP)

          Posted on 2005-01-25 23:25 Blue Kong 閱讀(529) 評論(0)  編輯  收藏 所屬分類: Java World

          去年用英文寫BLOG時的帖子,自己轉自己,叫自轉 :P

          The Open Closed Principle (OCP) states that we should be able to add new features to our system without having to modify our set of preexisting classes. The following Class Diagram shows that how to design the relationship between the classes so as to adhere the OCP under certain circumstance:

          The User class has a relationship to the UserType abstract class. The simple sample design shows that it adheres one of the tenets of OCP:“to reduce the coupling between classes to the abstract level. Instead of creating relationships between two concrete classes, we create relationships between a concrete and an abstract class ,or in Java, between a concrete class and an interface.

          Principles should be reminded again and again. ^_^

          主站蜘蛛池模板: 皋兰县| 大余县| 吴旗县| 朝阳市| 阜阳市| 清镇市| 玉屏| 海丰县| 九龙县| 封开县| 玛曲县| 崇文区| 保德县| 繁峙县| 公主岭市| 惠安县| 尼勒克县| 定远县| 抚松县| 繁峙县| 昌都县| 紫阳县| 蓬莱市| 滨海县| 花莲县| 通海县| 永泰县| 邯郸市| 济源市| 安国市| 马鞍山市| 台湾省| 吉林省| 红安县| 同心县| 如皋市| 临沭县| 桃源县| 泸溪县| 淳化县| 榆林市|