...

View Full Version : Why do people use javascript frameworks?



NickyYo
08-29-2011, 02:19 PM
My question is why do people use JQUERY etc for everything?

Everyone at my uni uses this JQUERY, i choose not to and code everything in just javascript; my goal is to learn to code great a new ****.

Am i wrong or right? is this the right approach to take if i want to learn javascript?

Are JQUERY users wannabee coders? or do professionals use it to develop too?

Rowsdower!
08-29-2011, 02:40 PM
jQuery enjoys extremely wide use, for better or for worse. You almost can't escape it. The benefit to using a framework rather than strictly "home-grown" javascript is that coding is faster and easier and, in the case of jQuery, it's pretty well tested and likely to work in every major browser. It is also more portable since it is written to a standar. It's basically worry-free.

That said, it comes with overhead (bandwidth, page load time, what have you). I have seen people load up the jQuery framework for something as simple as an alert. I wanted to slap someone when I saw that. People use it as a crutch, sure. And we have all seen that.

But to a larger and more significant degree it is used well and saves a lot of people - professional and otherwise - a lot of time and grief. I think learning both methods is important. I think learning to code "vanilla" first is best since you can then get a better understanding of what code does and how the DOM reacts...and why. People who never venture outside of their frameworks will generally not understand any of that and it tends to limit their coding ability. Once you understand the beast then use a framework where it makes sense to do so. And write your own extensions for it, too!

That's my official opinion on it, at least.

VIPStephan
08-29-2011, 05:53 PM
Basic JavaScript can become really repetetive when you do a lot of DOM manipulation. That’s why some smart people wrote a few functions to make it easier and quicker to execute similar functions over and over again. For example, rather than perpetually writing


document.getElementById('example')…
document.getElementById('whatever')…
document.getElementById('another_element')…

You can write a function that’s shorter, like (simplified for demonstration):


