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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:17:38+00:00 2026-05-13T13:17:38+00:00

This is in my opinion an abstract problem and I hope I can explain

  • 0

This is in my opinion an abstract problem and I hope I can explain it well. I happened to find the same kind of problem in a completely different project and now I have it again and I would like to avoid it if possible.

I’m creating some classes to simplify some tasks for some specific requirements we have in some projects at work.

I have a class that creates objects which maps the values from webcontrols to an object properties similar to this

http://msdn.microsoft.com/en-us/library/aa478957.aspx

The problem I have it’s sometimes I have to store a non container object in a place (in an object’s attribute) and sometimes I have to a store a container object in the same place for storing the values of a webcontrol (a webcontrol can sometimes hold several values like a checkboxlist). I dont like this at all, because some time ago when working in a non commercial compiler, when parsing and generating the intermediate code I had sometimes to store a container in a place, and sometimes I had to store a non container in the same place, and having to ask in other parts of the code if what you are reading is this type of object, or this another type of object, it is something really annoying and it mess up the code. Is there any tips about what it would be better to do to avoid this kind of situations or nothing can be done to avoid it sometimes?

  • 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-13T13:17:38+00:00Added an answer on May 13, 2026 at 1:17 pm

    This is the Polymorphism problem.

    “sometimes I have to store a non container object in a … an object’s attribute and sometimes I have to a store a container object in the same place”

    You have two things which should be made polymorphic.

    The easiest way to fix this is to use a container always. When you want to store a single non-container object, you “wrap” it in a container that contains just the one object.

    Then you always have containers. Sometimes the container has one object, sometimes it has more than one.

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

Sidebar

Related Questions

I've got a problem. In my opinion this should work fine: for($i = 0;
I'd like to ask your opinion on this. This is a theoretical question. I'm
This is strictly an opinion/experience question for research purposes. I was wondering what coding
This is more of a request for your opinion in something, rather than a
I know this is largely an opinion, but I'm interested if you have one
This somehow simple task is not so simple. I can get the number of
I know this could be opinion, but I'm looking for best practices. As I
I often find this pattern in Haskell code: options :: MVar OptionRecord options =
In the Stack Overflow podcast #36 ( https://blog.stackoverflow.com/2009/01/podcast-36/ ), this opinion was expressed: Once
Hi in my opinion property of my object shouold be 2, but after this

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.