Please log in.
Before you can vote, you need to register. Please log in or create an account.
Computer: Programming Language
specific   (+2, -2)  [vote for, against]
Opposite of "abstract" method qualifier

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]

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



random, halfbakery