Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Javascript library development

Reply
Thread Tools

Javascript library development

 
 
Aaron Gray
Guest
Posts: n/a
 
      07-11-2008
From what I have been looking at for Javascript library development,
browsers that support Javascript 1.5/ECMAScript 3/JScript 5.5 looks like the
base level to pitch at.

Anyone add anything ?

Aaron


 
Reply With Quote
 
 
 
 
Peter Michaux
Guest
Posts: n/a
 
      07-12-2008
On Jul 11, 8:54 am, "Aaron Gray" <(E-Mail Removed)> wrote:
> From what I have been looking at for Javascript library development,


Are you going to be writing your own library?

> browsers that support Javascript 1.5/ECMAScript 3/JScript 5.5 looks like the
> base level to pitch at.


Roughly yes. It depends on your targeted user base and the browsers
they are using. If it is for the general web vs for an intranet where
everyone is using a single browser.

> Anyone add anything ?


If you use feature detection and progressive enhancement your library
will fail gracefully in older browsers. It is a sustainable approach.
For example. navigator.userAgent should not appear in your library
code.

There is a lure that a single library can cover all possible
situations. That has never been shown to be true and if such a library
could be written it would be huge. Determining the position of an
element on the page is an example of a big problem.

Identify the requirements for you library and then either find or
write a library to suit that need.

Peter
 
Reply With Quote
 
 
 
 
Aaron Gray
Guest
Posts: n/a
 
      07-12-2008
"Peter Michaux" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Jul 11, 8:54 am, "Aaron Gray" <(E-Mail Removed)> wrote:
>> From what I have been looking at for Javascript library development,

>
> Are you going to be writing your own library?


Yes.

>> browsers that support Javascript 1.5/ECMAScript 3/JScript 5.5 looks like
>> the
>> base level to pitch at.

>
> Roughly yes. It depends on your targeted user base and the browsers
> they are using. If it is for the general web vs for an intranet where
> everyone is using a single browser.


Yes, it looks like the cutoff point.

There's the W3C DOM standard introduction and things like
document.documentElement which I have tried to address.

>> Anyone add anything ?

>
> If you use feature detection and progressive enhancement your library
> will fail gracefully in older browsers. It is a sustainable approach.
> For example. navigator.userAgent should not appear in your library
> code.


Yes, other than for error reporting

> There is a lure that a single library can cover all possible
> situations. That has never been shown to be true and if such a library
> could be written it would be huge.


Yes, I am looking at a poormans ExtJS, as ExtJS is a dual licence and is
very expensive for commercial usage. I am looking at creating a frame work
with widget structure a few basic widgets and publish it under the LGPL,
then hopefully if it is anygood others will contribute, thats the idea
anyway.

> Determining the position of an
> element on the page is an example of a big problem.


Right. I try to use events attached to elements where ever possible.

> Identify the requirements for you library and then either find or
> write a library to suit that need.


ExtJS is the only contender but as I said it is prohibitorly expensive for
small scale commercial usage.

Aaron


 
Reply With Quote
 
Peter Michaux
Guest
Posts: n/a
 
      07-12-2008
On Jul 12, 12:02 pm, "Aaron Gray" <(E-Mail Removed)> wrote:
> "Peter Michaux" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > On Jul 11, 8:54 am, "Aaron Gray" <(E-Mail Removed)> wrote:
> > > From what I have been looking at for Javascript library development,

>
> > Are you going to be writing your own library?

>
> Yes.


With all due respect, if you are new enough to browser scripting to be
asking the questions that you are, I suggest you write a few libraries
and really explore the JavaScript language and the browser runtimes
before you release a library to the world. By explore, I mean spend at
least a year reading other libraries, writing example libraries,
reading articles by programmers like Richard Cornford and Douglas
Crockford. Crockford's "JavaScript: the good parts" book is really the
only book on JavaScript that attempts to explore the lambda-nature of
JavaScript and exploit it for maximum gain. Books about Lisp and
Scheme (especially "Structure and Interpretation of Computer Programs"
by Abelson and Sussman) which are lambda languages, are generally far
higher quality than JavaScript books but the ideas translate to
JavaScript quite readily. Quality books on browser scripting are at
least hard to find.

