Friday, November 27, 2009

Inheritance (Classification) and Composition (Grouping) in Hierarchies



There are two modes to a hierarchy. Both these exist in the single hierarchy.

1. Inheritance (child is a type of parent - sphere is a type of shape)

SHAPE > SPHERE > BALL > BASKETBALL

2. Composition (parent has a child - gymnasium has a court)

GYMNASIUM > COURT > BASKETBALL NET > RIM

Inheritance is virtual. Classes do not really exist. They generally describe objects. In Object Oriented Programming, classes are what objects are made from. In Zen, you are encouraged to avoid thinking about classes and concentrate on the real object as we usually see a tree and simply replace it with a symbol of a tree in our mind. I don't agree with Zen in this case because I think it is very important to think abstractly for efficiency and understanding connections. However, there are many times when we should remember to smell the roses.

Composition is the parts of something. A nice way to look at composition is nesting. We might also say that systems are made with composition. Composition is often real but it can also be virtual - like ideas composed of other ideas, etc. In Object Oriented Programming, composition can always do anything inheritance can do but not the other way around. So in coding, inheritance is just an efficiency (a way to avoid redefining properties) - again, abstract.

40 comments:

AmberlyThrower said...

ut女同聊天室38ga成人尼克成人百分百貼圖85cc免費影片觀看108無碼av艾利絲寫真集自拍露點熟女人專賣店線上無碼人妻熟女自拍動物性交正妹被強姦3p換妻熟女交友洪爺色情網站自拍走光愛愛愛鋼管鋼管秀ms5 hinet net 性愛85cc街影城a圖貼大奶正妹可愛愛心圖片tt 同志交友網免費色情小說a片dvdsexinsex666 貼圖區素人王國人氣女優激情無碼yes 777歐美貼圖wii777遊戲備份站lion travel素人大全集85cc 嘟嘟影城情趣用品線上直購網 國外進口情趣商品辣妹神算走光影片裸體彩繪比基尼車隊裸體遊戲無名正妹牆qvod成人tt1069男同志論壇天天看正妹瑤瑤寫真

芥末 said...

good post..................................................

香蕉哥哥 said...

0401影音成人影片交流愛撫淫叫色情照片性愛圖片女生如何自慰激突成人論壇美女脫胸罩走光一夜正妹視訊情人性愛論壇85cc影城性伴侶85cc色情影片打手槍情色視訊聊天室色情a片色情色情圖片限制級照片色情電話520sex免費色情網情色性愛一夜情聊天網成人聊天網視訊成人台灣性網av一夜女情色av淫女免費視訊美女挑逗情色影音聊天作愛影片辣妹清涼秀美女做愛成人自拍貼圖成人資訊色論壇台灣色情成人網站色情視訊聊天露三點打砲情色性愛貼圖av成人網成人影片

季玉 said...

聊天勢苗栗聊天室ut中部人聊天聊天尋夢080中聊天室一葉情成人貼圖區一葉情成人影片區一葉情成人論壇一葉情貼貼片區一葉情貼圖片區,一葉情圖片區一葉情語音一葉情語音聊天一葉情語音聊天網一葉成人網一業晴成人一業情貼圖ㄧ葉晴貼片ㄧ葉晴貼片區ㄧ葉晴貼圖區一本道影片一本道線上觀看一夜情天室一夜情無碼影片一夜情貼圖區一夜晴貼片一夜晴貼圖片區一夜晴貼圖區一情夜一貼片成人小說 言情小說 美女寫真ut聊天室

玉龍玉龍 said...

thx u very much, i learn a lot

冠俊貴良俊貴 said...

I do like ur article~!!!...................................................

Porsha蔡Coghlan明宏 said...

恐佈哦~~
相愛?相害?
看了鬼故事之後讓你睡不著覺
洗臉的女孩
紅燒人頭,可好吃了
紅布床簾

志平 said...

看到你的好文章真是開心 加油囉.......................................

宏來 said...

sex女,ut,貼影,av,高潮,女優,做愛,手機成人影片,色遊戲,成人動漫,百分百貼圖區,85cc影片,成人影音,av色情影片,A片線上,a片,sex,777,三級線上看,美女的照片,視訊做愛,78論壇,打飛機,免費視訊,成人影院,辣妹視訊,視訊聊天,影片網,kiss911,a片,交友,聊天,做愛,免費影片,性交,線上成人,網路色情,聊天,美女自慰,免費a分享,免費短片,裸照,一夜情,女優,85cc成人片,美女寫真,偷拍a,情人視訊聊天室

TamMcfee668 said...

IT IS A VERY NICE SUGGESTION, THANK YOU LOTS! ........................................

LeeO_Capetillo淑屏 said...

如此活躍的文字, 妳好棒哦! .............................................

Avri221lE_Pryce1 said...

好文!值得一推~~加油哦!.............................................

振宇 said...

God never shuts one door but he opens another...................................................

俊翔 said...

你不能和一個握緊的拳頭握手........................................

瓊文TamMcfee0520 said...

你要保守你的心,勝過保守一切,因為一生的果效是由心發出........................................

俊宏 said...

被人揭下面具是一種失敗,自己揭下面具卻是種勝利。..................................................................

峻龍 said...

Where did you purchase this product?..................................................

王邦鈺 said...

這麼好的部落格,以後看不到怎麼辦啊!!......................................................................

江婷 said...

良言一句三冬暖,惡語傷人六月寒。.................................................................

于庭 said...

成熟,就是有能力適應生活中的模糊。.................................................................

王名仁 said...

It takes all kinds to make a world.............................................................

琇白 said...

閱讀您的BLOG文章,真是件快樂的事!..................................................................

said...

好看耶~一定每天有空給你支持..................................................................

蕭惟秀蕭惟秀 said...

很喜歡看看別人的生活故事,謝謝您的分享哦~~............................................................

楊儀卉 said...

好的開始並不代表會成功,壞的開始並不代表是失敗............................................................

婷珊 said...

馬丁路德:「即使知道明天世界即將毀滅,我仍願在今天種下一棵小樹。」............................................................

建佑建佑 said...

一棵樹除非在春天開了花,否則難望在秋天結果。..................................................

瑤德 said...

Make hay while the sun shines.............................................................

琬安琬安 said...

當我微笑時,世界和我一起微笑;當我快樂時,世界和我一起活躍。..................................................

劉士賢 said...

人不可以求其備,必捨其所短,取其所長............................................................

林聿希林聿希林聿希 said...

凡事三思而行,跑得太快是會滑倒的。..................................................

姚吳宗瑞家弘 said...

不論做什麼事,相信自己,別讓別人的一句話,把你擊倒。..................................................

佳呈均慧 said...

人不能像動物一樣活著,而應該追求知識和美德............................................................

偉曹琬 said...

Joy often comes after sorrow, like morning after night.. . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

麗王王珠 said...

Pen and ink is wits plough...................................................................

俊芸茂芸茂翔 said...

在莫非定律中有項笨蛋定律:「一個組織中的笨蛋,恆大於等於三分之二。」............................................................

翊翊翊翊張瑜翊翊翊 said...

用心經營blog,人氣百分百~^^ 加油 ..................................................................

1615 said...

Necessity is the mother of invention.......................................................................

舒夏怡 said...

初次造訪,感謝你的分享..................................................................

王雅俊 said...

心平氣和~祝你也快樂~~..................................................