array medium sized list of variables
What are some of the benefits of using an array as opposed to a medium-sized list of variables? Are there disadvantages to this approach? Try to think of several arguments on both sides of the dis开发者_如何转开发cussion.
I think that what is more important is not the length of the list, but it's variability!
If your data are likely to change then an array is the best solution; i'd use an array for example to read a set of properties; but in all the other cases an array would lead to a loss of type checking!
In conclusion, in this particular case, assuming a long list of parameters with not uniform types, i'd go for an object to encapsulate the data and preserve type checking!
精彩评论