On the web it is already possible to download JavaScript libraries for
browser scripting with APIs that were published and subsequently
"fixed" by people with little experience writing browser scripts and
who seemed to carry a lot of baggage and/or preconceived ideas about
how to program from whatever language they wrote in before they
arrived in JavaScript. (Usually they programmed in a class-based, non-
lambda language which is almost polar opposite to JavaScript.) These
efforts have resulted in libraries that don't maximize use of the
things JavaScript does well, don't fully acknowledge the realities of
the browser environment and use feature detection to deal with them,
assume they know the right way to do things and end up with an API
that is really difficult to make work with the techniques they would
choose with more experience.


> > If you use feature detection and progressive enhancement your library
> > will fail gracefully in older browsers. It is a sustainable approach.
> > For example. navigator.userAgent should not appear in your library
> > code.

>
> Yes, other than for error reporting


What kind of error reporting?


> > There is a lure that a single library can cover all possible
> > situations. That has never been shown to be true and if such a library
> > could be written it would be huge.

>
> Yes, I am looking at a poormans ExtJS, as ExtJS is a dual licence and is
> very expensive for commercial usage. I am looking at creating a frame work
> with widget structure a few basic widgets and publish it under the LGPL,
> then hopefully if it is anygood others will contribute, thats the idea
> anyway.
>
> > Determining the position of an
> > element on the page is an example of a big problem.

>
> Right. I try to use events attached to elements where ever possible.


Event target resolution is not what I was referring to in this case.
That would be a really crazy way to identify what was clicked, for
example.


> > Identify the requirements for you library and then either find or
> > write a library to suit that need.

>
> ExtJS is the only contender


Why? All the regulars on this group write browser scripts and I think
none uses ExtJS.


> but as I said it is prohibitorly expensive for
> small scale commercial usage.


If the quality of ExtJS is considered acceptable (which would likely
be highly debated on this newsgroup) then why not fork the last
version of ExtJS that was free for commercial use?

Peter
 
Reply With Quote
 
Aaron Gray
Guest
Posts: n/a
 
      07-12-2008
"Peter Michaux" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Jul 12, 12:02 pm, "Aaron Gray" <(E-Mail Removed)> wrote:
>> "Peter Michaux" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > On Jul 11, 8:54 am, "Aaron Gray" <(E-Mail Removed)> wrote:
>> > > From what I have been looking at for Javascript library development,

>>
>> > Are you going to be writing your own library?

>>
>> Yes.

>
> With all due respect, if you are new enough to browser scripting to be
> asking the questions that you are, I suggest you write a few libraries
> and really explore the JavaScript language and the browser runtimes
> before you release a library to the world. By explore, I mean spend at
> least a year reading other libraries, writing example libraries,
> reading articles by programmers like Richard Cornford and Douglas
> Crockford. Crockford's "JavaScript: the good parts" book is really the
> only book on JavaScript that attempts to explore the lambda-nature of
> JavaScript and exploit it for maximum gain. Books about Lisp and
> Scheme (especially "Structure and Interpretation of Computer Programs"
> by Abelson and Sussman) which are lambda languages, are generally far
> higher quality than JavaScript books but the ideas translate to
> JavaScript quite readily. Quality books on browser scripting are at
> least hard to find.


Try John Resig's book and site.

