Architecture of WTF
FAQs
There’s a lot of repetition between
FloatHolderandFloatViewHolder, why can’t we combine them?In hindsight, we could define a class
FloatHolderAPI<T>that is templated on the type ofFloatthat will hold it.FloatModelwould always derive fromFloatHolderAPI<Float>whereasFloatViewModelwould derive fromFloatHolderAPI<Float>orFloatHolderAPI<const Float>depending on the const-ness of the type argument toFloatViewModel. The holder classes were already written when this realization occurred, so it was not worth the effort to refactor them.