Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm a ruby on rails developer who only recently started to learn javascript technologies (Angular and React) other than jquery. I read several of those comparison posts to understand why people use different javascript frameworks and libraries, but I still have a difficult time figuring out their significance (quite possibly due to my lack of understanding of how exactly the web works?). One thing I found out while using Angular and React was that I do not need to do deal with ajax separately like I used to with jquery. Also, I do seem to appreciate the syntax and components of React.
Anyways, please help me understand why I should use Angular or React as opposed to just jQuery. Are there things I can do with one but not with another? Are some faster than others? Is it just a matter of style and preference?
Anyways, please help me understand why I should use Angular or React as opposed to just jQuery.
You don't need any of them. Why learn the latest framework? It will only be obsolete in a few years anyways. Just learn how to leverage modern web technologies such as shadow DOM and HTML includes.
On the other hand if rapid prototyping is what you want use a framework. just know that one day something will break and you will will need to explore the black labyrinth that is the undocumented code of your chosen framework just to find out after days of searching and frustration that is was a simple logic error in your code that would have never happened had you fully understood the function and internal workings of said framework and as no documentation has ever been more than at best 10% complete you will continue this cycle perpetually until you stop using frameworks. This is just the price you pay for more rapid development.
The power of frameworks is also their greatest weakness. We love frameworks like angular because they give us structure and power by abstracting away complexities and allowing us to write less code. By that same token the abstraction layers breed ignorance and laziness as our code base grows and we become more entrenched in our chosen framework.
The best option in my opinion is to learn as much as you can obviously so you will be prepared when a new project lands in your lap that is written in a framework like angular or react but if given a choice the logical decision is the focus on just writing lightweight reusable javascript components without any library, framework, or anything else between you and the DOM.
But you may argue, "won't that just result in you eventually writing your own framework anyway? I don't want to reinvent the wheel!" Even if that is true (and I'm not saying it is, at least YOU will have a full understanding of the capabilities and limits of the framework and its internal mechanics. But most likely if you write intelligent reusable code leveraging modern web technologies you will not need a framework nor will you write one.
If you chose a framework my advice would be to learn as much about it as you can from both the provided documentation and stack overflow. The truth is that to commit a project to using a framework you should know that framework well enough that you could get along without it if you needed to. If and when you are willing to commit I say go for it!
I think you should check ember-cli as its developers are more ROR, http://discuss.emberjs.com/ is built with ROR + Ember-CLI and you can get its whole source code on https://github.com/discourse/discourse
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
For a new page I'm working on, I want to make sure I do everything “right” to the best of my ability. I was wondering what the best practices were re. one JS file per page or one file containing everything. I found this question which helped some, but raised more questions.
I pretty much only use JS for three things:
transitioning things on button clicks (showing/hiding panels, etc.),
pre-validating forms, and
AJAX calls.
When I compare my use cases to the namespacing approach, it seems like overkill; I don't really understand why I would need to set up such a complex framework to work with JavaScript. This leaves me with two questions:
For what I'm doing, should I use one JS file per page, or use Irish's namespace technique and a single script import?
What the hell are people using JS for that requires so much structure?
If your pages don't have anything in common, you might use a script file for each page. If you've got a lot of logic common between your pages, you'd probably want to put those common bits into a file of its own and include it wherever you need it.
As for why so much structure is necessary, people are making more and more complex things with JavaScript. Consider Gmail, for example. I'd imagine there's quite a bit of code in there, and without much structure, it would become difficult to maintain quickly.
OK, That page is from 2009 - The way Javascript is used on the web has changed a lot since then.
Now that most web pages contain multiple third-party Javascript files from different sources (and different developers). It makes a lot of sense to encapsulate your code in a custom namespace to prevent your code being overridden by other code using the same variable names, and it isn't any harder than:
Mynamespace= {};
Mynamespace.foo = "bar";
Mynamespace.foobar = function(){
//function body
};
Writing structured Javascript isn't about adding complexity. Writing structured Javascript allows you to encapsulate behaviours and responsibilities into re-useable portions of code that are much easier to test, maintain, re-use and extend.
You don't even need to make the single-file/multiple files judgement. You can use a framework like require.js that compiles all of your separate code files into one single file for deployment.
JavaScript is now officially a first-class language in Visual Studio Its being used to write web-servers, templating systems and even 3d engines.
Welcome to 2013 ;-)
_Pez
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a plain javascript code that does not rely on external library. But given the popularity of jQuery and the fact that jQuery has become a de facto standard, I am wondering if it makes sense to rewrite the whole code for the sake of maintenance and extension in the future. Does it make sense to do so even if there is no particular problem with my plain javascript code at the moment?
Depends on the size of the codebase. If it's a very large job then 'if it ain't broke, don't fix it' applies. If it's quite small then it may help keep things more consistent.
There's no harm in itself however in mixing jquery and standard javascript, so anything new can be just written using jquery.
I would do it only if i can take advantage of jQuery to make my code smaller and easier to maintain.
jQuery is simply functions written in vanilla JavaScript so we don't have to write them ourselves.
I don't think there is an easy answer for this one.
My thoughts: It depends. Jquery may help you develop new functionality more rapidly so maybe it would be good to use for future functions. If your application is big it may cause instability if you rewrite large parts of it at one time. Maybe you find some parts that would especially benefit from being written in jquery and refactor these pieces one by one over time? Since javascript is the foundation of Jquery javascript will be there even if Jquery goes out of fashion so it can't be that bad to keep. Your main focus should be with the users; To keep them interested in you application and deliver new features that will keep them using your application. Very few users will care or even notice if you introduce a new library or not, but if your application breaks they will know. (It may however be very satisfying to introduce a library into your application that makes the code look good and easier to maintain).
Sidenote: These days I wonder if anyone knows what language / library they will be useing next year?
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am just curious. There are many ready-to-use AJAX libraries out there like Mootools, Scriptaculuos, Prototype, YUI etc
My question is, is it possible to combine them? If I download all the code and put them on the same page, will it cause errors?
Which open source AJAX library would you recommend for a beginner?
If you're using Java on the back end, the ZK framework claims to provide full AJAX capabilities, i.e. no need to mix and match a bunch of different libraries. From the testing I've done so far, they seem to be right.
Of course, but like anytime you combine frameworks, you'll find you sometimes have to write your own glue code. For a beginner, it may be simpler to use just one.
It depends on the choice of frameworks you use. If they try to define the same variables then one is going to overwrite parts of the other. jQuery avoids this by defining the aliasing the core function so it has two names and YUI avoids it by not having a blasted dollar function in the first place.
Libraries tend to be relatively large, so you should probably avoid using multiple ones on grounds of bloat rather then anything else.
It is rare that using two different libraries is useful - the main reason for it is wanting to use multiple third party modules that depend on different libraries. In that circumstance, I would try to find alternatives that use the chosen library.
What opensource ajax code you using?
YUI usually. It is robust, well tested, well documented and powerful - although the initial part of learning curve is a little steeper then some of the others.
It does it a disservice to call it "ajax code" though - Ajax is a very small part of any of these libraries.
What would you recommend to ajax
beginner?
YUI.
What ajax features that can impress people?
That depends on who the people are. A lot of people will be impressed by being able to quickly produce slidey, fading, spinning animation effects ... but they aren't all that useful. A good event handling system doesn't do anything that will impress a lay person, but it will make like a lot easier for the programmer.
I recommend you to use the jQuery framework, because in my opinion has one of the best and easiest to understand implementation of AJAX.
An example:
jQuery.post('thescript.php', parametersInJson, function(response){
alert('The server response: '+response);
});
yes you can but you might run into some trouble (you might need to override the $ function...)
and i do recommend jQuery
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm currently using the Yahoo YUI javascript library in a couple of my projects.
However, I'm a little concerned about three things. First, they laid off 10% of their employees. Second, their stock price keeps falling: especially after ignoring the MS takeover earlier this year. Third, what if someone does buy them?
The only reason I bring this up is that I tend to build applications that are going to be around for 8 to 10 years.
What would you do?
As a member of the YUI team, I would add the following to this conversation: Almost everyone who has ever worked on the team is still with Yahoo and still working on YUI -- a remarkable consistency for a project that is now almost four years old. No one can predict the future of Yahoo at this point (or of any other company), but you can bank on the code you're using today. It's free, open under BSD, and no one can prevent you from using it regardless of what may happen in the future.
We continue to be excited about YUI and we think its next four years will be better than the last four.
Regards,
Eric
Yahoo is a major company that won't end in the next couple of year.
The Yahoo! library is open source so you will have other people to continue to improve it IF Yahoo would go bankrupt.
No technology is 100% safe for 10 years perspective, I think you aren't in danger with it.
In 10 years Javascript will be completely difference and most framework will not be the same so I think whatever you choose you will need to change a lot of thing in 10 years ;) Just be sure to keep a version of the code in you repository to always have the latest version that work for your system and you will be fine.
Everyone else here has already mentioned that YUI is open source (and thus, can be extended, forked, etc)
But the important thing to note is that Yahoo USES YUI on their own web properties. It is a valuable project to them, not just as an internal component library, but as a standardized way to write JavaScript code. Once you wrap your head around that, you'll realize that if Yahoo is still on the internet, it'll probably still be putting resources into YUI.
Also, albeit a huge fan of jQuery, a levelheaded developer cannot seriously recommend a particular framework over another without having a project context and design considerations.
You can't just assume that your square peg is going to fit in everyone's round hole, no matter how hard you try to jam it in.
I switched to jQuery a while back and have been much happier since doing so. You should consider the fact that YUI is open source, so you could always make any needed updates you need in the future.
Switch to jQuery?
I learned YUI prior JQuery, and the problem with YUI is (in my opinion) is over engineered, meaning that is more complex. JQUery is fun to code and at the same time you can do everything with it.
My advice would be to use JQuery, and if you need some YUI component then use both. However i don't see any particular advantage of YUI over JQuery.
Even if Yahoo! goes under, their library is open source. The community will most likely pick it up and continue its development.
I've switched over Jquery recently, and the boost in productivity is noticiable.
YUI does have better docs, but it will break compatibility on 3.0.
Leave your legacy code on yui, and switch to jquery for new devs.
I don't think its ever safe to say "one library for all solutions".
Its always best practice to analyze each project you do and then decide which library to use. Whether that be jQuery, YUI, mootools,etc.
To answer your question a bit more bluntly - don't worry. The web is one of the fastest growing and evolving sectors out there. I would be surprised if your projects don't get re-developed (by you or someone else) in the next 3 - 4 years.
If your web app exists for more than 4 years in it's current form, then that's amazing. That will mean it's dealt with new browser technologies and possibly loss of existing ones. It also means that the site will not need major modifications in that time.
Most web applications I have worked on have been nearly completely rewritten after 3 years. Usually this is because requirements change; usually there are so many additions in that time that it's a completely different piece of software.
Also, in 8 years, I'm sure the YUI will have changed so much that it won't even be the same. 8 years ago it didn't exist; 8 years from now it maybe something completely different. This doesn't mean you can't continue to use the existing libraries exactly as they are.
The only thing you might think of doing is keeping versions yourself. I don't mean loading them from your own server, but just keeping them somewhere. Even just incase YUI changes something and ends up breaking something you were using--not likely.
I think any library is subject to these same concerns: YUI or jQuery, etc.
Well, Yahoo is still a profitable company with over $3 billion in the bank. I don't expect it to go bankrupt anytime soon unless they do something really awful.
However, Yahoo still needs to cut costs and they could just stop developing YUI to move the developers to other places. Just something to keep in mind on whether or not you choose to continue on w/ YUI. At it's current state, I don't see YUI being a revenue generator which is what Yahoo needs right now.
I've used YUI on a project 1 year ago.
I was pretty satisfied with the library even if I found really hard to grasp the way it worked.
After I while I discovered jQuery and tried it on another project.
Man, that was another world.
These days I am doing some changes to the old YUI project.
I wanted to port everything to the 2.8 (from 2.4.2).
I expected it to be easier but it wasn't.
After having spent few months on jQuery I must admit that YUI is overly complex.
You can do almost everything and configure every aspect of your App but, well, it takes ages to understand things, or at lease for me.
jQuery is much better and faster.
The plugin system is amazing.
I didn't try YUI 3 cause I've decided jQuery is good enough for me.
If the library does what you need it to do today, I see no reason not to use it. 8-10 years is a long time for a web-app but I'd like to think Javascript will still be around.
If you are using it with the expectation that it will have great advancements in the future then your concerns are valid but I think the same can be said for almost any technology/language/library. And since it's open source you or others could continue the development.
Here are your options:
1. Build your own Javascript library
2. Use the existing YUI library
3. Use some other 3rd party Javascript library
You can download the entire YUI library and run it from your own web server, so you don't need to depend on Yahoo servers. The code is open source, so you are free to make enhancements yourself if Yahoo stops building it. Given that, I personally think using YUI is much better than trying to roll your own Javascript library. I see a ton of benefits with virtually no risks.
The question that remains is whether you should use YUI or some other 3rd party library. Just about all the other open source libraries share the same future risk as YUI. I would personally look at the features each library supports and pick the one that currently supports everything you want (or the most of what you want).
First, It's open source so you can continue to use it no matter what happens to Yahoo. Besides, no one thinks they are going anywhere anytime soon.
Second, no matter what third party library or tool you use, you're always faced with the risk of them abandoning the product at some point, or even worse, the company going out of business.
Regardless of either, you can still use it after either of which happens. And not until then do you really need to switch? Also, the way the web has been changing, you may not want to use YUI in a few months either way, who knows?
jQuery is for coding, YUI is for learning.
jQuery is more widespread than YUI because it is easy to sprinkle it on web pages that need simple DOM manipulations and basic AJAX or animations.
YUI is an extremely popular library that has historically been a favorite of more advanced developers and application builders.
jQuery is too small and tiny, so that you have to find other frameworks/libraries to working together. You have to take a lot time of investigating test framework, ui framework. MVC frameworks...
But if you choose YUI, it's enough!!! test frameworks(browser and headless), ci tools, widgets, css grid/architecture, AOP, MVC... all the fancy features you want in one Framework! that's really kool.
So if you start a enterprise project, I suggest to use YUI, though it's learning curve to be a bit steep.