Script debugging

 From:  bemfarmer
8264.3 In reply to 8264.2 
Hi dan,
Here are some of my amateur "techniques" :-) on Windows 7, and amateur opinions, for everyone's amusement:-)
I have a subdirectory call SCRIPTS, which contain a subdirectory for each project.
My version control is poor.
I use Notepad++ for editing. Hardcopy printouts are shadowy :-(
In Notepad++, there are two windows, left and right, each of which can hold many files. Cut and paste can be done between windows.
Files can be easily swapped between the windows. File save and undo are easy.
Do not use the .html extension. .html does not work. To save as .htm with the .html save offering, add .htm extension to the end of the file name.
Once started with .htm or saved as .htm, just hit the save floppy icon. There is no reversion to .html.
I usually select an existing script which functions well and has compatible code to the new project, copy it to the project directory, and rename it to the
new project name.
There are several "styles" of programming, Michaels excellent styles, and Max's excellent and tough for me to understand code.
Script in the .htm file lacks "debug" help, and may not work for "peculiar reasons", so it is better to script in the .js file, and later move it to .htm script
section for speed, if needed. There are multiple ways to work with Factories and the Geometry Database.

For the directory library, I created a link to MoICommands subdirectory, to assist copying .js and .htm files from the SCRIPTS sub sub directory to the MoI
program commands directory.

It is very important for me to always work with a functioning program, and make small changes, and tweak them until they function properly, or UNDO them.
Making massive changes which do not work makes it difficult to "debug."
Also, set up a "WorkingSoSo" file and save versions which actually partially function, such as draw some rudimentary curve on the screen.
Then, after making a bunch of changes which do not function, the SoSo version can be reverted to.
Temporary Alerts can be inserted to glean what the new program is doing.
It is important to avoid spelling differences, such as capitalized vs uncapitalized variables, so be consistent with names, and use descriptive names, not single character names. I study Michaels scripts intensively, and try to mimic them, and their "styles." They can be "complex..."
Asking Michael for help is another good method, as he is superb and knowledgeable. I try not to ask for help, until exhausting "permutations."

Another method is to use Visual Studio 2015 community edition, free, which can have a project directory and solution (file?).
Hardcopy printouts are nice. As a new user, VS2015 community edition seems to be particularly difficult to figure out.
.js and .html should not be directly loaded, but should be in the project and/or solution files/directories/?, loaded in some unknown and inscrutable fashion.
(I'll have to read the directions sometime:-)

Link can be made to your own github account. See YouTube articles by Donnie Santos https://www.youtube.com/watch?v=8lk6BSsX2g4
and https://www.youtube.com/watch?v=zNANRs0nZfU I have not quite actually done this yet :-(

- Brian