D
Dr John Stockton
JRS: In article <di3Bd.63892$QR1.37398@fed1read04>, dated Fri, 31 Dec
2004 03:01:31, seen in Arthur Shapiro
With that experience, you may well recall punched cards and the daily
test run.
Firstly, be sure that in initial code development you are as far away
from that state as possible. No uploading, for example; just have a
browser and a backing-up editor open side-by-side on the same file, so
that you can edit-save-refresh within seconds.
Indeed, with a local copy (to save our bandwidth) of <URL:http://www.mer
lyn.demon.co.uk/js-quick.htm> one can just edit-test-edit for simple
code.
With a rapid test cycle, you can add only the minimum code at one time;
if you can test something after ten keystrokes, the number of possible
errors is greatly reduced. You can also use alert(X) freely, to verify
values; and comment it out or drag it away when not immediately wanted.
If the script uses a form, pre-load the input controls while testing by
using 'value="<default>"' and 'checked', so that the point at issue can
be re-tested without re-typing data.
You will have noticed that most script, here and on the Web, uses
excessive code repetition. ISTM that modularising into small functions
that can be tested independently, even if some are only called at one
location, is at least as useful in javascript as it is elsewhere.
Use validators frequently.
Others will no doubt write of tools outside editor-&-basic-browser.
However, it might have been well to say what browser(s) you have to
hand. Since so many things are, internationally, different from what
they may be in your unspecified country, it would be well to give your
approximate location; even if your code is intended to be international,
your habits may remain local.
Remember that all the code in a page is downloaded, perhaps over slow
dial-up. Therefore, eschew bloated functions with numerous options of
which any given page needs only one or two.
See the newsgroup FAQ & notes; and try my site.
2004 03:01:31, seen in Arthur Shapiro
A general question: as you can tell, I'm a javascript novice (although a
software engineer with decades of experience). What sort of tools are
available for stepping through and otherwise debugging a small script such as
the one in question? That seems like a practical way to pick up this stuff.
Clearly it takes time and a lot of false steps to reach your obvious level of
proficiency.
With that experience, you may well recall punched cards and the daily
test run.
Firstly, be sure that in initial code development you are as far away
from that state as possible. No uploading, for example; just have a
browser and a backing-up editor open side-by-side on the same file, so
that you can edit-save-refresh within seconds.
Indeed, with a local copy (to save our bandwidth) of <URL:http://www.mer
lyn.demon.co.uk/js-quick.htm> one can just edit-test-edit for simple
code.
With a rapid test cycle, you can add only the minimum code at one time;
if you can test something after ten keystrokes, the number of possible
errors is greatly reduced. You can also use alert(X) freely, to verify
values; and comment it out or drag it away when not immediately wanted.
If the script uses a form, pre-load the input controls while testing by
using 'value="<default>"' and 'checked', so that the point at issue can
be re-tested without re-typing data.
You will have noticed that most script, here and on the Web, uses
excessive code repetition. ISTM that modularising into small functions
that can be tested independently, even if some are only called at one
location, is at least as useful in javascript as it is elsewhere.
Use validators frequently.
Others will no doubt write of tools outside editor-&-basic-browser.
However, it might have been well to say what browser(s) you have to
hand. Since so many things are, internationally, different from what
they may be in your unspecified country, it would be well to give your
approximate location; even if your code is intended to be international,
your habits may remain local.
Remember that all the code in a page is downloaded, perhaps over slow
dial-up. Therefore, eschew bloated functions with numerous options of
which any given page needs only one or two.
See the newsgroup FAQ & notes; and try my site.