> 3) Validate the value and it it's an undesired value, > throw an error ? Here, the component prevents the user > from assigning and undesired value like NaN or > undefined and the user is alerted of the failure at > runtime provided that he used a try catch statement. > > What do you guys think ?
(3) definitly. It's called "defensive programming". Try to have your API as much checked (type-wise and logical-wise) as possible. This will enforce your internal logic constraints and prevent faultly programs. For instance any other component of your application (an UI for example) will except your volume to be positive and not NaN so you cannot allow such values to be set. And you shouldn't ignore this error also since silently ignoring errors will make you and others lose hours of debugging when something goes wrong "damn ! why this f... volume does not get set" answer : because it's NaN Nicolas _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com