Half a croissant, on a plate, with a sign in front of it saying '50c'
h a l f b a k e r y
i v n i n seeks n e t o

idea: add, search, annotate, link, view, overview, recent, by name, random

meta: news, help, about, links, report a problem

account: browse anonymously, or get an account and write.

user:
pass:
register,


     

Please log in.
Before you can vote, you need to register. Please log in or create an account.

specific

Opposite of "abstract" method qualifier
 
(+2, -2)
  [vote for,
against]

In object-oriented programming, I sometimes wish there was a way of saying, "I intend this method to be an implementation of my superclass's method (be it abstract or not). I didn't make this up."

Advantages:
- In the absence of "specific", mistyping the name of a non-abstract superclass method that you intend to override is an error that leaves you with perfectly valid code (which is never invoked). Introducing "specific" means that the compiler can find these typos.
- A human reader knows that these functions are there as part of interfacing with the surrounding object framework.

Disadvantages:
Higher langauge complexity, clutter, more stuff that doesn't really do much in a procedural sense.

Alternatives:
- if method names were prefixed with the name of the lowest inherited subclass they belong to (separated by something like . or :), you'd get even more documentation out of it.
- [PeterSealy] Symbol Completion in source code editors helps prevent such typos.

I'm not sure the advantages outweigh the disadvantages; I just wonder where there's an OO language out there that has addressed this, and how it played out in practice.

jutta, Dec 08 2000

(?) Aspect-oriented programming http://www.parc.xer...m/csl/projects/aop/
Not quite the right thing, but would this help? [rmutt, Dec 08 2000]

[link]






       Hm. Aspect-oriented programming would help in the sense that it reduces the need for inheritance as an interface mechanism; is that what you mean, rmutt?
jutta, Dec 09 2000
  
      
[annotate]
  


 

back: main index

business  computer  culture  fashion  food  halfbakery  home  other  product  public  science  sport  vehicle