function getEl(element_id) {
document.getElementById(element_id')…
}

and then just call


getEl('example')…
getEl('whatever')…
getEl('another_element')…

So, there you have your very very basic framework yourself. That’s how jQuery came to be. The drawback of making it so easy to use is – as with everything – that every idiot tends to use it now without knowing why and what they are doing. So you’re still way ahead of the crowd if you still know raw JavaScript.

rnd me
08-29-2011, 07:57 PM
there are no wrong or rights in programming, that like asking if a truck is better than a car...

there's a perception that jQuery makes development faster and easier. If that's true or not depends on the coder's skill/knowledge, the target device range, and the project requirements.

can it be mis-used? sure, it's definitely over-used, no question about it. But that doesn't mean that every use is superfluous. In particular, supporting 3+ year old browsers is a lot easier with jQuery than raw js.

With modern devices, document.querySelectorAll (IE8+) provides THE killer feature of jQuery: css selectors for dom elements. Turning that collection into an array allows "Array 1.6" methods like forEach, filter, and reduce to be chained together, much like jQuery. In short, browsers have actually responded to back pressure produced by jQuery...

Few devs seem to trust that anyone has anything other than a 5 year old system with IE7 running on it. Look at the sheer volume of dogma about "progressive enhancement", aka apologetic programming. there's a perception that the 10% of folks who get left behind are more important than the 90% who have up-to-date configurations.

in terms of learning, learn CS, then JS, then jQuery. if you do it backwards you'll be a bad programmer for a lot longer while you slowly unravel what's really going on. If you understand the foundational basics, it's easier to at least imagine how different jQuery chunks are implemented. If you understand that, you'll be in a strong posistion to deliver the optimal solution, jQuery or otherwise; you can DIY if you know JS.

VIPStephan
08-29-2011, 09:37 PM
Look at the sheer volume of dogma about "progressive enhancement", aka apologetic programming. there's a perception that the 10% of folks who get left behind are more important than the 90% who have up-to-date configurations.

Youíre seeing this from the wrong perspective. I see progressive enhancement actually as a part of semantic web development. Everything on a website has a meaning. If it doesnít itís useless and shouldnít be there in the first place. And if something meaningful is missing in the HTML (because itís only added dynamically) then the content makes no sense either, in the worst case.

This is not just about outdated browsers or users with JS disabled, this is simply part of the semantic web. A web that is accessible and machine readable to facilitate the holistic user experience.

DaveyErwin
08-30-2011, 12:04 AM
Has anyone mentioned the real value
of frameworks is easier collaboration
between somewhat isolated programmers ?

M.Jackson
08-30-2011, 12:22 AM
Everything on a website has a meaning. If it doesnít itís useless and shouldnít be there in the first place. And if something meaningful is missing in the HTML (because itís only added dynamically) then the content makes no sense either, in the worst case.

I agree with you for the most part. The point that I would differ on is the word 'meaning.' Does an advertisement have a meaning? Not without stretching the bounds of the meaning of 'meaning.' It has an intention.

A great deal of the web lacks coherent intention. Take any main-stream business' website as an example. The first thing you notice is most likely a banner that takes up the top third of the screen that shows off some basically useless graphic that either has no information at all or has information that you already knew about before you navigated there, like their name.

Programming is not immune to this uselessness. A framework abbreviates development time by providing many lines of code that do not have to be written but may not add anything relevant to the end product.

VIPStephan
08-30-2011, 12:35 AM
Does an advertisement have a meaning?

By ďeverything has a meaningĒ I mean in the documentís mark-up everything thatís there should have a meaning, a reason to be there: An empty div bears no meaning (content/mark-up wise), hence it shouldnít be there in the first place. A ďprint pageĒ link has no meaning by itself because without JS you canít print a page by clicking on that link. So, since it only works with JS anyway, you can as well add it with JS dynamically.

Likewise, if you add some content with JS that could be relevant for the understanding (or if an actual link to a physical file with that information is missing) that means itís missing in the documentís body as hard coded HTML/content which renders it inaccessible for devices and some people.
But that goes beyond the scope of this thread. I just wanted to clarify. Letís not get too much off-topic. jQuery is useful if used properly.

NickyYo
08-30-2011, 05:29 PM
Also another point i would like add to this thread is; do people realy find satisfaction from using JQUERY in web development?

I for one find it more satisfying and rewarding to hardcode the site in javascript rather than just using the JQUERY library.

For example, making your own library and using it in your own websites; this is so much more satisfying for me anyways.

I'm new to javascript, spent yesterday coding my own library to call PHP functions and return the values to a speicifed div from one simple function. So much more satisfying than just using the JQUERY stuff.

If i do it this way am i being ignorant? and would it make me incapable of reading other peoples code?

VIPStephan
08-30-2011, 05:32 PM
Yeah, if you’ve got the time to reinvent the wheel that may be fine. But in a professional environment using a library just takes less time to perform a task or complete the project and this is what matters most there.

rnd me
08-30-2011, 09:59 PM
Also another point i would like add to this thread is; do people realy find satisfaction from using JQUERY in web development?

I for one find it more satisfying and rewarding to hardcode the site in javascript rather than just using the JQUERY library.

For example, making your own library and using it in your own websites; this is so much more satisfying for me anyways.

I'm new to javascript, spent yesterday coding my own library to call PHP functions and return the values to a speicifed div from one simple function. So much more satisfying than just using the JQUERY stuff.

If i do it this way am i being ignorant? and would it make me incapable of reading other peoples code?


DIY is the best way to learn, but can take longer to implement far and wide on public sites. for personal, internet, or other controlled environments, modern browsers are powerful and standardized enough that simply setting your bar as any browser within the last year as a pre-req, you can make RAD apps without frameworks. it's not like you can't write jquery if you know js, but try taking jquery away from a script kiddie and see how far how quick he gets... furthermore, jquery is not compatible with a lof of javascript enviroments, so if that's the only way you know to map a function against an array, you're gonna be screwed when you work in your first non-browser js environment. these are increasingly common; node.js, win8, raw V8, jsc, .net, etc. so, if all you do is browser work, jquery might help you spruce up an existing site with less effort, but it won't help you get a new site of the ground.





Likewise, if you add some content with JS that could be relevant for the understanding (or if an actual link to a physical file with that information is missing) that means it’s missing in the document’s body as hard coded HTML/content which renders it inaccessible for devices and some people.

sorry top continue off-topic, but no it doesn't.
AT (screen readers) uses the dom, so injected content is seen just like hard-coded content. maximum interactive accessibility actual REQUIRES javascript not prohibits it. very few devices (and fewer every day) that people want to use don't run js. while i agree wholeheartedly in the spirit of compatibility and accessibility, the whole static html take is outmoded. APIs provide better access to meaningful content and descriptive meta than html syntax ever will, so the need is far less. RSS is darn accessible on lots and lots of devices; my phone shows them in a widget...

The html4 way of doing lifeless documents has begun to run thin, while web apps are just beginning to become expected by the masses. if you want to make online brochures, go for it, but don't expect to wow anyone these days by doing so.

VIPStephan
08-30-2011, 10:49 PM
The html4 way of doing lifeless documents has begun to run thin, while web apps are just beginning to become expected by the masses. if you want to make online brochures, go for it, but don't expect to wow anyone these days by doing so.

You seem to ignore that not every website is a “web app” and never will there be a need to display all plain information (and that’s what it’s eventually all about) in a super flashy interactive way. And why does one have to “wow” anyone with everything? I’m not using Google docs for the “wow” effect but because it’s practical (hypothetically spoken – I’m not actually using Google docs). Apart from all the “cool” effects like dragging and dropping, swiping, rotating, and instantly updating content the plain information is still marked up as good ol’ HTML (or XML) and will most likely be for years to come. Even Facebook and the like could easily work without JavaScript (and without losing any of its basic abilities – displaying and updating content, that is) and still be just as usable (not that I care about Facebook, just saying it could).

So, let’s not forget what the web is and will likely be for the next few years: an ever growing collection of information, be it editable on the client side or not. And information is marked up as HTML. If every program is theoretically able to parse JS then why would there be any need to write plain HTML anyway? Why not do everything with JS? Why have separation of presentation and content (http://en.wikipedia.org/wiki/Separation_of_presentation_and_content) and behavioral separation (http://www.alistapart.com/articles/behavioralseparation) been invented? Or are these all outdated principles now since we’re able to update content asynchronously?

harbingerOTV
08-30-2011, 11:18 PM
Has anyone mentioned the real value
of frameworks is easier collaboration
between somewhat isolated programmers ?

I think this is a very good point. I work in an environment with developers from (that I know of) six states and five countries. Using a common framework makes it a whole lot easier to pick up code written by someone else later. A lot of the time, by the time another dev touches the code, the original writer has moved on from the company entirely.


For example, making your own library and using it in your own websites; this is so much more satisfying for me anyways.

True, making your own projects from scratch does leave a little more "ahhh" factor most of the time. But, when you are working on a team and on a site that has thousands of pages with literally millions of views a month, the feasibility of rolling your own is small.


do people realy find satisfaction from using JQUERY in web development?

I think your looking at it the wrong way. I don't get satisfaction in using a particular js framework or for that matter a PHP framework. What you should get satisfaction in is the final product whether you used a framework or not. If you are learning along the way is more important. Even after you master JavaScript and you then master a framework, there will hopefully still be challenges to learn from.

oracleguy
08-31-2011, 12:00 AM
True, making your own projects from scratch does leave a little more "ahhh" factor most of the time. But, when you are working on a team and on a site that has thousands of pages with literally millions of views a month, the feasibility of rolling your own is small.

Not to mention using a framework can reduce the number of bugs in your final product. If you roll your own cross browser JavaScript library you have to deal with the bugs in your library plus the code exercising it.

Not to say jQuery is bug free but the chances that a bug will be a found and fixed for you is much higher. Then all you have to do is upgrade to a newer version to fix it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum