Re: avoiding huge globals files
Posted in 1996
In article <851093474.19834@dejanews.com>, frantz@centrum.is writes >I don't quite follow why it is better to put each cursor name in a separate >module. Is it realistic to be so concerned about the module size? I would have I had simplified the example, I there are lots of functions per cursor. (declare,prepare,open,fetch next,fetch (first,last,next,prev), reposition after commit has closed it) With so much code one module for 20 cursors could become > 10,000 lines of code!! Also it's nice to be able to have a sed script to generate the code for more cursors if you need > 20. ( for i in 01 02 03 04 05 06 .. sed 's/cur_NN/cur_2$i/'.... All you then need is to increase the global value on maximum number of cursors opened at one time in my init_cursors function at expand the large case statements in the main module. Plus it fixes are done it's easier to version of a module with one cursor in it then 20. Also if i need to patch cursor handling I can just patch cursor 01 and recompile it and test it. Then use sed above to generate the code for the other cursors. Speeds up the compile/link/test cycle if I just recompile one cursor rather than 20!! Basiclly it's easier/quicker to maintain a module with one cursor in and use sed to replicate it rather than maintain a module with 20 cursors in it by hand. >just done: > > function close_cursor(cursor_id) = > > case > when cursor_id = 01 close my_cur_01 > when cursor_id = 02 close my_cur_02 > .... > >This technique is used extensively in the Power-4gl toolkit (see signature >below) e.g. for controlling window handling, but the functions are kept in one Funny I wondering what Power-4gl did when I wrote that. Just had lost the URL for it. >module to keep from having to use globals. > >Otherwise, I certainly agree that globals should be used in a limited and easy >to control manner, and your method of using a global file for a "family" of >modules adheres to that philosophy. Thanks. > >> Who said 4GL is not object orientated :->. > >Exactly. Well, let's not get too carried away. OK. > >---------------------------------------------------------------------- >John H. Frantz Power-4gl: Extending Informix-4gl >frantz@centrum.is http://www.rl.is/~john/pow4gl.html > ^^^^^^^^^^^ > is now up and running again >-------------------==== Posted via Deja News ====----------------------- > http://www.dejanews.com/ Search, Read, Post to Usenet By the way is the source to Power-4gl available or it is more of a commerical venture?? -- David Williams