Getting Starting in JavaScript et al

Discussion in 'Javascript' started by Gene Wirchenko, Nov 4, 2011.

  1. 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


    Gene Wirchenko
    Gene Wirchenko, Nov 4, 2011
    1. Advertisements

  2. Gene Wirchenko

    BOOK-AZ Guest

    BOOK-AZ, Nov 4, 2011
    1. Advertisements

  3. Gene Wirchenko

    Erwin Moller Guest

    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.)
    In my experience it is easier to find poor scripts on the web than good
    And it is hard for newcomers to tell them apart. :-(

    Do you have an example of that?
    I am not sure I can follow.
    Are you talking about escaping characters like ' " \?
    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.

    Yes. Too many to sum up here.
    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.

    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.

    Good luck.
    Erwin Moller
    Erwin Moller, Nov 4, 2011
  4. That is what has been selected.
    Your impression is correct.
    It will be JavaScript on the client side and VBScript on the
    server side.
    I have been considering that.
    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.
    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.
    That was one.
    I plan to. This is an internal app though.
    Can you give me some specifics? Even a checklist of "Not that,
    you fool!" would help.
    That is the one I am not sure about. I will have to hunt down
    some reviews. The FAQ has little.
    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
    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.
    Standard, good USENET advice.

    Thank you for your post.


    Gene Wirchenko
    Gene Wirchenko, Nov 4, 2011
  5. 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?
    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.
    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.


    Gene Wirchenko
    Gene Wirchenko, Nov 4, 2011
  6. You are just asking for it:


    Thomas 'PointedEars' Lahn, Nov 4, 2011
  7. 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?


    Gene Wirchenko
    Gene Wirchenko, Nov 4, 2011
  8. *PLONK*
    Thomas 'PointedEars' Lahn, Nov 4, 2011
  9. Gene Wirchenko

    Elegie Guest

    On 04/11/2011 04:41, Gene Wirchenko wrote :

    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).
    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).

    Elegie, Nov 4, 2011
  10. Gene Wirchenko

    Clot Hears Guest

    It *is* the latter. But don't worry, he says that to *all* the girls.
    Clot Hears, Nov 4, 2011
  11. Gene Wirchenko

    Elegie Guest

    On 05/11/2011 05:14, Richard Cornford wrote :

    Hi Richard,

    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.

    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.

    Elegie, Nov 5, 2011
  12. Gene Wirchenko

    Sean Kinsey Guest

    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.
    Sean Kinsey, Nov 5, 2011
  13. Gene Wirchenko

    Evertjan. Guest

    Sean Kinsey wrote on 05 nov 2011 in comp.lang.javascript:
    Classic ASP is marvelous, even in 2011.

    You can do Javascript serverside using the same functions you built

    This will enhance your capability just by experencing one language.

    And if you like vbs, so what?
    Evertjan., Nov 5, 2011
  14. Gene Wirchenko

    beegee Guest

    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.

    beegee, Nov 6, 2011
  15. <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.
    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 Cornford, Nov 8, 2011
  16. Because people always react so openly to being called stupid?

    Richard Cornford, Nov 8, 2011
  17. Gene Wirchenko

    Scott Sauyet Guest

    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

    -- Scott

    Scott Sauyet, Nov 8, 2011
  18. 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.
    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 Cornford, Nov 8, 2011
  19. Gene Wirchenko

    Elegie Guest

    On 08/11/2011 12:33, Richard Cornford wrote :


    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 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).

    Elegie, Nov 8, 2011
  20. On Tue, 8 Nov 2011 06:21:50 -0800 (PST), Richard Cornford

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


    Gene Wirchenko
    Gene Wirchenko, Nov 8, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.