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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:47:55+00:00 2026-05-10T21:47:55+00:00

I have a UI-dialog something like this: You must choose a book from a

  • 0

I have a UI-dialog something like this: You must choose a book from a list. Optionally, you can either choose a publisher (another class) from a list or enter the publisher-name as as a string.

I think this gives me 3 types as the output from the dialog.

  1. book
  2. book with publisher-class
  3. book with publisher-string

How would you model this in objects? It seems to me that the having a book base-class, and then two subclasses for publisher and publisher name is the correct choice. Are there any alternatives, perhaps favoring composition that would give a better model?


I’ll try to explain a bit more. A book doesn’t need to have a publisher. The publisher object is not the same as a publisher-name entered as a string.

You must
-choose a book from an existing list

You can one of the following
-choose a publisher from an existing list or
-you can enter a publisher name or
-you can fill nothing about the publisher

  • 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. 2026-05-10T21:47:56+00:00Added an answer on May 10, 2026 at 9:47 pm

    I’ll try to explain a bit more. A book doesn’t need to have a publisher. The publisher object is not the same as a publisher-name entered as a string.

    You must -choose a book from an existing list

    You can one of the following -choose a publisher from an existing list or -you can enter a publisher name or -you can fill nothing about the publisher

    Still calls for a custom result object. Now you have three fields a Book Object, a Publisher Object, and a Publisher String. You then pass it to the code that can deal with it intelligently. You could add methods to address custom processing needs. But in the end it is a specialized result of THAT dialog and should not be some subfield of book or publisher or any other object.

    If the book is nothing you know you got an error because you need a book. You have four combinations of Publisher Object and Publisher_String to deal with as well. Of this indicates to me that you need a class to deal specifically with the result.

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

Sidebar

Related Questions

I have a JQuery dialog box on a page that calls something like this:
I want to do something like this so I can create a modal dialog
I have dialog created like this $('#add_error').click(function(e) { $('<div>') .load('/someaction/format/html/') .dialog({ title: 'Some title',
Hi i have something like this JOptionPane.showMessageDialog(null, Config.CHECK_INTERNET_CONNECTION); System.out.println(go); // HERE I CHECK MY
I have a page with something like this: <input type=button onclick=confirm('confirm popup'); value=click />
I have a dialog box with a drop down menu like this: Object[] possibilities
I have a dialog with this content: <RelativeLayout android:layout_width=wrap_content android:layout_height=wrap_content > <ScrollView android:layout_width=fill_parent android:layout_height=wrap_content
I have a dialog that I want to place within another dialog and position
I am doing something like this in python class MyThread ( threading.Thread ): def
I have HTML code like this: <div id=paragraph> <pre> <p>First Line in the paragraph

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.