Article View: cn.bbs.comp.lang.java
Article #20277[ת��] [java-Basic]Why extends is evil
From: ������ǿ��
Date: Sun, 21 Dec 2003 13:48
Date: Sun, 21 Dec 2003 13:48
35 lines
2699 bytes
2699 bytes
[1;37m�� ��������ת���� [32mOpenSource [37m������ ��
�� ԭ����[32m hijack[37m ��� ��[m
I once attended a Java user group meeting where James Gosling (Java's inventor)
was the featured speaker. During the memorable Q&A session, someone asked him:
"If you could do Java over again, what would you change?"
"I'd leave out classes," he replied.
After the laughter died down, he explained that the real problem wasn't
classes per se, but rather implementation inheritance (the extends
relationship). Interface inheritance (the implements relationship) is
preferable. You should avoid implementation inheritance whenever possible.
-----------------------------------------------------------------------------
һ�Σ��Ҳμ�һ��Java�û���Ļ��顣�ڻ����У�Jams
Gosling��Java֮�����������˽������������������Q&A���֣���������
����������¹���Java������ı�ʲô����������������classes����ش�
��Ц��ƽϢ�������˵����������ⲻ������class���?����ʵ�ּ̳�
(extends ��ϵ)���ӿڼ̳У�implements��ϵ���Ǹ�õġ���Ӧ�þ����ܵ�
����ʵ�ּ̳С�
Why extends is evil?
http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.html
The Fallacies of Inheritance
http://www.manageability.org/blog/stuff/inheritance_revisited/view
--
</life>
</signatures>
[m[1;33m�� ��Դ:��Ʈ��ˮ�Ƽ� Freecity.dhs.org��[FROM: hijack][m
--
[m[1;33m�� ת��:��Ʈ��ˮ�Ƽ� Freecity.dhs.org��[FROM: hijack][m
Technical Details
Message-ID:
<49jK3a$9KT@Freecity.dhs.org>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!news-xfer2.atl.newshosting.com!167.206.3.103.MISMATCH!news3.optonline.net!ctu-peer!news.nctu.edu.tw!netnews.csie.nctu.edu.tw!maily.cic.tsinghua.edu.cn!news.ccie.net.cn!FreecityShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,GB X-Google-Thread: f6cb0,13ed6acfb9d8df46,start X-Google-Attributes: gidf6cb0,public X-Google-ArrivalTime: 2003-12-22 03:08:04 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!news-xfer2.atl.newshosting.com!167.206.3.103.MISMATCH!news3.optonline.net!ctu-peer!news.nctu.edu.tw!netnews.csie.nctu.edu.tw!maily.cic.tsinghua.edu.cn!news.ccie.net.cn!Freecity From: hijack.bbs@Freecity.dhs.org (������ǿ��) Newsgroups: cn.bbs.comp.lang.java Subject: [ת��] [java-Basic]Why extends is evil Date: 21 Dec 2003 13:48:36 GMT Organization: Ʈ��ˮ�Ƽ� Message-ID: <49jK3a$9KT@Freecity.dhs.org> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit X-Filename: Java/M.1072014516.A Lines: 35