functions to return properties?

erik hansen erikhans08 at yahoo.com
Fri Oct 17 19:50:52 EDT 2003


--- Richard Gaskin <ambassador at fourthworld.com>
wrote:
> erik hansen wrote:
> 
> > is there any reason NOT to use:
> > 
> > function myVar
> > return (the uMyVar of this stack)
> > end return
> > 
> > in scripts?
> > it sure saves script space.
> 
> It sure does, with many benefits.
> 
> Such functions are generically referred to as
> "accessors", and can be a very
> smart way to handle things.   By creating
> simple functions to access data,
> as you've found it simplifies coding, reducing
> errors which in turn reduces
> development and maintence time.
> 
> But more significantly, accessors route all of
> your storage-handling to a
> small set of functions that could, ideally, be
> tossed into a library or
> backscript for global access.  With the
> philosophy that separating code,
> data, and UI keep large projects easier to
> maintain and enhance, accessors
> support this philosophy well by minimizing
> hard-coded references to data
> storage mechanisms.
> 
> If, for example, you decide in a future version
> of your app to migrate
> custom props to a database, you'd only need to
> update your accessor
> functions contained in one small library and
> the rest of your code
> throughout your app continues to work without
> modification; used
> consistently, you'll never have to wonder if
> you've caught all of the places
> your code refers to storage mechanisms.
> 
> -- 
>  Richard Gaskin 
>  Fourth World Media Corporation
> 
>
___________________________________________________________
>  Ambassador at FourthWorld.com      
> http://www.FourthWorld.com
>  Tel: 323-225-3717                       AIM:
> FourthWorldInc

thanks, and thanks again for the article on 
naming conventions like uMyProp, pMyParam etc.

Erik

=====
erik at erikhansen.org    http://www.erikhansen.org

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com


More information about the Use-livecode mailing list