> Le 24 févr. 2017 à 09:12, Herr Alexander Heintz via 4D_Tech > <[email protected]> a écrit : > > [...] > Concerning the descriptor, I have found it more useful to have that up front, > spearated by underscore: > > $t_myText > $al_myLongArray > o_processObject > > etc. > Why? > 3 reasons: > - when typing and you need a specific local text variable you already have, > just type the prefix and the editor will show you all text variables you > already have. > - I can easily check for compiler typing errors by searching (for example) > all C_LONGINT in compiler declarations where the variable does not start with > l_ > and, much more import as I am lazy: > I have a macro and method that automatically declares all my locals in a > method and puts the block on top. > Easier to recognize the type if you just need to match a starting pattern…
In 4d langage I consider type in the name is mandatory, some don't. In js I don't, BTW. I used to put type at start but since ~10 years I prefer at end: $table_p = table pointer $table_l = table number $table_al = array of table numbers $table_ap = array of table pointers $person_o = object describing a person $LBsColumn_ao = object array describing columns in a selection listbox $csvData_a2t = 2d text array of data from a comma separated value document etc. Except first, other reasons you mention are kept (I use 4d Pop to grab and declare variables). But most of the time during code input my "entry point" is the variable purpose (=humanly significant part of the name: table, person, csvdata, etc). And when I read i'm also concentrated on that part. The type is like some tail I'll look at if the head of the beast is not enough to identify it at first sight. I like short names, too: more letters=long lines, and long lines are difficult to read for me. It seems there 3 kind of 4d developers, mostImportantThingIsType vs purposeAtLeft vs readDeclarationsYouStupid. If I was born arab, reading from left to right, would I do the same? Am I insane because I start by search/replace variable names prior to understand some code from another? ... Is order so important, finally: <http://www.mrc-cbu.cam.ac.uk/people/matt-davis/cmabridge/> ;-) -- Arnaud de Montard ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

