Personally, I'm not a fan of Hungarian notation. I've taken this view over the course of many years with projects where I have started with, or later maintained, code using it. I think Hungarian notation originated from languages where a data type is not explicitly declared by is inherent from the start of the variable name. Needless to say, this trend did not get followed in modern languages. In the Windows environment, Microsoft then became quite keen on it and use it in API's to date. In theory, the notation should work because it is a form of documentation that in embedded into the code. It does however, have some practical drawbacks: 1) When a variable changes type (and that happens a lot), a developer should change the variable name. In many cases they don't, and it causes all sorts of problems. Even Microsoft were guilty of this when the Win16 APIs were changed to Win32. All word based (w prefix) should have been changed to Double words (dw prefix) but some slipped through the net. Of course it can be argued that is strict code change practices are adhered to, this problem will not happen... but it usually does. 2) It's important to remember that it is only a commenting convention - you get no extra warnings or errors from compilers and interpreters. 3) How far do you go? Should you prefix function names? 4) Although not so much a problem with MapBasic given it's basic and map types, richer environments give rise to some really ugly variable names. 5) A VB programmer once told me there were well over 100 data type prefixes for the language! 6) It can be argued that in well designed/written code, the definition is never that far away from the use. Localised variables, keep functions to a manageable length, avoid globals, etc. Some development environments tell you what a variable is just by hovering the mouse pointer over the name. 7) A lot of developers who ported software from Win16 to Win32 grew to hate Hungarian notation. Just wait until we step up, or across, again. 8) Again, away from MapBasic, there is a strong argument that it's not necessary with OO languages. Some argue that C++ doesn't fall into this category due to its heritage. 9) I concede that I do prefix class types with "C", but this is slightly different from variable use and does help with preventing namespace contamination. This is just my opinion - there's no right or wrong. Do what you need, or are forced, to do! Regards, emhWarren_Vick (emh = English Male Human) Europa Technologies Ltd, U.K. http://www.europa-tech.com ~~~~~~~~~~ Advertisement ~~~~~~~~~~~ Quick DOQQ Aerial Photos - Lower Price, Faster Delivery LAND INFO offers full coverage of DOQQ aerial photos, priced lower and delivered faster than the USGS and other providers. LAND INFO also offers feature extraction from the photography. Visit http://www.landinfo.com/directions.htm for complete details. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _______________________________________________________________________ List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MapInfo-L" in the message body.
RE: MI-L MapBasic Code Documentation Standards
Warren Vick, Europa Technologies Ltd. Fri, 24 Aug 2001 07:46:12 -0700
- MI-L MapBasic Code Documentation Sta... Jones, Ioan
- Re: MI-L MapBasic Code Document... PEM
- Re: MI-L MapBasic Code Document... Trey Pattillo
- Re: MI-L MapBasic Code Document... Dr. Franz-Josef Behr
- Re: MI-L MapBasic Code Document... Bill Thoen
- Re: MI-L MapBasic Code Document... Warren Vick, Europa Technologies Ltd.
- Re: MI-L MapBasic Code Document... Bill Thoen
