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?