Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8790621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:42:21+00:00 2026-06-13T22:42:21+00:00

in one application I have a lot of dirrerent object, let´s say : square,

  • 0

in one application I have a lot of dirrerent object, let´s say : square, circle, etc … a lot of different shape —> I´m sorry for the trivial example.

With all this object I want to create a doc of different type : xml, txt, html, etc.. (e.g.: I want to scan all the object (shapes) tree and produce the xml file.

The natural approach I thought is visitor pattern, I tried and it works 🙂
– all the objects have one visit method accepting the IVisitor interface.
– I have one concrete visitor for every kind of do I want to create : (XmlVisitor, TxtVisitor, etc). Every visitor has one method “visit” for every kind of object.

My doubt is … it doesn´t seems scaling well if I have a lot of object …
from the logic point of view it´s ok, i have just to add the new shape and the method in the concrete Visitor, that´s all.

What do you think ? is an althernative possible ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:42:22+00:00Added an answer on June 13, 2026 at 10:42 pm

    I think that you have correctly implemented a visitor pattern and as a result you also have implemented a double dispatching mechanism. If you consider the “not scaling well” as a need to add a bunch of methods in case of adding a new shape and/or visitor, then it is just a side effect of the pattern. Some people consider this “method explosion” as harmful and opt for a different implementation, such as having a “decision matrix” object. For this example in particular I think that the DD approach is the way to go and that actually it does scale well, since you add new methods as you add new requirements (i.e. you add new visit* methods as new shapes are added or you add a new visitor class as new document types are needed).

    HTH

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my MVVM based WPF application I have a lot of different ViewModel types
The problem: we have one application that has a portion which is used by
I have one application that prints messages from Test.exe in console .My java program
i have one application which is build using VB.NET now i required to add
I have zero experience writing applications with Swing, but I have one application with
I have one web application which I have been working for some time.I am
I have created one application in flex that is accessing the Java webservice using
I have created one Catalyst application and I have created Schema and Model using
I have created one application in j2me, I have used json parsing in that
I have two Activities along with one Application class, and whenever I call my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.