Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting Starting in JavaScript et al

21 views
Skip to first unread message

Gene Wirchenko

unread,
Nov 3, 2011, 11:41:32 PM11/3/11
to
Hello:

The company that I work for is going for a Web-based frontend for
its client billing system and to integrate the various company
databases and applications.

The app will be internal for the projected future. The browser
will be IE 9, the OS Windows 7. We will be using SQL Server Express
for the DBMS. For the Web end, it will be JavaScript, VBScript, ASP
Classic, and AJAX.

I have some sample code, but have already found deficiencies with
it. I have dealt with some of the deficiencies (escape characters was
a big one), but it has been a slow and arduous time.

I have found that there are many basic guides on the Web, but all
too few that get into the nasty bits. For example, escape characters
are not dealt by many pages, and I had to do a lot of hunting to find
out what to do.

I have read/skimmed the FAQ, and much of it is too high a level
for me for now.

Are there any gotchas that I should be particularly alert for?

Are there any good books that get into the nasty bits? (Of the
two mnetioned in the FAQ, one does not seem appropriate. The other
one, I am not sure about.)

You can read my questions as being about JavaScript specifically
or the conglomerate of systems I mentioned. I could use help with
both.

Sincerely,

Gene Wirchenko

BOOK-AZ

unread,
Nov 4, 2011, 3:15:23 AM11/4/11
to
Семимиллиардный житель Земли получил тонну апельсинов http://book-az.com

Christian Kirsch

unread,
Nov 4, 2011, 5:30:14 AM11/4/11
to
Gene Wirchenko schrieb:

> You can read my questions as being about JavaScript specifically
> or the conglomerate of systems I mentioned. I could use help with
> both.
>

