I have subclasses that are supposed to override and define various functions, but not neccessarily all of them. They can't remain purely virtual though for obvious reasons, and so I am going to throw an exception instead.

I just have to name the exception's class, and so it makes sense to use a term that implies that the function is supposed to be remain undefined, as opposed to erroneously undefined.


What terminologies imply that a function is properly remaining undefined?

  • From a very technical point of view, I'd argue that these methods are unimplemented. That being said, it might help to look at this issue from the point of view of the clients of the subclasses. What are their expectations in regards to this? Do they care about the technical details of the functions being unimplemented, or is there a business error you can extract out of there? Oct 22 at 13:26
  • 2
    I'd say you have subclasses that aren't subtypes, so perhaps you should be fixing that instead.
    – Caleth
    Oct 22 at 13:29
  • @VincentSavard This actually has to do with card logic. Suppose you have to play a card, and it has to be a trump. The only card you can play is not a trump. Its trump function is called, and now I have to throw an exception. I know there is other logic that I can experss this situation beyond throwing, however I have my reasons to use an exception here.
    – Anon
    Oct 22 at 13:43
  • @Anon no, you have an empty set of playable cards, and you deal with that however the rules say, perhaps by that player losing, or skipping their turn, or whatever
    – Caleth
    Oct 22 at 14:53
  • 1
    @Anon, LSP = Liskov substitution principle and Barbara Liskov is the creator of that principle. My bad for not clarifying.
    – David Arno
    Oct 25 at 8:38

I just have to name the exception's class

You don't actually say which technology you're using, so you may be missing out on a pre-existing convention or name. That said ...

.Net has its NotImplementedException.
Java has a similar-sounding UnsupportedOperationException (although I suspect that one means something rather different).

... a term that implies that the function is supposed to be remain undefined ...

If you mean that a method must not be overridden, then you should be looking at "sealed" or "final" modifiers on the method (if your language has them) that the compiler can enforce, rather than leaving it until run-time.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.