h a l f b a k e r yNo, not that kind of baked.
add, search, annotate, link, view, overview, recent, by name, random
news, help, about, links, report a problem
browse anonymously,
or get an account
and write.
register,
|
|
|
specific
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.
(?) Aspect-oriented programming
http://www.parc.xer...m/csl/projects/aop/ Not quite the right thing, but would this help? [rmutt, Dec 08 2000]
Please log in.
If you're not logged in,
you can see what this page
looks like, but you will
not be able to add anything.
Annotation:
|
|
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? |
|
| |