November 08, 2011 Re: extends and implements | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dejan Lekic | 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 |
November 08, 2011 Re: extends and implements | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | On 2011-11-08 03:07, Jesse Phillips wrote: > On Mon, 07 Nov 2011 18:22:07 +0000, %u wrote: > >> Hello. >> >> I know D isn't Java, but one trivial thing I liked about Java is the >> introduction of 'extends' and 'implements' as keywords as ways to >> clarify the class relationships when defining a class. You know: >> >> class Subclass extends SuperClass implements AnInterface { >> ... >> } >> >> Will they ever add this in to D? If not, why not? >> >> thanks. > > There are only two instances I like know if something is an interface or > class. > > The first is when I am defining it, for some reason I want to tell the > whole world, "Hey I'm building an interface here so be sure to include > these." Which really isn't important. > > The second is when I want to find its definition. Hmmm, should I be > greping for /class Window/, /interface Window/, or /struct Window/ > > Otherwise the distinction has been pointless. This should be handled by an IDE/editor with go-to-definition. -- /Jacob Carlborg |
November 08, 2011 Re: extends and implements | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | Jesse Phillips Wrote:
> The second is when I want to find its definition. Hmmm, should I be greping for /class Window/, /interface Window/, or /struct Window/
[a-z]* Window ?
|
Copyright © 1999-2021 by the D Language Foundation