On 2/16/17, 12:00 PM, "Harbs" <harbs.li...@gmail.com> wrote:
>I recently went this course in TextModel. By default, the text property >was undefined which propagated to the view when it was never set. I >changed it to 'private var _text:String = “”;' to set the default to an >empty string. Well, that's not PAYG (yes, I'm being picky). It is probably ok for String, but wouldn't be ok for an Array or Object. The instnatiation and assignment of non-scalar initial values happens on every instantiation. It is totally fine, however, to have a TextModelWithEmptyStringDefaults. And have Express use it and Harbs could use it in his app. Again, what percentage of the time in production will a label's text property not be set to something other than ""? It is also totally fine to create a version of Basic with lots of error checking and other fault tolerance. There is no one right answer. IMO, in Justin's example, he is creating his own uninitialized variable and assigning it via binding. So default values in a TextModel won't matter. My 2 cents, -Alex