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 6344479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:38:52+00:00 2026-05-24T20:38:52+00:00

Is there a design-pattern which is recognized as the best pattern to use when

  • 0

Is there a design-pattern which is recognized as the best pattern to use when separating a datamodel and a gui drawing mechanism?

So say i have a class Circle and a class Square, then i would be tempted to have a draw method in both these classes. However that would force the class to import all kinds of nasty things depending on the drawing canvas im using (swing,j3d,opengl,etc).

My first thought would be that a Visitor pattern could solve this by making Square and Circle implement a method which takes a visitor as an input argument and calls a function on the visitor. then i could have two draw methods on the visitor which takes a Circle and a Square instance as input argument, and draws them accordingly.

Any suggestions on this?

  • 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-24T20:38:52+00:00Added an answer on May 24, 2026 at 8:38 pm

    There is no “best” method, it all depends on you platform, architecture and other stuff.
    Usually, when it comes to GUI, several patterns should be combined.
    One of them is usually the MVC where the view can be extended with other hierarchy pattern (Visitor is also an option).

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

Sidebar

Related Questions

I'm looking for some thoughts on which design pattern(s) to use for my problem,
Is there a Design Pattern which separates the preparation of work from its execution?
Say you have an abstract base class Task which is a task a user
I was wondering if there exists a design pattern/framework which allows for the loose
Isn't there a Design Pattern who describes how to high cohesion? I need some
Is there way to better identify design pattern in source codes, esp. if you
Is there such a thing as having the most prefered design pattern for building
Are there any known design principles, best-practices and design patterns that one can follow
What does it mean to say - Engineering scalability into applications. Are there design
I have an application, where there are many forms which follow visual form inheritance.

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.