P
PaulSchrum
This question may already be in a FAQ. If it is, please accept my
apology for not noticing it, and please direct me to the location.
I am designing a class library for human language grammar
relationships.
I have an abstract class, Phrase.
I have several concrete classes subclassing that: NounPhrase,
PrepositionalPhrase, etc.
While I am in the design phase, I would like to know if there is an
agreed-upon recommended answer to my question:
If I think I might be doing a lot of checking of the types of various
instances of Phrase, is it better for me to use "instanceof" all over
the place, or is it better to have an enum of my own types and switch
on the return value of a getType() method, or some other approach?
Thanks.
- Paul
Schrum
apology for not noticing it, and please direct me to the location.
I am designing a class library for human language grammar
relationships.
I have an abstract class, Phrase.
I have several concrete classes subclassing that: NounPhrase,
PrepositionalPhrase, etc.
While I am in the design phase, I would like to know if there is an
agreed-upon recommended answer to my question:
If I think I might be doing a lot of checking of the types of various
instances of Phrase, is it better for me to use "instanceof" all over
the place, or is it better to have an enum of my own types and switch
on the return value of a getType() method, or some other approach?
Thanks.
- Paul
Schrum