Skysnake Posted August 14, 2015 Share Posted August 14, 2015 a good buddy who is qualified engineer, programmer and project manager tells me he has seen meetings break up as to 'how to properly make flower boxes' --- i guess that programmers are highly individual lot and very opinionated... this makes it very difficult to agree on a 'standard' - never mind 'best practice' or even a 'single best way' to teach new coders (ie AutoIt or anything else for that matter).I have found that I use a kind of shorthand. I have several small projects running to automate all kinds of silly little things in my office, which save massive amounts of time, and I have learnt the hard way that without comments the first time round, the updates kill me, because what seemed painfully obvious initially, may not be so clear a year from now.this is not a silly topic, but a potentially hazardous one***************************************************************** * not a programmer, but a keen auto-mater * * * * hoping to avoid a flame war. * * :) * *****************************************************************in any event, some examples and recommendations in the FAQ on comments may also be a good idea. even if not everyone agrees, at least it will present a starting point... Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
czardas Posted August 29, 2015 Share Posted August 29, 2015 (edited) I have given up thinking about this and started writing all my single (EOL) statements using lower case without full stops - like in a list. If it requires more than one sentence, then I would probably create a comment block and write normal English.Func _OverflowDetect($sOperator, $iOperand_1, $iOperand_2) If Not StringRegExp($sOperator, '\A\s*[\+\-\*]\s*\z') Then Return SetError(1) ; operator not recognized If Not StringInStr(VarGetType($iOperand_1), 'Int') Then Return SetError(2) ; meaningless request If Not StringInStr(VarGetType($iOperand_2), 'Int') Then Return SetError(3) ; ditto ; execute the expression Local $iExecute = Execute($iOperand_1 & $sOperator & $iOperand_2) ; execute the expression with the operands converted to doubles Local $fCompare = Execute('Number(' & $iOperand_1 & ', 3)' & $sOperator & 'Number(' & $iOperand_2 & ', 3)') ; the results should be approximately equal Return StringFormat('%.15e', $iExecute) <> StringFormat('%.15e', $fCompare) EndFunc Edited August 29, 2015 by czardas Xandy 1 operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
guinness Posted August 29, 2015 Author Share Posted August 29, 2015 I try to avoid comments after a statement these days and opt for placing on a separate line. Browsing around, I see more people adopt your approach @czardas. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
czardas Posted August 29, 2015 Share Posted August 29, 2015 (edited) For me, whether to write a comment at the end of a statement depends on how long the line of code is and also consistency of layout. I don't think you can generalize about this. The important thing is that it is easy to associate the section of code that a comment refers to. My reason for not using capitals is my own attempt at consistency: 'ditto' is not a sentence. I got fed up with mixing and matching sentence case. I think it looks rather messy when sometimes a capital appears and at other times not. Edited August 29, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
guinness Posted August 29, 2015 Author Share Posted August 29, 2015 (edited) General standard is 80 characters wide. Why that is (after I did a bit of research) is a salute to the old days. Silly if you ask me. Edited August 29, 2015 by guinness Typo UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
czardas Posted August 29, 2015 Share Posted August 29, 2015 You learn something new everyday. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
guinness Posted August 29, 2015 Author Share Posted August 29, 2015 I have known it has been 80 for ages, but I prefer 120 OR I don't care =) Just didn't know where 80 came from as it's seemed an arbitrary number to me. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Chimaera Posted August 30, 2015 Share Posted August 30, 2015 I generally go on the line straight after the code because underneath makes the script huge well the amount i add anyway.So just a few words at the end works for me.The examples on separate lines are prob easier to read but i guess you adapt your own style If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
jvanegmond Posted August 30, 2015 Share Posted August 30, 2015 I have known it has been 80 for ages, but I prefer 120 OR I don't care =) Just didn't know where 80 came from as it's seemed an arbitrary number to me.We have rules for this where I work. We went from 80 initially to 120 now which is quite a lot. You need to consider information density per line. Only so much will fit in your brain. Clear and short lines are best. github.com/jvanegmond Link to comment Share on other sites More sharing options...
guinness Posted August 30, 2015 Author Share Posted August 30, 2015 We have rules for this where I work. We went from 80 initially to 120 now which is quite a lot. You need to consider information density per line. Only so much will fit in your brain. Clear and short lines are best.I think it can depend on the language, because in PHP 80 is okay, but for jQuery plugin it can sometimes be too little. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
mLipok Posted August 30, 2015 Share Posted August 30, 2015 (edited) I have known it has been 80 for ages, but I prefer 120 OR I don't care =) Just didn't know where 80 came from as it's seemed an arbitrary number to me.80x60 chars on old monochrome CRT display Edited August 30, 2015 by mLipok added word "old" czardas 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
TheDcoder Posted August 31, 2015 Share Posted August 31, 2015 ; I don't use fullstops in single line comments #cs But I do proper puntuation in multi-line comments, it looks neat too. #ce EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
TheSaint Posted September 8, 2015 Share Posted September 8, 2015 (edited) Basically for me, it can vary with comments, but generally I will end a comment with a full stop if I remember and it is not a title to a section. I also use a space for a text comment, and none for disabled code. I also use case differences for specific elements, especially to further differentiate titles. They all help speed up deciphering at a glance I find. I also use a lot of commented blank lines to help tie things together but allow for easier reading, along with specific indents. I use a lot of groupings to separate out types of code, etc. I'm guessing when others look at my code, they see a distinct pattern ... I certainly do. Readability is high on my agenda of good coding practices. To that end, I often spread commands over multiple lines, rather than have some single complicated looking line ... but that is sometimes governed by mood and surrounding complexity ... that means I sometimes simplify things to break things up for better readability. There is always a method behind all my coding, with simplicity of understanding my constant aim.Like most I suspect, you develop a certain set of habits, early on, that you keep refining. You may occasionally make a leap that is a somewhat radical change, as your knowledge and experience develops. I have done so a few times. I can now date my scripts by their layout.I also never use Block Commenting, as I find it doesn't stand out enough for me. And I rarely put a comment after code on the same line, except when I am being very descriptive, as an aid to others or when complexity is high.; CONTROLS (a title); SETTINGS (another title); Title; Not a title.;$var = 1P.S. Funny how a simple full stop can open a floodgate. Edited September 8, 2015 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
BrewManNH Posted September 8, 2015 Share Posted September 8, 2015 (edited) Like most I suspect, you develop a certain set of habits, early on, that you keep refining. You may occasionally make a leap that is a somewhat radical change, as your knowledge and experience develops. I have done so a few times. I can now date my scripts by their layout.I can agree with that, my old VBScripts used to use some very identifiable commenting so that anyone that had to try to figure out what I was doing would be obvious even to someone not that familiar with what I was doing in that section.; *************************************** ; ; Comment went here ; ;****************************************As you went through the scripts, you'd KNOW that something different was being done in this section that was different than the last section you were looking at. I don't know if anyone had to follow the scripts I wrote later, but they sure knew what I was doing in the code when they needed to change something. I don't make current comments quite so "bold" these days, but I still sometimes use that style when I have code that is something that could be moved to another script without modifying it. Edited September 8, 2015 by KingBob If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
OldGuyWalking Posted June 16, 2016 Share Posted June 16, 2016 (edited) I know I'm very late to this topic but it is an interesting one. I've been writing code since the days of the Commodore 64, mostly in BASIC then a couple of decades later I started coding MS Office apps in VBA. Self-taught for the most part until I took courses in Cobol and then eventually C (which I never moved forward with because I could never get my head wrapped around pointers). Even in the early days, documenting code was something that came up in courses, articles, and from users in user groups who were developing applications. In the early days of BASIC there wasn't alot of bandwidth or storage space available so code was usually written with very few comments and the comments that were in the source code tended to be very short to save space. It also made the comments cryptic. As space became less of an issue comments became longer but after a year or two most of those comments became cryptic. I got into AutoIt in 2008 and put together some scripts that I used at work and some at home. I wrote scripts in AutoIt until about 2013 and only picked it back up a few months ago. I happened across some of the scripts I wrote in 2008. It was like reading code from someone else. Some of the comments in the code made sense and some of them fell into the category of "what was I thinking?". Anyway, I have done some online tech writing for some really tough editors. I tend to write the way I think but when writing articles for a general audience there must be consistency in the writing style and a reasonable attempt at cleaning up grammatical, spelling, and punctuation errors. However, for programming, I don't write comments for an audience, I write them for myself. If I ever had any generic code that might be useful to anyone other than myself I would probably make an attempt at making the comments clearer or even expanding them. I'd probably even add a period at the end of each sentence. But for now, my goal is to write a comment that will not only make sense to me now but will also make sense to my future self. Punctuation is optional and spacing and indenting is whatever my fingers happen to feel like doing when I'm typing the comment. Generally, my comments are above any section of code that I believe could require some explaination at a later date. I may comment Dim'd variables on the same line as the variable. If I have a group of variables such as the variables used in a GUI form or column names in a Listview then I'll have a one line comment above the group identifying what the group is associated with. I also tend to add lines, boxes, asterisks, <--- arrows, etc. over any code that I consider to be important or when I know I'm going to want to make some additional changes to the code at a later date. If I have working code that I can reuse later in another project or can add to my Include file I will add a comment above and below the code and include the words "Recycle Code". Then, when I have the time to work on consolidating code I can do a text search through the *.au3 files to get a list of any code I haven't worked on yet. It's one of the nice things about au3 files being text. It makes them easy to search. Edited June 16, 2016 by OldGuyWalking Additional random thoughts... Skysnake 1 Link to comment Share on other sites More sharing options...
czardas Posted July 4, 2016 Share Posted July 4, 2016 (edited) I quite often use raised eyebrows in my comments: ; ^^ . . . simply to draw attention to a particular line of code. I've got used to doing this now and anyone reading the code is likely to figure this out before long, or at least ponder the importance of an expression a little while longer. Edited July 4, 2016 by czardas Skysnake 1 operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
TheDcoder Posted July 5, 2016 Share Posted July 5, 2016 ; ^^ EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
czardas Posted November 27, 2016 Share Posted November 27, 2016 Related Article: http://blogs.msmvps.com/benvoigt/2009/08/01/technical-documentation-like-code-does-not-follow-english-rules-for-grammar-and-style/ mLipok 1 operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now