> On the web it is already possible to download JavaScript libraries for
> browser scripting with APIs that were published and subsequently
> "fixed" by people with little experience writing browser scripts and
> who seemed to carry a lot of baggage and/or preconceived ideas about
> how to program from whatever language they wrote in before they
> arrived in JavaScript. (Usually they programmed in a class-based, non-
> lambda language which is almost polar opposite to JavaScript.) These
> efforts have resulted in libraries that don't maximize use of the
> things JavaScript does well, don't fully acknowledge the realities of
> the browser environment and use feature detection to deal with them,
> assume they know the right way to do things and end up with an API
> that is really difficult to make work with the techniques they would
> choose with more experience.


Yep, I do agree to some degree.

>> > If you use feature detection and progressive enhancement your library
>> > will fail gracefully in older browsers. It is a sustainable approach.
>> > For example. navigator.userAgent should not appear in your library
>> > code.

>>
>> Yes, other than for error reporting

>
> What kind of error reporting?


If an error occurs in the Library then it uses AJAX to send home an error
report with as much information as it can gather, this is then entered into
a MySQL database app and a report produced and sent by email to me and maybe
me and the user of the library.

>> > There is a lure that a single library can cover all possible
>> > situations. That has never been shown to be true and if such a library
>> > could be written it would be huge.

>>
>> Yes, I am looking at a poormans ExtJS, as ExtJS is a dual licence and is
>> very expensive for commercial usage. I am looking at creating a frame
>> work
>> with widget structure a few basic widgets and publish it under the LGPL,
>> then hopefully if it is anygood others will contribute, thats the idea
>> anyway.
>>
>> > Determining the position of an
>> > element on the page is an example of a big problem.

>>
>> Right. I try to use events attached to elements where ever possible.

>
> Event target resolution is not what I was referring to in this case.
> That would be a really crazy way to identify what was clicked, for
> example.


For most click events the object that is clicked on is where the click event
is needed. Its only DnD that needs anything smarter AFAICS. Please enlighten
me to other uses if there are some
>
>> > Identify the requirements for you library and then either find or
>> > write a library to suit that need.

>>
>> ExtJS is the only contender

>
> Why? All the regulars on this group write browser scripts and I think
> none uses ExtJS.


Then where are the general UI libraries that are any good. Bespoke code is
good but it is not generally complatible with other bespoke code and making
libraries is what is interesting to me.

Laying down the right framework is crucial.

>> but as I said it is prohibitorly expensive for
>> small scale commercial usage.

>
> If the quality of ExtJS is considered acceptable (which would likely
> be highly debated on this newsgroup) then why not fork the last
> version of ExtJS that was free for commercial use?


I have looked at ExtJS's code and yes its not brilliant if you look at the
DOM generated there ar unclosed <div>'s and <ul>'s in the tree control,
unless this is due to a bug in FireBug and DebugBar.

Yahoo's UI is even less self integrated.

Where are the good libraries ? I am not into making just another wheel, I
want a good wheel.

Peter, most of the time I post to newsgroups I am just trying to get
pragmatics of an issue which UseNet is usually great for.

Basically I have been programming in Javascript on and off for over three
years now. And I want my own framework and UI library that works hopefully
on any Javascript 1.6 / ECMA3 compilant browser, hence the questions.

Regards,

Aaron


 
Reply With Quote
 
Gregor Kofler
Guest
Posts: n/a
 
      07-12-2008
Aaron Gray meinte:

>> Quality books on browser scripting are at
>> least hard to find.

>
> Try John Resig's book and site.


Er... why? Most regulars here - including Peter - have a much better
understanding of JS than the "JavaScript Ninja".

As stated: Crockford's "JS the Good Parts" is definitely worth reading.

> For most click events the object that is clicked on is where the click event
> is needed. Its only DnD that needs anything smarter AFAICS. Please enlighten
> me to other uses if there are some


Events bubble. Instead of attaching a listener to every node of my XHR
tree widget, one attached to the container of the tree does the job. The
clicked element is identified via its class name.

>>> ExtJS is the only contender

>> Why? All the regulars on this group write browser scripts and I think
>> none uses ExtJS.

>
> Then where are the general UI libraries that are any good.


