Seeking recommendations / suggestions for use of library stacks.
bobsneidar at iotecdigital.com
Fri May 19 11:56:51 EDT 2017
I would agree, but I have become fond of constants, especially in objects where code is similar but need certain things to be different. For instance I have a button bar which opens for edit, creates new form, deletes data, saves data etc. I copy this bar to each of my forms. The code in most buttons is identical, but the tables and validations, as well as parameters passed to library functions changes for each form. In this case it becomes useful to me because to make the bar usable by any of my forms, I only have to edit the constants of each button.
> On May 18, 2017, at 19:33 , Andre Garzia via use-livecode <use-livecode at lists.runrev.com> wrote:
> I usually follow Alis approach. I have a separate initialization handler
> which I can call repeatedly if needed. The librarystack call just call it
> once but if needed I can call it from the messagebox as well.
> On the topic of libraries, it is good to follow a "functional programming"
> approach where you try not to rely on script local and global variables. If
> you library functions need nothing but their own parameters to work on, it
> becomes easier to test them and calling them over and over seldon generate
> side effects. It is way easier to test (and debug) a function that doesn't
> touch anything outside of its own script (as in it processes data and
> return data but doesn't cause changes outside itself).
More information about the Use-livecode