But what *are* your questions? You mention one thing ("escape
characters"), and I don't even understand, what you mean by this. If you
want answers, you should probably be asking clear questions.

Erwin Moller

unread,
Nov 4, 2011, 6:55:31 AM11/4/11
to
On 11/4/2011 4:41 AM, Gene Wirchenko wrote:
> Hello:
>
> The company that I work for is going for a Web-based frontend for
> its client billing system and to integrate the various company
> databases and applications.
>
> The app will be internal for the projected future. The browser
> will be IE 9, the OS Windows 7. We will be using SQL Server Express
> for the DBMS. For the Web end, it will be JavaScript, VBScript, ASP
> Classic, and AJAX.

Hello Gene,

A few warnings:

VBscript ASP classic?
Are you sure about that?
I maintain some old software I wrote many years ago which is written in
classic VBscript on IIS, and it really hurts sometimes to wrap my mind
around it. I never use VBscipt/classic ASP anymore for new projects (it
has been like that for more than 10 years). Most developers won't use it
for new projects (unless it is the only thing they know).

Seriously, consider using something better since you give the impression
your company will develop it from the ground up anyway.

Also, make clear what you are doing serverside and clientside. In your
posting you give me the impression you are not sure where what language
runs exactly, but I might be wrong.
For example, both VBscript and JavaScript can run clientside and
serverside. If you are going to use AJAX, you must understand the
differences between serverside and clientside very well.
Especially if you are ever going to open up your webapp to the public:
security matters.

And last: Are you sure you want to support IE9 on Win7 only?
Good webapps run on any browser. Just make sure you write your code
sensible, and you support ALL BROWSERS worth mentioning.
I can't think of any valid reason to support only IE9 on Win7, unless
you are knee-deep into ActiveX components running inside the browser.
(Don't do that if you can avoid it.)

>
> I have some sample code, but have already found deficiencies with
> it. I have dealt with some of the deficiencies (escape characters was
> a big one), but it has been a slow and arduous time.

Possibly.
In my experience it is easier to find poor scripts on the web than good
ones.
And it is hard for newcomers to tell them apart. :-(


>
> I have found that there are many basic guides on the Web, but all
> too few that get into the nasty bits. For example, escape characters
> are not dealt by many pages, and I had to do a lot of hunting to find
> out what to do.

Do you have an example of that?
I am not sure I can follow.
Are you talking about escaping characters like ' " \?

>
> I have read/skimmed the FAQ, and much of it is too high a level
> for me for now.

Yes, some topics are hard to grok (closures for example), but if you
plan to move your application to your customers, you must have a certain
understanding and do things right.
If you don't, your app will fail on other browsers or in circumstances
you cannot envision right now.
You also have the serious possibility of making serious mistakes and
create security holes.
If don't know what business you are in, or in which country you live,
but opening up private information can have serious repercussions in
certain countries. Please take care.


>
> Are there any gotchas that I should be particularly alert for?

Yes. Too many to sum up here.

>
> Are there any good books that get into the nasty bits? (Of the
> two mnetioned in the FAQ, one does not seem appropriate. The other
> one, I am not sure about.)

I learned my basics from the "Definitive Guide", second edition that was
I think, don't use that now. ;-)
I think I learned more by lurking around in comp.lang.javascript.


>
> You can read my questions as being about JavaScript specifically
> or the conglomerate of systems I mentioned. I could use help with
> both.

To be honest: I think you should start studying a lot, or hire a
competent developer.

Last tip:
Always feel free to ask questions in here.
Don't be scared to get spanked in the beginning.
1) Post your examplecode/problem in here as clear as you can.
Don't be afraid to ask stupid questions.
2) You WILL be corrected, also on thing you didn't ask about.
Take it all seriously, ignore some trolls, and you'll be good.


>
> Sincerely,
>
> Gene Wirchenko

Good luck.
Regards,
Erwin Moller


--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens

Gene Wirchenko

unread,
Nov 4, 2011, 12:54:36 PM11/4/11
to
On Fri, 04 Nov 2011 11:55:31 +0100, Erwin Moller
<Since_humans_read_this...@spamyourself.com> wrote:

>On 11/4/2011 4:41 AM, Gene Wirchenko wrote:
>> Hello:
>>
>> The company that I work for is going for a Web-based frontend for
>> its client billing system and to integrate the various company
>> databases and applications.
>>
>> The app will be internal for the projected future. The browser
>> will be IE 9, the OS Windows 7. We will be using SQL Server Express
>> for the DBMS. For the Web end, it will be JavaScript, VBScript, ASP
>> Classic, and AJAX.

>A few warnings:
>
>VBscript ASP classic?
>Are you sure about that?

That is what has been selected.

>I maintain some old software I wrote many years ago which is written in
>classic VBscript on IIS, and it really hurts sometimes to wrap my mind
>around it. I never use VBscipt/classic ASP anymore for new projects (it
>has been like that for more than 10 years). Most developers won't use it
>for new projects (unless it is the only thing they know).
>
>Seriously, consider using something better since you give the impression
>your company will develop it from the ground up anyway.

Your impression is correct.

>Also, make clear what you are doing serverside and clientside. In your
>posting you give me the impression you are not sure where what language
>runs exactly, but I might be wrong.
>For example, both VBscript and JavaScript can run clientside and
>serverside. If you are going to use AJAX, you must understand the
>differences between serverside and clientside very well.

It will be JavaScript on the client side and VBScript on the
server side.

>Especially if you are ever going to open up your webapp to the public:
>security matters.

I have been considering that.

>And last: Are you sure you want to support IE9 on Win7 only?
>Good webapps run on any browser. Just make sure you write your code
>sensible, and you support ALL BROWSERS worth mentioning.
>I can't think of any valid reason to support only IE9 on Win7, unless
>you are knee-deep into ActiveX components running inside the browser.
>(Don't do that if you can avoid it.)

I know your arguments. This is to be an internal app, and we can
enforce the platform. Later, we may expand it. It is more important
to get the app going first. I do not plan to write to IE9/Win7, but I
am not going to worry about breaking a different combo FOR NOW.
Personally, I prefer Firefox.

>> I have some sample code, but have already found deficiencies with
>> it. I have dealt with some of the deficiencies (escape characters was
>> a big one), but it has been a slow and arduous time.
>
>Possibly.
>In my experience it is easier to find poor scripts on the web than good
>ones.
>And it is hard for newcomers to tell them apart. :-(

Code that will not properly handle values with single quotes or
ampersands are easy for this newcomer to detect. I have a solution to
this. I do not know that it is complete w.r.t. weird characters.

>> I have found that there are many basic guides on the Web, but all
>> too few that get into the nasty bits. For example, escape characters
>> are not dealt by many pages, and I had to do a lot of hunting to find
>> out what to do.
>
>Do you have an example of that?
>I am not sure I can follow.
>Are you talking about escaping characters like ' " \?

That was one.

>> I have read/skimmed the FAQ, and much of it is too high a level
>> for me for now.
>
>Yes, some topics are hard to grok (closures for example), but if you
>plan to move your application to your customers, you must have a certain
>understanding and do things right.
>If you don't, your app will fail on other browsers or in circumstances
>you cannot envision right now.
>You also have the serious possibility of making serious mistakes and
>create security holes.
>If don't know what business you are in, or in which country you live,
>but opening up private information can have serious repercussions in
>certain countries. Please take care.

I plan to. This is an internal app though.

>> Are there any gotchas that I should be particularly alert for?
>
>Yes. Too many to sum up here.

Can you give me some specifics? Even a checklist of "Not that,
you fool!" would help.

>> Are there any good books that get into the nasty bits? (Of the
>> two mnetioned in the FAQ, one does not seem appropriate. The other
>> one, I am not sure about.)
>
>I learned my basics from the "Definitive Guide", second edition that was
>I think, don't use that now. ;-)

That is the one I am not sure about. I will have to hunt down
some reviews. The FAQ has little.

>I think I learned more by lurking around in comp.lang.javascript.

Yup. Did you know that there have been over 6,000 posts to this
newsgroup in the past two years? (Sorry, but that counts the nude
spams.)

>> You can read my questions as being about JavaScript specifically
>> or the conglomerate of systems I mentioned. I could use help with
>> both.
>
>To be honest: I think you should start studying a lot, or hire a
>competent developer.

I am trying to study. As I mentioned earlier, there is a lot of
very basics, but not so much of the stuff needed to really make a
solid system.

>Last tip:
>Always feel free to ask questions in here.
>Don't be scared to get spanked in the beginning.
>1) Post your examplecode/problem in here as clear as you can.
>Don't be afraid to ask stupid questions.
>2) You WILL be corrected, also on thing you didn't ask about.
>Take it all seriously, ignore some trolls, and you'll be good.

Standard, good USENET advice.

Thank you for your post.

Sincerely,

Gene Wirchenko

Gene Wirchenko

unread,
Nov 4, 2011, 1:00:02 PM11/4/11
to
On Fri, 04 Nov 2011 10:30:14 +0100, Christian Kirsch <c...@bru6.de>
wrote:

>Gene Wirchenko schrieb:
>
>> You can read my questions as being about JavaScript specifically
>> or the conglomerate of systems I mentioned. I could use help with
>> both.

>But what *are* your questions? You mention one thing ("escape

They are the sentences that end with "?". Here they are again:

Are there any gotchas that I should be particularly alert for?

Are there any good books that get into the nasty bits?

>characters"), and I don't even understand, what you mean by this. If you

Maybe you use different terminology? In some languages, to
represent certain characters in a string, one must escape the
character. C example:
char tab='\t';
tab would then contain the tab character, not a backslash followed by
a lower-case T.

>want answers, you should probably be asking clear questions.

One of the problems of getting started is finding out exactly
where to start. When I have specific questions, I will ask them. For
now, I am trying to get the lay of the land.

Sincerely,

Gene Wirchenko

Thomas 'PointedEars' Lahn

unread,
Nov 4, 2011, 3:46:46 PM11/4/11
to
Gene Wirchenko wrote:

> Christian Kirsch wrote:
>> Gene Wirchenko schrieb:
>>> You can read my questions as being about JavaScript specifically
>>> or the conglomerate of systems I mentioned. I could use help with
>>> both.
>>
>> But what *are* your questions? You mention one thing ("escape
>
> They are the sentences that end with "?". Here they are again:
>
> Are there any gotchas that I should be particularly alert for?
>
> Are there any good books that get into the nasty bits?

You are just asking for it:

<http://www.catb.org/~esr/faqs/smart-questions.html>


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

Gene Wirchenko

unread,
Nov 4, 2011, 4:06:22 PM11/4/11
to
On Fri, 04 Nov 2011 20:46:46 +0100, Thomas 'PointedEars' Lahn
<Point...@web.de> wrote:

>Gene Wirchenko wrote:
>
>> Christian Kirsch wrote:
>>> Gene Wirchenko schrieb:
>>>> You can read my questions as being about JavaScript specifically
>>>> or the conglomerate of systems I mentioned. I could use help with
>>>> both.
>>>
>>> But what *are* your questions? You mention one thing ("escape
>>
>> They are the sentences that end with "?". Here they are again:
>>
>> Are there any gotchas that I should be particularly alert for?
>>
>> Are there any good books that get into the nasty bits?
>
>You are just asking for it:
>
><http://www.catb.org/~esr/faqs/smart-questions.html>

I was wondering if it were your past history with others or that
you were just plain rude. Unfortunately, your reply strongly suggests
it to be the latter.

Just in case the above gave you a bit of pause, how would you (as
a newbie) ask for a book on the subject of your newbieness that deals
with non-trivial uses?

Sincerely,

Gene Wirchenko

Thomas 'PointedEars' Lahn

unread,
Nov 4, 2011, 4:13:00 PM11/4/11
to
Gene Wirchenko wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Gene Wirchenko wrote:
>>> Christian Kirsch wrote:
>>>> Gene Wirchenko schrieb:
>>>>> You can read my questions as being about JavaScript specifically
>>>>> or the conglomerate of systems I mentioned. I could use help with
>>>>> both.
>>>>
>>>> But what *are* your questions? You mention one thing ("escape
>>>
>>> They are the sentences that end with "?". Here they are again:
>>>
>>> Are there any gotchas that I should be particularly alert for?
>>>
>>> Are there any good books that get into the nasty bits?
>>
>> You are just asking for it:
>>
>> <http://www.catb.org/~esr/faqs/smart-questions.html>
>
> I was wondering if it were your past history with others or that
> you were just plain rude. Unfortunately, your reply strongly suggests
> it to be the latter.

*PLONK*

Elegie

unread,
Nov 4, 2011, 5:45:09 PM11/4/11
to
On 04/11/2011 04:41, Gene Wirchenko wrote :

Hi,

> The app will be internal for the projected future. The browser
> will be IE 9, the OS Windows 7. We will be using SQL Server Express
> for the DBMS. For the Web end, it will be JavaScript, VBScript, ASP
> Classic, and AJAX.

Others have already commented on that choice. Note that you can also use
ASP with JScript (this way you'd just have to learn one language instead
of two, unless you already know VBScript).

I used to do some ASP 3.0 about 10 years ago. I liked it very much, it
was very easy, yet be careful about your design: it's all too easy, with
ASP, to have your application layers interwoven (thus making your
application incredibly difficult to extend).

> Are there any good books that get into the nasty bits? (Of the
> two mnetioned in the FAQ, one does not seem appropriate. The other
> one, I am not sure about.)

I don't know about books, but can tell you about my learning javascript.
It all began in 1999, I started with some big book about HTML/Javascript
(this gave me a feeling about the technology), then I started
participating on comp.lang.javascript. I soon identified posters whose
discussions and scripts looked interesting, and read all their past
posts. While doing so, I also read the specifications, and made some
test cases each time I encountered something new. In about 3 years, I
was pretty confident in my skills.

Authors I especially liked reading were Martin Honnen (I have never seen
this guy make a mistake), Jim Ley and Gosha Bine (the stereofrog), and a
few years later, Richard Cornford (who made decisive contributions to
the global understanding of the nature of javascript).

HTH,
Elegie.
Message has been deleted

Richard Cornford

unread,
Nov 5, 2011, 12:14:56 AM11/5/11
to
Gene Wirchenko wrote:
> On Fri, 04 Nov 2011 10:30:14 +0100, Christian Kirsch wrote:
>
>>Gene Wirchenko schrieb:
>>
>>> You can read my questions as being about JavaScript
>>> specifically
>>> or the conglomerate of systems I mentioned. I could use help with
>>> both.
>
>>But what *are* your questions? You mention one thing ("escape
>
> They are the sentences that end with "?". Here they are again:
>
> Are there any gotchas that I should be particularly alert for?

For some reason the biggest "gotcha" with javascript is premature
confidence. There seem to be recurrent manifestations of the
Dunning-Kruger effect (if you are not familiar with than look it up as
it is an interesting, and all too human, psychological phenomenon). To
date I have had three epiphanies where I have suddenly "got" javascript
and realized how utterly diffident my previous understanding of the
subject had been. For the perspective following the third I realized
that 1. the code I was writing after the first epiphany was so bad it
was actively dangerous (to the people who were employing me to write
it), and 2. that there is no good reason to be certain that I have
actually "got" javascript now (event given that I have been writing
nothing but javascript full time for the last 8 years).

The next general "gotcha" is related to the first. Premature (but
actually unjustified) confidence, if examined, would lead to cognitive
dissonance, humans deal with that by irrationally re-enforcing and
bolstering the decisions that they have made. This manifests itself in
some people adopting a religion-like attitude towards some aspects of
browser scripting, and you will find these people writing all over the
internet. Generally you want to be interested in the reasoning that
backs any position that anyone takes (how good are their actual
arguments) and be very wary of those who only assert that they are/were
correct (and particularly those who will not listen to/engage with
criticism).

Recently I had to write a technical test for some JS programmer
interview. I tried to include every common misconception about
javascript that I have noticed. These are (most of) the points I tested
for that bset qualify as "gotchas":-

1. Understanding the factors that determine the - this - value in
javascript code; That it is determined by how you call a function/method
and not, for example, which object that function/method may 'belong' to.

2. Clearly seeing the boundaries between the programming language and
the environment that the browser provides to be programmed; the
distinctions between what the 3rd edition of the language specification
term "host objects", "built-in objects" and "native object".

3. Identifying and understanding the types of values that javascript
uses; that there are 5 primitive data types (boolean, number, string,
null and the undefined type). You can create String, Number and Boolean
objects (explicitly or implicitly) but those objects are distinct from
their corresponding primitive types. (Java programmers are particularly
fond of assuming the string primitive type is actually an object
instance created (implicitly) with the String constructor, it is not.)

4. Understanding that in a loosely types language it is the programmer's
responsibility to keep track of the types of the values that any
particularly variable/property/parameter will/may have; to know when and
what implicit type conversions will occur and avoid every having the
need to exhaustively test the type of an unknown value (particularly
function arguments).

5. The specification for the User Agent header and the corresponding
userAgent property of the navigator object defines its contents as an
effectively arbitrary sequence of characters that does not even need to
be identical for two consecutive HTTP requests. This means that there is
no technical basis for assuming that the userAgent property can be used
as a means of identifying web browser types or versions. Tempting as it
may seem at times, driving script behaviour on the bases of a limited
set of observations of what example userAgent strings may have contained
at some time is a common mistake, and takes quite a bit of fixing once
reality hits home.

5. Confusing javascript's object/array literals with the (necessarily)
much more formal JSON.

6. Assumptions/Inferences about web browser environments are dangerous
and should not be used if they can be avoided (and they can be avoided
much more often than people seem to think). For example:-

if(document.images){
var img1 = new Image();
img1.src = 'foo.png';
}

- tests for the existence of - document.images - in order to guard
against the use of the - Image - constructor in browsers that don't
support it. These two features were introduced together so in practice
this test (which was a common construct, and is given as an example of
'best practice' in some places) did not fail significantly (To the best
of my knowledge it only failed in versions of IceBrowser between 2 and
5, and that browser was so little used that few are even aware that it
ever existed (and it is now dead)). However, if the point is to guard
against attempting to use the - Image - constructor in an environment
where it is not available then the logical subject for the test is the -
Image - constructor itself. When you cannot find the constructor then it
is not there, and you shouldn't try to use it.

The general rule for feature testing is; design the test with its
subject having as close a relationship as possible to the feature that
is to be used, and preferably a one-to-one relationship.

7. Failing to learn the javascript related technologies (HTML, DOM, CSS
and HTTP (at minimum)) formally. That is, become sufficiently familiar
with their specification to know what is there, and where to look in
order to find the answers to the questions that you may have about them.

> Are there any good books that get into the nasty bits?

It was the books that I first read on javascript that got me to the
point of writing code that was actively dangerous. Be very careful with
javascript books; 60%+ factually false is no unknown and I would be
supported to see worthwhile script design advice (given what I have seen
to date).

>>characters"), and I don't even understand, what you mean by this. If
>>you
>
> Maybe you use different terminology? In some languages, to
> represent certain characters in a string, one must escape the
> character. C example:
> char tab='\t';
> tab would then contain the tab character, not a backslash followed by
> a lower-case T.

Escaping is necessary but can be very context dependent. If you get an
arbitrary sting out of a database what you are going to have to do to it
in order to render it 'safe' depends on where it is going to end up. If
it is going into a javascript string then it needs one set escaping, if
its destination is as text in an HTML element then it needs another,
while an HTML attribute may need another. Then there are things like
inserting data as a javascript string that will be used as part of a URL
in the code that will be used for an HTML intrinsic event attribute;
that is three possible levels of escaping for different contexts, that
will need to be applied in the correct order.

Javascript has escape sequences that start with a backslash, but there
are a number of types. So '\t' (the tab) may also be the hexadecimal
escape sequence '\x09' and the Unicode escape sequence '\u0009'. Notice
that the Unicode sequence can accommodate a much wider range of
characters. A little worthwhile advice; you will usually need to escape
quote marks and apostrophes for use inside javascript string, but if you
do that by just preceding them with a backslash then the quote character
is still in the source text and so may need handling at a separate level
in the escaping process. But if you use a hexadecimal or a Unicode
escape sequence instead then the problematic character is gone from that
point forward (and the remaining backslash is both easier to handle and
less often problematic (e.g. not a character that HTML treats as
special).

Also, IE's JScript has had (may still have, I have not checked this in
IE9 yet) a long standing but where the escape sequence '\v' was taken as
a literal 'v' when it should have been treated as a vertical tab. You
don't see vertical tabs often but if they are going to be escaped it is
definitely more predictable to escape then to a hexadecimal or Unicode
sequence.

Escaping forward slashes may seem unnecessary. However, I have seen
(possibly overzealous) security software objecting to seeing them in URL
query strings and I have a recollection of seeing a JSON script
insertion strategy that would be neutralised by unconditionally escaping
that character.

The set of characters that probably should be escaped when included in a
javascript string are the backslash, apostrophe, double quote, carriage
return (\x0D), line feed (\x0A), form feed (\x0C), line separator
(\u2028) and paragraph separator(\u2029). I would also habitually escape
backspace (\x08), Horizontal tab, vertical tab (\x0B), BOM (\uFEFF) and
the forward slash. Always escape the escape character first when
escaping and unescape it last when unescaping (backslash when escaping
for javascript, but whichever escape character is used in whichever
context: it is a rule and an oft forgotten one).

>>want answers, you should probably be asking clear questions.
>
> One of the problems of getting started is finding out exactly
> where to start. When I have specific questions, I will ask them. For
> now, I am trying to get the lay of the land.

No matter how bad things may look they are actually 100 times better
than they were 10 years ago, and people learnt to coped back then.

Richard.

Elegie

unread,
Nov 5, 2011, 4:58:41 AM11/5/11
to
On 05/11/2011 05:14, Richard Cornford wrote :

Hi Richard,

> For some reason the biggest "gotcha" with javascript is premature
> confidence. There seem to be recurrent manifestations of the
> Dunning-Kruger effect (if you are not familiar with than look it up as
> it is an interesting, and all too human, psychological phenomenon).

<snip>

I did not know about it, but I like it very much. I believe I have seen
this many times (including in my own behavior), and will surely reuse that.

I recently tried and used the following to express similar ideas (but I
don't know if it was well-received):

"No knowledge is innocence, a bit of knowledge is obscurantism, a lot of
knowledge is wisdom".

Innocence is a blank page on which you can write things; it is also the
state before the mind becomes corrupted.

Obscurantism happens when you refuse to learn more and believe that what
you have learnt is right. When an innocent person first learns
something, and manages to put it in practice successfully, then he/she
will gain confidence in both what they have learnt and their ability to
learn. Success is sometimes worth less that failure, in that it can
hinders further learning.

Wisdom happens when you realize that the more you learn, the less you
know. It does not mean that your actual knowledge is shrinking (quite
the contrary), but rather that your horizon is expanding faster than you
learn. True wisdom is not about knowledge, but about attitude.

> Recently I had to write a technical test for some JS programmer
> interview. I tried to include every common misconception about
> javascript that I have noticed. These are (most of) the points I tested
> for that bset qualify as "gotchas":-

<snip>

This is an interesting idea. Experts usually judge a script by these
very criteria, so formulating a test requiring an explicit usage of them
by the candidate appears quite logical.

Regards,
Elegie.

Sean Kinsey

unread,
Nov 5, 2011, 7:07:29 AM11/5/11
to
Really? ASP? In 2011?
Abstract this, and go for ASP.NET AJAX or WCF - it will solve _all_your potential problems with escaping and so forth.
To continue; it will even provide you with ready made Javascript proxy methods so that you can call any method as if they were local (although async).

If your management object to bringing in a 'new' technology - then tell them that it will be worth it (and I do know what I'm talking about).

Seriously, if they're in SF, let me now and I'll stop by and call them stupid.

Evertjan.

unread,
Nov 5, 2011, 8:13:28 AM11/5/11
to
Sean Kinsey wrote on 05 nov 2011 in comp.lang.javascript:

> Really? ASP? In 2011?

Classic ASP is marvelous, even in 2011.

You can do Javascript serverside using the same functions you built
clientside.

This will enhance your capability just by experencing one language.

And if you like vbs, so what?


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

beegee

unread,
Nov 6, 2011, 9:59:03 AM11/6/11
to
If they're in the NYC area, I will stop by and perform the same
service. If for no other reason, think of the future maintenance on
the project. If you do manage to hire programmers who are willing to
program in VBScript at all, they will curse you every step of the way.

If your company is dedicated to MS, which it sounds they are, go with
Sean's suggestions.

If you choose to ignore this advice, I suggest a third party AJAX
library, probably YUI since it has no syntactic sugar to hide the
javascript from newbies. IE9 lets you use the native HTTPRequest
object but management of your calls is still going to be an advanced
undertaking without a library.

Bob

Richard Cornford

unread,
Nov 8, 2011, 6:33:28 AM11/8/11
to
On Nov 5, 8:58 am, Elegie wrote:
> On 05/11/2011 05:14, Richard Cornford wrote :
>> For some reason the biggest "gotcha" with javascript is premature
>> confidence. There seem to be recurrent manifestations of the
>> Dunning-Kruger effect (if you are not familiar with than look it
>> up as it is an interesting, and all too human, psychological
>> phenomenon).
>
><snip>
>
> I did not know about it, but I like it very much. I believe I have
> seen this many times (including in my own behavior), and will
> surely reuse that.
<snip>

Yes, the lesson from these psychological phenomenon is that they
follow from having psychology, so from being human. We must all suffer
from them, or at least be vulnerable to them, and the only defence is
to be aware their existence and their tendency to drive us into
fooling ourselves. And then suspect our own positions and seek more
demonstrably objective justifications for them, or be willing to
abandon them in the face of not being able to find that objectivity.

>> Recently I had to write a technical test for some JS programmer
>> interview. I tried to include every common misconception about
>> javascript that I have noticed. These are (most of) the points
>> I tested for that bset qualify as "gotchas":-

><snip>
>
> This is an interesting idea. Experts usually judge a script by these
> very criteria, so formulating a test requiring an explicit usage of them
> by the candidate appears quite logical.

In this area the test was more a matter being able to recognise (and
explain) the issues rather than actually use them. I wanted a test
that would straddle the knowledge boundary that I was interested in.
That worked in the sense that all of the candidates got most of the
questions wrong (with more than 50% getting zero). The depressing part
was that one of my colleagues noticed that I had effectively given the
answer to an HTTP question in the example mark-up for a previous XHTML
question, I decided to leave it and see what happened, and none of the
candidates spotted the connection.

Richard.

Richard Cornford

unread,
Nov 8, 2011, 6:38:38 AM11/8/11
to
Because people always react so openly to being called stupid?

Richard.

Scott Sauyet

unread,
Nov 8, 2011, 8:23:44 AM11/8/11
to
Richard Cornford wrote:
> Elegie wrote
>> Richard Cornford wrote:
>>> [... re: the Dunning-Kruger effect ...]
>> I did not know about it, but I like it very much. I believe I have
>> seen this many times (including in my own behavior), and will
>> surely reuse that.
>
> Yes, the lesson from these psychological phenomenon is that they
> follow from having psychology, so from being human. We must all suffer
> from them, or at least be vulnerable to them, and the only defence is
> to be aware their existence and their tendency to drive us into
> fooling ourselves.

Well, the lesson is not that clear. At least according to the
Wikipedia article [1], this is an American phenomenon, with a much
reduced effect for Europeans and a reversed version for Asians. I
haven't read the original paper, but the fact that it won the Ig Nobel
Prize for psychology in 2000 gives me pause about lending it too much
credence.

-- Scott

[1] http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect

Richard Cornford

unread,
Nov 8, 2011, 9:21:50 AM11/8/11
to
On Nov 8, 1:23 pm, Scott Sauyet wrote:
> Richard Cornford wrote:
>> Elegie wrote
>>> Richard Cornford wrote:
>>>> [... re: the Dunning-Kruger effect ...]
>>> I did not know about it, but I like it very much. I believe I have
>>> seen this many times (including in my own behavior), and will
>>> surely reuse that.
>
>> Yes, the lesson from these psychological phenomenon is that they
>> follow from having psychology, so from being human. We must all
>> suffer from them, or at least be vulnerable to them, and the only
>> defence is to be aware their existence and their tendency to drive
>> us into fooling ourselves.
>
> Well, the lesson is not that clear. At least according to the
> Wikipedia article [1], this is an American phenomenon, with a much
> reduced effect for Europeans and a reversed version for Asians.

Observing that there is a cultural bias in people's susceptibility to
a psychological phenomenon does not mean that any individual will
inevitably either be subject to it, or immune from it, due to their
cultural origin.

> I haven't read the original paper, but the fact that it won the
> Ig Nobel Prize for psychology in 2000 gives me pause about lending
> it too much credence.

Being awarded an Ig Nobel Prize does not, of itself, reflect on the
quality/validity of that research.

"The Ig Nobel Prizes honor achievements that first make people laugh,
and then make them think. The prizes are intended to celebrate the
unusual, honor the imaginative and spur people's interest in science,
medicine, and technology."

Richard.

Elegie

unread,
Nov 8, 2011, 1:14:26 PM11/8/11
to
On 08/11/2011 12:33, Richard Cornford wrote :

Hi,

<snip>

>> This is an interesting idea. Experts usually judge a script by these
>> very criteria, so formulating a test requiring an explicit usage of them
>> by the candidate appears quite logical.
>
> In this area the test was more a matter being able to recognise (and
> explain) the issues rather than actually use them. I wanted a test
> that would straddle the knowledge boundary that I was interested in.
> That worked in the sense that all of the candidates got most of the
> questions wrong (with more than 50% getting zero). The depressing part
> was that one of my colleagues noticed that I had effectively given the
> answer to an HTTP question in the example mark-up for a previous XHTML
> question, I decided to leave it and see what happened, and none of the
> candidates spotted the connection.

I think that you need a drink :) It's too bad we don't live in the same
country, I'd bought you one with pleasure.

<follows drink talk>

Can you imagine an accountant who takes one day to perform a closing,
and another who takes a full month for that same closing? Well, in the
IT industry, that seems to be the case. In the "Mythical Man-Month",
Fred Brooks quoted a study which demonstrated that the skill level
between two programmers could range from 1 to 10; and I was told later
that the ratio was, nowadays, probably around 20 (I've got no study to
back this, though).

Of course, this difference can be attributed to other factors than
skill, such as creativity. Yet, this indicates that the industry is
still young, that methods are not well known (or even not well thought),
and that programmers are most often left on discovering good practices
rather learning them.

Consequences of this are dangerous: programmers not only are slow to
improve, but also believe "at all cost" in the knowledge they have
gained, even if they're wrong - because there was pain in it. I
currently believe that, even more than skills, it is attitude which
should matter: strong analytical skills, intellectual honesty,
curiosity, severity, ability to listen and comprehend, humility.

You know that I am no professional programmer (although I intend to
change that soon), but I do have some knowledge. However, I happened to
meet lots of professionals, and among them some "javascript experts".
Well, imagine how happy I was to learn that state-of-the-art javascript
now necessarily includes libraries which would use browser-detection,
favor function overloading and for..in loops as array iterators, extend
host and built-in objects (without even realizing that one should never
extend an external API) or even override their implementation, adopting
functional programming style at all cost...

To illustrate, I was recently told about that selector thing. I have not
researched it, so I may be wrong, but my initial (and so far, sole)
impression was not positive. Is the DOM API not flexible enough that it
needs further abstraction? To me, it really felt like kids having fun
building an interpreter (probably not even knowing what a token, a state
or a continuation actually are), and being forced to eventually /use/
it, well, because it'd be too bad to not use it, once it's been written.
(I'm probably unfair here.)

I see the path leading to expertise as follows:
- First, you're new to the technology, the code you write is pretty
simple. You read books and specifications, and test every bit of it
(trying obvious and not-so-obvious things). You're gradually reaching
step 2.
- You write more complicated code. You're enjoying the language, which
for javascript would translate as using loose-typing and reflective
techniques more than you should, trying to transform the language into
something you know (class-based inheritance, functional artifacts),
imagining how design patterns apply to the language. You have someone
read your code, he or she does not understand the least bit of it,
you're happy, but think you'd be happier if they had understood it.
- There comes a point when you yourself do not understand even more what
you have written. If you have some courage, you try and analyze it. Why
so complicated? Gradually, you write code which is becoming simpler and
simpler. Eventually, people reading your code will assess it as being
"clean", "obvious", "short" and "natural". You're not back to step 1,
but rather have reached elegance, i.e. you have understood the paradigm
of the language, and made it so that the language looks like it was made
for your program rather than the contrary.

Sorry for the rant! I believe that your story has reminded me of similar
events, and of the feelings I had then (feelings which I believe you
understand well).

Cheers,
Elegie.

Gene Wirchenko

unread,
Nov 8, 2011, 5:49:40 PM11/8/11
to
On Tue, 8 Nov 2011 06:21:50 -0800 (PST), Richard Cornford
<Ric...@litotes.demon.co.uk> wrote:

[snip]

>Being awarded an Ig Nobel Prize does not, of itself, reflect on the
>quality/validity of that research.
>
>"The Ig Nobel Prizes honor achievements that first make people laugh,
>and then make them think. The prizes are intended to celebrate the
>unusual, honor the imaginative and spur people's interest in science,
>medicine, and technology."

I have found the paper to have wonderful predictive value. It
explains a lot of behaviour that I have run into.

Sincerely,

Gene Wirchenko

Gene Wirchenko

unread,
Nov 8, 2011, 5:52:47 PM11/8/11
to
On Sat, 5 Nov 2011 04:07:29 -0700 (PDT), Sean Kinsey
<oki...@gmail.com> wrote:

[snip]

>If your management object to bringing in a 'new' technology - then tell them
>that it will be worth it (and I do know what I'm talking about).
>
>Seriously, if they're in SF, let me now and I'll stop by and call them stupid.

They are not in SF, but even if they were, I would not tell you.
If I wanted to convince them to not go with ASP Classic, about the
last thing that I would do is call them stupid.

Sincerely,

Gene Wirchenko

Gene Wirchenko

unread,
Nov 8, 2011, 5:57:00 PM11/8/11
to
On Sun, 6 Nov 2011 06:59:03 -0800 (PST), beegee <bgu...@gmail.com>
wrote:

>On Nov 5, 6:07 am, Sean Kinsey <okin...@gmail.com> wrote:

[snip]

>> If your management object to bringing in a 'new' technology - then
>> tell them that it will be worth it (and I do know what I'm talking about).
>>
>> Seriously, if they're in SF, let me now and I'll stop by and call them stupid.
>
>If they're in the NYC area, I will stop by and perform the same
>service. If for no other reason, think of the future maintenance on
>the project. If you do manage to hire programmers who are willing to
>program in VBScript at all, they will curse you every step of the way.

Well, they are not in NYC either. The same remark applies.

We already have the programmers in-house. I will be the major
one.

>If your company is dedicated to MS, which it sounds they are, go with
>Sean's suggestions.

They are.

>If you choose to ignore this advice, I suggest a third party AJAX
>library, probably YUI since it has no syntactic sugar to hide the
>javascript from newbies. IE9 lets you use the native HTTPRequest
>object but management of your calls is still going to be an advanced
>undertaking without a library.

I have some AJAX code. It is apparently rather simple. When I
create my pages, I will see how it goes. Maybe, you will get to rip
it apart. I think I will post it for critique. Not that I will
necessarily change it after, but I am interested in what others think.

Sincerely,

Gene Wirchenko

Scott Sauyet

unread,
Nov 9, 2011, 8:10:17 AM11/9/11
to
Richard Cornford wrote:
> On Nov 8, 1:23 pm, Scott Sauyet wrote:
>> Richard Cornford wrote:
>>> Elegie wrote
>>>> Richard Cornford wrote:
>>>>> [... re: the Dunning-Kruger effect ...]
>>>> I did not know about it, but I like it very much. I believe I have
>>>> seen this many times (including in my own behavior), and will
>>>> surely reuse that.
>
>>> Yes, the lesson from these psychological phenomenon is that they
>>> follow from having psychology, so from being human. We must all
>>> suffer from them, or at least be vulnerable to them, and the only
>>> defence is to be aware their existence and their tendency to drive
>>> us into fooling ourselves.
>
>> Well, the lesson is not that clear.  At least according to the
>> Wikipedia article [1], this is an American phenomenon, with a much
>> reduced effect for Europeans and a reversed version for Asians.
>
> Observing that there is a cultural bias in people's susceptibility to
> a psychological phenomenon does not mean that any individual will
> inevitably either be subject to it, or immune from it, due to their
> cultural origin.

I was trying to suggest that this is not a phenomenon that follows
from being human (or "from having psychology"), but might be mostly a
cultural phenomenon. I was not trying to reject your assertion that
we should be on guard against such tendencies in ourselves. An
American myself, I recognize the behavior in myself and others. I'm
just not so sure it's as universal as you seemed to imply.


>> I haven't read the original paper, but the fact that it won the
>> Ig Nobel Prize for psychology in 2000 gives me pause about lending
>> it too much credence.
>
> Being awarded an Ig Nobel Prize does not, of itself, reflect on the
> quality/validity of that research.

Of course not. But looking at the company it keeps does make me
wonder a bit. Most of the awards seem to have to do with either the
seeming triviality of the subject or with its blatant obviousness. I
was suspecting the latter for this one, but (again, according to the
Wikipedia article) perhaps even that obviousness is a cultural
artifact.

-- Scott

beegee

unread,
Nov 9, 2011, 4:04:45 PM11/9/11
to
On Nov 8, 5:57 pm, Gene Wirchenko <ge...@ocis.net> wrote:

>      Well, they are not in NYC either.  The same remark applies.
>

If you post where you work, I'm almost positive we can find someone to
call your boss stupid.


>      I have some AJAX code.  It is apparently rather simple.  When I
> create my pages, I will see how it goes.

Yes, 'apparently'. Error handling, special characters, XML parsing,
synchronization of asynchronous calls. But go ahead, reinvent the
wheel.

> Maybe, you will get to rip
> it apart.

And maybe you will have a sense of humor by then but probably not.

Good luck,

Bob

0 new messages