Because there are no good "general UI library" - and perhaps never will
be. It's this "general" that causes so much trouble.

> Where are the good libraries ? I am not into making just another wheel, I
> want a good wheel.


Either write your own (that's the most likely suggestion you gonna get
here), or pick whatever you want and live with the shortcomings.

Gregor




--
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com ::: Bildagentur für den alpinen Raum
 
Reply With Quote
 
Aaron Gray
Guest
Posts: n/a
 
      07-13-2008
"Gregor Kofler" <(E-Mail Removed)> wrote in message
news:Jxbek.81$(E-Mail Removed)...
> Aaron Gray meinte:
>
>>> Quality books on browser scripting are at
>>> least hard to find.

>>
>> Try John Resig's book and site.

>
> Er... why? Most regulars here - including Peter - have a much better
> understanding of JS than the "JavaScript Ninja".


Right I have just looked at the contents on Amazon.

> As stated: Crockford's "JS the Good Parts" is definitely worth reading.


Right.

>> For most click events the object that is clicked on is where the click
>> event is needed. Its only DnD that needs anything smarter AFAICS. Please
>> enlighten me to other uses if there are some

>
> Events bubble. Instead of attaching a listener to every node of my XHR
> tree widget, one attached to the container of the tree does the job. The
> clicked element is identified via its class name.
>
>>>> ExtJS is the only contender
>>> Why? All the regulars on this group write browser scripts and I think
>>> none uses ExtJS.

>>
>> Then where are the general UI libraries that are any good.

>
> Because there are no good "general UI library" - and perhaps never will
> be. It's this "general" that causes so much trouble.


I agree, but am taking up the chalenge to try to make one, may probably fail
but then at least I have tried.

>> Where are the good libraries ? I am not into making just another wheel, I
>> want a good wheel.

>
> Either write your own (that's the most likely suggestion you gonna get
> here), or pick whatever you want and live with the shortcomings.


Writing my own is the best option, then atleast if I want to modify it I
know how rather than maybe using a hodgepodge of the others and ending in an
entropic state.

Aaron


 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      07-13-2008
Aaron Gray wrote:
> Peter Michaux wrote:
>> On Jul 12, 12:02 pm, Aaron Gray wrote:
>>> Peter Michaux wrote:

<snip>
>>>> Are you going to be writing your own library?
>>>
>>> Yes.

>>
>> With all due respect, if you are new enough to browser scripting
>> to be asking the questions that you are, I suggest you write a
>> few libraries and really explore the JavaScript language and the
>> browser runtimes before you release a library to the world.

<snip>
>> Books about Lisp and Scheme (especially "Structure and
>> Interpretation of Computer Programs" by Abelson and Sussman)
>> which are lambda languages, are generally far higher quality
>> than JavaScript books but the ideas translate to JavaScript
>> quite readily. Quality books on browser scripting are at
>> least hard to find.

>
> Try John Resig's book and site.


That "John Resig's book" would be "Pro JavaScript Techniques"? The book
that contains:-

"Since valid HTML is simply a subset of XML, having an efficient way to
parse and browser DOM documents is an absolutely essential for making
JavaScript development easier."

"Even if you're not completely familiar with XML, you will get great
satisfaction knowing that all HTML documents (which are, in the eyes of
the browser, XML documents) have a DOM representation that is ready to
use."

"Since the use of JavaScript in nonbrowser settings (e.g., server-side
JavaScript) is still rather experimental, the feature set of JavaScript
is still very browser-centric. Thus, the features available in
JavaScript are very closely tied to how browsers evolve and which
features they (or their users) deem as the most important."

"Additionally, an object can contain a set of properties, all of which
are simply references to other objects (such as strings, numbers,
arrays, etc.)."

"When performing string concatenation the result is always a new string
object rather than a modified version of the original string."

"The this variable will always refer to the object that the code is
currently inside of."

