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

  • Home
  • SEARCH
  • 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 592841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:46:55+00:00 2026-05-13T15:46:55+00:00

I am designing an application, and I am unable to point out the correct

  • 0

I am designing an application, and I am unable to point out the correct design for the same. I have one in my mind, but it does not seem to be part of the GOF pattern and so I am not sure whether it is a nice way to go.

My project creates data from any of the possible 15-20 documents (the documents are all of same type, but the data can vary widely). Once the data is obtained, it needs to be formatted in any of the supported 4 formats and displayed. Also, to complicate matters, even though the documents itself are broadly classified to 4-5 types, few of the documents (across these classifications) are formatted in a similar way.

Now, I split it in the following way:

  • Data Creation
  • Data Display

Data creation creates an interface data object with common interface which can handle all these documents.

Data display reads through the data object and displays it in the way it is required.

My first question is that – I did not see about such an interface object in the GOF pattern set. Is this a good design decision to have such a thing?

As I mentioned before, just two documents are formatted the similar way – across classifications. The problem here is that other documents – which should have been formatted the similar way – are not. So, I find myself cloning the code in one scenario while getting the data, which I dont want to.

So, my second question is – what is the best way to handle this?

I will be very thankful if someone can help me out here.

  • 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-05-13T15:46:56+00:00Added an answer on May 13, 2026 at 3:46 pm

    Don’t try to push too hard pattern in advance. Figure out a few designs and then try to reveal patterns in them. Patterns are meant to communicate and can be seen as reusable for some specific concern only.

    So your broad problem is that you have X documents and Y rendered.

    • Try to generate a class hierarchy for the documents that make sense. You can probably factor some logic in a base class or use an interface
    • If you can’t figure out interface to abstract all types of document, you may rely on adapters to, well, adapt the various document to a given interface
    • To have multiple renderers, you can have a look at the visitor pattern, the decorator pattern or the strategy pattern, or use just plain inheritance/polymorphism with Y rendered that implements the same interface. It depends on the nature of the variations.
    • To obtain the right renderer according to the use case, you can use a factory to embed the decision and instantiation logic.

    GoF patterns are at a lower granularity than your problem. You will have to figure out a design that matches your very specific requirement. In case of doubt, always pick the design that is the simplest / more intuitive. No them one with the most patterns and fancy class hierarchy.

    My 2 cents

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

Sidebar

Related Questions

When designing an application, does there come a point where you have too many
I'm designing an application which will have a network interface for feeding out large
I am designing an application for a library. Not a large scale library, but
I'm designing my application data model and I have a doubt, whether to use
I am designing an application, one aspect of which is that it is supposed
I'm designing an application following REST specification but I'm unsure how to structure the
I'm designing an application with UML. I have to represent video and image as
I am designing an application where a user places multiple UIImageViews one over another.
When designing my application how many controllers should I have? Is it good practice
When designing an application, at what point should the various layers (such as Presentation,

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.