extends and implements

Jacob Carlborg doob at me.com
Mon Nov 7 23:17:15 PST 2011


On 2011-11-07 20:36, Dejan Lekic wrote:
> Andrej Mitrovic wrote:
>
>> class Rectangle : IShape, Drawable {}
>>
>> It's pretty common in other languages, I've seen it used in D as well.
>
> I used the same naming convention for interfaces until I saw this
> presentation: http://www.infoq.com/presentations/It-Is-Possible-to-Do-OOP-
> in-Java (jump to 0:42 if you do not want to see this brilliant
> presentation).
>
> In short there is an interface RecentlyUsedList, and Kevin recommends that
> good name for implementation is something like ArrayBasedRecentlyUsedList.
> And he is also against IRecentlyUsedList names... I actually agree with what
> he suggests, and stopped using INames for interfaces. :)
>
> PS. the presentation is not Java advocacy, it contains lots of Java
> criticism...

If the interfaces are the primary API, not implementation specific 
classes, then the interfaces should not be have a ugly ma,e qualify them 
with "I" or similar. If there is a need to separate the class and 
interface names then choose the ugly name of the implementation classes.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list