"In JavaScript, null, 0, '', false, and undefined are all equal (==) to
each other, since they all evaluate to false. This means that if you use
the code test == false, it will evaluate true if test is also undefined
or equal to null, which may not be what you want."

"Listing 3-12. Examples of How != and == Differ from !== and ===
// Both of these are true
null == false
0 == undefined"

"Compression should be used as the final step, just before putting your
code into production, as your code will frequently become obfuscated
beyond recognition."

"This particular naming convention arose due to the fact that words such
as class, for, float, and text are all reserved words in JavaScript."

- and many other examples of technical fallacies, misconceptions and bad
practices.

Peter's point is, in effect, that if you don't know enough about
javascript and browser scripting to recognise a bad book when you see
one then maybe you should be a bit circumspect about rushing into
designing a library and dumping it on a community who have less
understanding of what they are doing than you do.

<snip>
> Basically I have been programming in Javascript on and off for
> over three years now. And I want my own framework and UI
> library that works hopefully on any Javascript 1.6 / ECMA3
> compilant browser, hence the questions.


Well, it will make a change for IceBrowser, Konqueror and NetFront to
get a look-in.

Richard.

 
Reply With Quote
 
Aaron Gray
Guest
Posts: n/a
 
      07-13-2008
"Richard Cornford" <(E-Mail Removed)> wrote in message
news:g5bkab$roh$1$(E-Mail Removed)...
> Aaron Gray wrote:
>> Peter Michaux wrote:
>>> On Jul 12, 12:02 pm, Aaron Gray wrote:
>>>> Peter Michaux wrote:

> <snip>
>> Try John Resig's book and site.

>
> That "John Resig's book" would be "Pro JavaScript Techniques"? The book
> that contains:-
>
> "Since valid HTML is simply a subset of XML, having an efficient way to
> parse and browser DOM documents is an absolutely essential for making
> JavaScript development easier."
>
> "Even if you're not completely familiar with XML, you will get great
> satisfaction knowing that all HTML documents (which are, in the eyes of
> the browser, XML documents) have a DOM representation that is ready to
> use."
>
> "Since the use of JavaScript in nonbrowser settings (e.g., server-side
> JavaScript) is still rather experimental, the feature set of JavaScript is
> still very browser-centric. Thus, the features available in JavaScript are
> very closely tied to how browsers evolve and which features they (or their
> users) deem as the most important."
>
> "Additionally, an object can contain a set of properties, all of which are
> simply references to other objects (such as strings, numbers, arrays,
> etc.)."
>
> "When performing string concatenation the result is always a new string
> object rather than a modified version of the original string."
>
> "The this variable will always refer to the object that the code is
> currently inside of."
>
> "In JavaScript, null, 0, '', false, and undefined are all equal (==) to
> each other, since they all evaluate to false. This means that if you use
> the code test == false, it will evaluate true if test is also undefined or
> equal to null, which may not be what you want."
>
> "Listing 3-12. Examples of How != and == Differ from !== and ===
> // Both of these are true
> null == false
> 0 == undefined"
>
> "Compression should be used as the final step, just before putting your
> code into production, as your code will frequently become obfuscated
> beyond recognition."
>
> "This particular naming convention arose due to the fact that words such
> as class, for, float, and text are all reserved words in JavaScript."
>
> - and many other examples of technical fallacies, misconceptions and bad
> practices.


I thought he looked a bit young

You typed in all that ?

Have not read the book just read his web site which on the whole is pritty
good.

Yeah, you only have to look at the second hand price of the "new"ish book on
Amazon.

Oh well its probably okay for some people. I will probably still buy the
book just to see if there are some gems in it, then pass it on as a hand me
down if I don't then still want to keep it.

So its back to Douglas then, there's some goodies from him on Yahoo theatre
:-

http://developer.yahoo.com/yui/theater/

