File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes When to use Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "When to use "bare bones" JavaScript or framewwork that hides JavaScript" Watch "When to use "bare bones" JavaScript or framewwork that hides JavaScript" New topic
Author

When to use "bare bones" JavaScript or framewwork that hides JavaScript

Lanny Gilbert
Ranch Hand

Joined: Jun 11, 2002
Posts: 103
I've only dabbled a bit in JavaScript and it seems there are frameworks coming from everywhere (most having to do with AJAX) that hide the JavaScript details from developers. Given that, why would one want to trouble oneself to learn the gritty details of JavaScript when you can use a framework to hide all that stuff?? It probably has to do with degree of control, but thought I'd post to the experts!
Mario Minutolo
Greenhorn

Joined: Aug 06, 2008
Posts: 23
Originally posted by Lanny Gilbert:
[...]
why would one want to trouble oneself to learn the gritty details of JavaScript when you can use a framework to hide all that stuff?? [...]


I use solid javascript frameworks whenever I can. There are a few around, just check they are being still developed, and have a solid userbase.

The trouble is that no frameworks does all, and even if it does... it not just exactly what you need.

So sometimes you need to use 2 frameworks or 2 libraries, or just do a bit of coding yourself.

When you do so, you need to code quite a bit to merge different libaries or to use a certain framework in a situation which is not quite the one on the demo page.

For what I'm concerned I like YUI, which is agnostic, so you can adapt it easyly.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61233
    
  66

You seem to think that all frameworks "hide" JavaScript. Not so. Some are more intrusive than others. One of the things I'm really liking about jQuery is exactly that it doesn't hide JavaScript, or try to make Javascript look like another language, or require you to use it for everything.

jQuery let's JavaScript be JavaScript -- with emphasis on its use as a functional language -- and doesn't get in your way when you don't need it to be.

If you've followed my posts here on the Ranch at all, you'll have noted that I'm not a fan of the big "boxing" server-side frameworks.

A library/framework should help you get your job done, not box you into its own little corner.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mario Minutolo
Greenhorn

Joined: Aug 06, 2008
Posts: 23
Originally posted by Bear Bibeault:
You seem to think that all frameworks "hide" JavaScript. Not so. Some are more intrusive than others.


I don't think most of the library/frameworks hide javascript, but they do hide the 'grisly details', the worst of which are ... browser compatibility.

It's not so difficult to implement something in javascript for Firefox 2 for example, but if it must work for IE6, IE7, Firefox 1,2,3 and maybe Opera ... then you are in for a lot of pain.

Both for javascript and CSS. YUI , jQuery and others, at least secure you against most of the pitfall of browser compatibility.

YUI and jQuery don't hide the javscript, but at lest they try to hide the browser.
[ August 26, 2008: Message edited by: Mario Minutolo ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61233
    
  66

Originally posted by Mario Minutolo:
... but they do hide the 'grisly details', the worst of which are ... browser compatibility.
Indeed! And when you throw Ajax into the mix, well...

The experienced web developers who post here (myself, Eric, Gregg and others) all agree that writing raw JavaScript without the aid of a library that hides browser differences is madness.

It comes down to which to use... a light-weight, well-behaved on-page citizen like jQuery, or a hyper-invasive library such as Prototype. The choice comes down to an engineering decision on the part of the page authors.
Mario Minutolo
Greenhorn

Joined: Aug 06, 2008
Posts: 23
Originally posted by Bear Bibeault:

It comes down to which to use... a light-weight, well-behaved on-page citizen like jQuery, or a hyper-invasive library such as Prototype. The choice comes down to an engineering decision on the part of the page authors.


As I said before, what I like best is YUI, because it's quite simple and (as you said) lightweight, and it takles with CSS too.

jQuery is becoming a sort of standard, being JBoss javascript library of choice... and then you have the google APIs.

I would not get stuck with javascript 'framework' bigger then those cited before, because you will quite often have to merge different libraries and use javascript apis by various vendors.

Libraries which redefine 'objects' or relies too heavily on events, tends to become a square peg on a round hole, when mixed with other libraries/APIs.
Stoyan Stefanov
author
Ranch Hand

Joined: Jul 16, 2008
Posts: 61
Totally agree with Bear and Mario, just to add one more thing: transferable skills. You may be the greatest Prototype expert and then you move to a project that uses jQuery exclusively. Oops. All of a sudden you don't know what's going on.

Knowing JavaScript helps you understand what a library is doing for you and you're in position to switch to a new library much faster.

Every time I have a choice, I'll choose to gain expertise in something that has a greater chance of being transferable.

--
edit by stoyan: typos
[ August 28, 2008: Message edited by: Stoyan Stefanov ]

<a href="http://www.thinkinginjavascript.com" target="_blank" rel="nofollow">my OOJS book</a>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61233
    
  66

This ties in to another post where the question "Do we really need to know Javascript when we can just use libraries?" was asked.

Stoyan's post is another excellent answer to that question.
 
wood burning stoves
 
subject: When to use "bare bones" JavaScript or framewwork that hides JavaScript