开发者

array medium sized list of variables

开发者 https://www.devze.com 2023-04-03 07:10 出处:网络
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开发

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!

0

精彩评论

暂无评论...
验证码 换一张
取 消