Great Examples of JavaScript code

Discussion in 'Javascript' started by Jang, Jul 26, 2007.

  1. Jang

    Jang Guest

    Does anyone have an example of well written JavaScript applications
    that they know about? I would prefer the code to be readable. I
    particularly like YUI's code. Does anyone have any more applications/
    examples? Thanks .
     
    Jang, Jul 26, 2007
    #1
    1. Advertising

  2. Jang

    Matt Kruse Guest

    On Jul 26, 12:55 pm, Jang <> wrote:
    > Does anyone have an example of well written JavaScript applications
    > that they know about? I would prefer the code to be readable. I
    > particularly like YUI's code. Does anyone have any more applications/
    > examples? Thanks .


    Look at any of the big libraries - jQuery, Prototype, YUI, etc.
    What kinds of things are you trying to learn from the code/style?

    Matt Kruse
     
    Matt Kruse, Jul 26, 2007
    #2
    1. Advertising

  3. Jang

    David Mark Guest

    On Jul 26, 2:01 pm, Matt Kruse <> wrote:
    > On Jul 26, 12:55 pm, Jang <> wrote:
    >
    > > Does anyone have an example of well written JavaScript applications
    > > that they know about? I would prefer the code to be readable. I
    > > particularly like YUI's code. Does anyone have any more applications/
    > > examples? Thanks .

    >
    > Look at any of the big libraries - jQuery, Prototype, YUI, etc.
    > What kinds of things are you trying to learn from the code/style?
    >
    > Matt Kruse


    I gather the OP likes reading applications written for YUI, rather
    than the YUI code itself.

    If you want to learn to write good JavaScript applications, you need
    to learn to write good JavaScript. Using somebody else's bloated,
    browser-sniffing library is no substitute.
     
    David Mark, Jul 26, 2007
    #3
  4. Jang

    David Mark Guest

    On Jul 26, 3:19 pm, Randy Webb <> wrote:
    [snip]

    Oops. Previous response cut short by real world distraction. Now
    back to the surreal world this thread has become.

    >
    > How do you read "I particularly like YUI's code" and interpret it as "I
    > like applications written for YUI"? Sounds more like the OP is


    You are quoting out of context. The OP asked for examples of "well
    written JavaScript applications" and specifically ones that were
    "readable." YUI is not an application, not well-written and, from
    what I have seen of it, unreadable. In contrast, libraries like YUI
    claim to enable application developers to write concise, readable
    code.

    Furthermore, it is hardly a stretch to call a YUI application "YUI
    code." It is in the same vein as "MFC code." If you follow this
    link, you will see that "YUI code" is used to describe code written
    for YUI as often as it is to describe the actual library code.

    http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLD,GGLD:2005-18,GGLD:en&q="YUI code"

    Clear?
     
    David Mark, Jul 26, 2007
    #4
  5. Jang

    David Mark Guest

    On Jul 28, 4:32 am, Randy Webb <> wrote:
    > David Mark said the following on 7/26/2007 4:57 PM:
    >
    > > On Jul 26, 3:19 pm, Randy Webb <> wrote:
    > > [snip]

    >
    > > Oops. Previous response cut short by real world distraction. Now
    > > back to the surreal world this thread has become.

    >
    > I have no reason to doubt that....
    >
    > >> How do you read "I particularly like YUI's code" and interpret it as "I
    > >> like applications written for YUI"? Sounds more like the OP is

    >
    > > You are quoting out of context.

    >
    > I quoted directly what the OP wrote and what you wrote as a response to
    > that, how that it is "out of context" is elusive at best.


    You quoted one sentence out of a context that gives further indication
    of its meaning. What is elusive about that concept?

    >
    > > The OP asked for examples of "well written JavaScript applications"
    > > and specifically ones that were "readable."

    >
    > Yes, as anyone that reads the original post will be aware of.


    I assume you didn't read it or you would never have posted your
    question about my thought process.

    >
    > > YUI is not an application, not well-written and, from what I have
    > > seen of it, unreadable.

    >
    > Nobody said it was. They didn't even come close to implying it.


    But, again, if you understood the original post, you wouldn't have
    been confused about by response. The OP was clearly not talking about
    the code inside YUI as YUI is none of the things he expressed
    admiration for. Get it now?

    >
    > > In contrast, libraries like YUI claim to enable application developers
    > > to write concise, readable code.

    >
    > Most libraries make that false claim, one that I have never believed.


    Nobody sane person would believe it. That is beside the point.

    >
    > > Furthermore, it is hardly a stretch to call a YUI application "YUI
    > > code." It is in the same vein as "MFC code."

    >
    > The OP did not say "YUI Code", the OP wrote "YUI's code" and YUI's is
    > possessive and implies the code in YUI itself, not code written to work
    > with YUI. And hence my question as to how you got from one to the other.


    This isn't a forum for inquiries about my thought process. The OP got
    his answers and is apparently not in need of further assistance.

    Don't you have a FAQ to work on?
     
    David Mark, Jul 28, 2007
    #5
  6. On Jul 26, 10:55 am, Jang <> wrote:
    > Does anyone have an example of well written JavaScript applications
    > that they know about? I would prefer the code to be readable. I
    > particularly like YUI's code. Does anyone have any more applications/
    > examples? Thanks .


    Hi Jang,

    If you are interested in OOP application design, I recommend reading
    books on design patterns.

    The classic book is "Design Patterns" by Gamma, Helm, Johnson,
    Vlissides and this is a book worth having on your desk.

    Before I studied that book I read "Head First Design Patterns" by
    Freeman, Freeman, Bates, Sierra which is really just a reformatting
    and possibly more accessible version of the Gamma et al. book.

    A more direct answer to your question may be to read the Model-View-
    Controller chapter of "Essential ActionScript 2.0" by Moock.
    ActionScript is only a small step away from JavaScript and they are
    both ECMAScript implementations (each with some extensions). I think
    Moock's chapter on MVC is the best description I've read about using
    MVC in the browser. There is now a new edition of Moock's book called
    "Essential ActionScript 3.0" which I haven't seen yet. I've done quite
    a bit of experimentation with Moock's framework in JavaScript and it
    works well. If you want more info about my experimentations let me
    know.

    Peter
     
    Peter Michaux, Jul 29, 2007
    #6
  7. On Jul 26, 1:57 pm, David Mark <> wrote:
    > YUI is not an application,


    Agreed

    > not well-written


    What have you seen that you don't like?

    > and, from
    > what I have seen of it, unreadable.


    It takes some time but I think it is pretty readable. The fact that
    the API is quite well documented at least gives the reader the sense
    of how the pieces fit together before analyzing the details.

    Peter
     
    Peter Michaux, Jul 29, 2007
    #7
  8. Jang

    David Mark Guest

    On Jul 29, 3:25 pm, Peter Michaux <> wrote:
    > On Jul 26, 1:57 pm, David Mark <> wrote:
    >
    > > YUI is not an application,

    >
    > Agreed
    >
    > > not well-written

    >
    > What have you seen that you don't like?


    Browser sniffing for one. And I recall that it is the most bloated JS
    library out there. I have a lot of experience writing cross-browser
    widgets and I don't see why that library has to be so heavy.

    >
    > > and, from
    > > what I have seen of it, unreadable.

    >
    > It takes some time but I think it is pretty readable. The fact that
    > the API is quite well documented at least gives the reader the sense
    > of how the pieces fit together before analyzing the details.


    I haven't read the documentation, but I spent some time looking at its
    code. As I recall, it seemed needlessly complex. I have seen a lot
    of YUI apps that cause errors, but I don't know who was to blame for
    those. Perhaps the authors didn't read the documentation either.
     
    David Mark, Jul 29, 2007
    #8
  9. Jang

    Andreas M. Guest

    Andreas M., Oct 14, 2007
    #9
  10. On Oct 14, 3:26 pm, "Andreas M." <> wrote:
    > Also make sure to read these:
    >
    > http://javascript.crockford.com/
    >
    > He (Douglas Crockford) is one of the main architects behind YUI!.


    I know he works at Yahoo! but is he intimately involved in the design
    of YUI? I have not seen any evidence that is true. For example, The
    YUI style of JavaScript OOP does not seem inline with the types of
    JavaScript OOP Crockford promotes.

    Peter
     
    Peter Michaux, Oct 15, 2007
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Python Baby
    Replies:
    4
    Views:
    460
    Lothar Scholz
    Feb 16, 2004
  2. am_y
    Replies:
    0
    Views:
    926
  3. Diomidis Spinellis

    Code quality and examples from open source C code

    Diomidis Spinellis, Apr 11, 2006, in forum: C Programming
    Replies:
    10
    Views:
    651
    Richard Heathfield
    Apr 13, 2006
  4. Eric I.
    Replies:
    0
    Views:
    274
    Eric I.
    Oct 5, 2008
  5. Diomidis Spinellis

    Code Quality and examples from the Perl source code

    Diomidis Spinellis, Apr 11, 2006, in forum: Perl Misc
    Replies:
    0
    Views:
    167
    Diomidis Spinellis
    Apr 11, 2006
Loading...

Share This Page