Re: Function Numbering
Posted in 1995
Topics: Stored Procedures & SPL
timothy.hood@sltrib.com (Timothy Hood) wrote: >Our shop is currently involved in a huge debate regarding numbering of >Informix functions. It seems that the COBOL guys like it and the >Informix experienced don't. I think it's a lousy idea. >I wonder if anyone out there has ever seen numbered Informix functions? >If so, did you do any maintenance of that code? What did you think of >numbered functions? Did it speed up construction/maintenance or slow it >down? Hi, I've been using numbered functions for some time now and after the initial shock they can be very useful. I was introduced to them when working on code written by Mach4 Software U.K... They use a mixture of letters and numbers e.g. a_000_initialize_variables() a_010_initialize_arrays() b_000_new_record() b_010_Insert_new_record() z_000_load_browse_array() When programs are very large 1000 plus lines this form of function identification really helps to find them in a printout. That is assuming they are kept in alphabetical/numerical order within the program or module. I've extended the Mach4 system in that if a program is split into several modules I will use a_000 etc in the main module and each subsequent module will have the number incremented by 100 so the next module would have functions a_100_ . The next module functions a_200 and so on. This means that when you call a 100 function from the main module you know not to look in the main module but in the next module you wrote etc. Mach4 also introduced me to the concept of variable prefixes e.g w_counter, w_amount, w_cost etc. By using the prefix you never have to worry about reserved words. Again I've enlarged the concept, I use g_ for global variables i.e. g_counter and f_ for variables defined in functions i.e f_num_times. It becomes very obvious when using this system which variables are only affected within a function and which will have an effect throughout the program. I also use prefixes for window names w_input_window and for cursor names c_search_stock. Numbering functions might seem cumbersome at first but I must say I now prefer it, it's much easier to search for g_010 than check_for_next_number when trying to maintain an existing program and somehow it helps to provide some structure to the layout of the program. Initialization routines usually end up at the front of the program, array loading functions at the back and various bits and pieces seem to end up in appropriate and consistant places within each program. Hope this is of use.. Cheers Dave Ingledew