Great Examples of JavaScript code

J

Jang

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

Matt Kruse

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
 
D

David Mark

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

David Mark

[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?
 
D

David Mark

David Mark said the following on 7/26/2007 4:57 PM:
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....
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?
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.
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?
Most libraries make that false claim, one that I have never believed.

Nobody sane person would believe it. That is beside the point.
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?
 
P

Peter Michaux

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
 
P

Peter Michaux

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
 
D

David Mark

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

Peter Michaux

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top