> Peter's point is, in effect, that if you don't know enough about
> javascript and browser scripting to recognise a bad book when you see one
> then maybe you should be a bit circumspect about rushing into designing a
> library and dumping it on a community who have less understanding of what
> they are doing than you do.


Javascript is a real evolving thing, I have been learning it and relearning
it looking ahead at Javascript 2.0 and getting a good overview of the lay of
the land.

> <snip>
>> Basically I have been programming in Javascript on and off for
>> over three years now. And I want my own framework and UI
>> library that works hopefully on any Javascript 1.6 / ECMA3
>> compilant browser, hence the questions.


Sorry that should be Javascript 1.5.

> Well, it will make a change for IceBrowser, Konqueror and NetFront to get
> a look-in.


I want to write the foundations to include as many browsers as possible from
a reasonable baseline, thats the plan anyway if it is possible then its
worth doing.

I am basically putting together a base level "legacy" support library, and
do a test set for it so that it can be tested on a range of browsers.

To be clever but not too clever with the level of Javascript coding is the
name of the game, some of the newer stuff is just too clever for its own
good, substituting efficiency and readability for technical prowesk.

Thanks Richard, some of those quotes were quite funny

Aaron


 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      07-13-2008
Aaron Gray wrote:
> Richard Cornford wrote:
>> Aaron Gray wrote:
>>> Peter Michaux wrote:
>>>> On Jul 12, 12:02 pm, Aaron Gray wrote:
>>>>> Peter Michaux wrote:

>> <snip>
>>> Try John Resig's book and site.

>>
>> That "John Resig's book" would be "Pro JavaScript Techniques"?
>> The book that contains:-

<snip>
>> "This particular naming convention arose due to the fact that
>> words such as class, for, float, and text are all reserved words
>> in JavaScript."
>>
>> - and many other examples of technical fallacies, misconceptions
>> and bad practices.

>
> I thought he looked a bit young


Youth would not, it itself, be a barrier to understanding javascript.
ES3 is not that complex else it would not be possible for its
specification to be just 170 odd page (with 10% of that entirely devoted
to regular expressions).

> You typed in all that ?


No, I copied it from a list I have in a document. Though I did type the
list originally so I cannot promise that it is typo free. I used them as
humorous signatures for a month or so (john Resig didn't see the joke),
but have stopped now. The fear was express that my quoting them might be
taken as an endorsement.

> Have not read the book just read his web site which on the whole
> is pritty good.


YMMV

> Yeah, you only have to look at the second hand price of the
> "new"ish book on Amazon.


Low is it?

<snip>
> I want to write the foundations to include as many browsers as
> possible from a reasonable baseline, thats the plan anyway if
> it is possible then its worth doing.


I don't think "possible" == "worth doing" holds.

> I am basically putting together a base level "legacy" support
> library, and do a test set for it so that it can be tested on
> a range of browsers.
>
> To be clever but not too clever with the level of Javascript
> coding is the name of the game, some of the newer stuff is
> just too clever for its own good, substituting efficiency
> and readability for technical prowesk.


Yes, the last couple of years have seen the arrival of "do it this way
because it is cool". Talking design to people who take that attitude is
a bit like beating your head against a wall. (What is the best part of
beating your head against a wall? - Stopping.)

> Thanks Richard, some of those quotes were quite funny


I thought so. (That or they'd make you cry.)

Richard.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript Library Development Environment tpot Javascript 9 01-16-2010 01:41 AM
TCP/IP UDP Protocol Development Library and Development Resources admin@vcomsoft.com C++ 0 04-12-2006 08:15 PM
Web Application development vs windows client development cabernet123@hotmail.com ASP .Net 0 11-17-2005 12:09 AM
development environment architecture for ASP.NET development team Akhlaq Khan ASP .Net 4 09-27-2004 01:33 PM
Re: Development best practices and knowing when to exercise control over development Kevin Spencer ASP .Net 2 08-06-2003 09:33 PM



Advertisments