LaKraven / LKSL

LaKraven Studios Standard Library
http://otapi.com
Other
51 stars 15 forks source link

Rearchitect TLKListBase for Dynamic Array Management #87

Closed LaKraven closed 9 years ago

LaKraven commented 9 years ago

At present, TLKListBase provides a singular, hard-coded solution to manage the expansion (and contraction) of its underlying Array.

This solution utilizes Thresholds and Multipliers to expand the Array such that it is expanded less often, but at the operation cost of expanding it by a larger amount (minimum of 50% expansion).

There are situations in which this behaviour is not appropriate, and where it would be better to expand the Array by 1 for each new item (subsequently to contract the Array by 1 when an item is removed).

Indeed, this is just one alternative approach of many, each of which are equally valid under their own particular use-cases.

So, the best possible approach would be to create a polymorphic set of classes to implement these different behaviours, and have TLKListBase instantiate the desired "managing class" as defined by the implementing developer.

This way, TLKListBase and its descendants will cater to every possible use-case, even enable implementing developers to define entirely custom Dynamic Array Management to suit their own needs.

LaKraven commented 9 years ago

Superceded by the Generics Redux project, which will resolve this issue (amongst many others)