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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:33:04+00:00 2026-06-04T08:33:04+00:00

I’m designing an object named ContactInfoEntity that has an NSString property, contactInfoEntityType , and

  • 0

I’m designing an object named ContactInfoEntity that has an NSString property, contactInfoEntityType, and a container object, properties, that stores an arbitrary number of properties based on it’s contactInfoEntityType.

The goal is for the user to be able to define a new ContactInfoEntityType during runtime.

Right now I’m using an NSMutableDictionary in ContactInfoEntityType that has a key:@”typeName” of value:@”Generic”.

To define a new ContactInfoEntityType, I change the value of the key:@”typeName” and add new keys: @”newPropertyName1″, @”newPropertyName2″,… with NSDicts as values. The keys of the nested dictionaries are something like: @”defaultValue”, @”index”, @”formatToken”, …

When [ContactInfoEntityFactory contactInfoEntityOfType:emailInfoEntityType]; is sent, the factory gets the NSMutableDictionary with @”emailInfoEntityType” as the value for it’s @”typeName” key and sees that there are three additional dictionary entries: @”domain”, @”localPart”, and @”emailNickname”.

It then creates a ContactInfoEntity whose contactInfoEntityType is @”emailInfoEntityType” and properties container has three entries with the associated defaultValues.

Right now my properties container is an NSArray and an NSMutableArray. The NSArray holds the newPropertyNames and the NSMutableArray holds the values – both at the same index. The NSArray does duplicate some of the information in the entity type definition, but I feel it keeps the data in the individual entities meaningful in case the definitions get wiped out.

Is this a reasonable approach to this problem? This is the most abstract object I’ve attempted so far and still haven’t wrapped my head around all the common design patterns.

Specifically, are there more appropriate classes to use than NSMutableDictionary for the type definition and NSArray/MutableArray for the properties object?

Any input on the way I posed the question is also appreciated.

  • 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-04T08:33:06+00:00Added an answer on June 4, 2026 at 8:33 am

    The only thing that jumps out at me as being potentially annoying is:

    “Right now my properties container is an NSArray and an NSMutableArray.
    The NSArray holds the newPropertyNames and the NSMutableArray holds
    the values – both at the same index.”

    I have a long-standing dislike of parallel arrays as a way of relating data elements. I’d recommend a single array of objects, with each object containing a name/value pair. It prevents some types of subscript errors and gives the opportunity for pair-specific logic if that’s ever needed.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a

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.