Visitor Pattern. Why we shouldn't use it.


EJB design: Visitor Pattern. Why we shouldn't use it.

  1. Visitor Pattern. Why we shouldn't use it. (1 messages)

    Hi, I wanted to use visitor pattern (Assume I am using it in the correct context) and this is my senior tech lead has to say about it. ------------------------------------------ I don’t think that they are not worth using, just not for this purpose in my view. If needed to implement dispatching problems, then sure, but we don’t have that limitation. I can’t see any other reason why inheritance could not handle this in the absence of dispatch problems. My opinion is that this methodology turns object orientation into procedural code removing the necessity of good object inheritance design. Also it breaks encapsulation. Breaking encapsulation is not great IMHO. ------------------------------------------- Could some one give an answer to this please.
  2. No amount of technical accuracy is of help if the application fails to meet the business objectives. So dont worry too much about going by the book. If adding some procedural stuff can be a boon in terms of time spent to fix somethig, performance.. or any other benefit.. which can outweigh if we have gone through the book.. It is the end product that matters, that the technology or the way we create someting;)