Code Review Stack Exchange is a question and answer site for peer programmer code reviews. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a card-based iOS app that uses a sizable static array of cards. Each card has several properties, mostly strings, numbers and boolean.

The first version of this app had 3-4 properties. The next version had about 7-8. Now it has 10-11. I have plans to add another 5-10 properties.

With each iteration, I had to change lots of code:

[allCards addObject:[FlashCard flashCardWithVarA:@"ABC" varB:@"DEF" varC:@"GHI"]];

became:

[allCards addObject:[FlashCard flashCardWithVarA:@"ABC" varB:@"DEF" varC:@"GHI" varD:FALSE varE:FALSE varF:@"JK" varG:FALSE varH:@"123"]];

and then:

[allCards addObject:[FlashCard flashCardWithVarA:@"ABC" varB:@"DEF" varC:@"GHI" varD:FALSE varE:FALSE varF:@"JK" varG:FALSE varH:@"123" varJ:@"4567" varK:@"890" varL:@"LMN" varM:@"OPQ" varN:@"RST" varO:@"U"]];

I also have to add the new properties to the FlashCard object. I have to change the initializer, etc.

Each time I do it, I think to myself, there must be a better way. Especially because I have to modify 200 calls to [allCards addObject:]

Any suggestions or ideas?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.