Giving up Angular did force me to think more about the DOM. Vanilla jQuery doesn't insert itself as readily into HTML code as an Angular directive can.
And that's why you should use http://intercoolerjs.org for most of your stuff, and a bit of jQuery where necessary for more exotic UX needs. The people who got sick of a mess of jQuery code were right, but they went the wrong direction to fix it. We have to go back.
I know people get tired of my shilling, but intercooler really is a better way for many, and maybe most, web apps to be developed.
I am personally fully behind your shilling and try to shill on your behalf whenever possible. It's sad how little interest intercooler has managed to garner when it's a fantastic antidote to so many things that are wrong with client-side development.
I recently used a touch of intercooler on a Django project and it just felt so right. Once I'd included intercooler.js itself, everything else was done via normal http attributes. It felt clean and lightweight.
FYI, none of the code on your site works for me, possibly because I have cookies and localStorage disabled in my browser. Not sure if this is specific to your framework or a quirk of the website itself (hopefully not the whole framework, as I don't understand why this requirement would be imposed if not actually needed by the app that's using it... since the fundamental premise of the framework seems to be "it's lightweight").
Personally I welcome useful mentions of relevant alternatives in HN discussions, even if it's someone's own project.
I would encourage you to tone down your rhetoric a bit, though. Intercooler looks like a good lightweight tool for projects with lightweight requirements, but based on your own documentation, the claim that it covers most of what is needed for most modern web apps just hurts your credibility.
Appreciate the shill. Hadn't heard of intercooler, but looks very interesting. At our company we've recently been pondering whether to fully embrace the client heavy approach of frameworks like Angular - which we've found frustrating in many ways (mixing server and client templating, localization, duplicated validation logic etc). We've used PJAX in the past and this looks like a suitably modern replacement.
I think there's a better approach to handling the delete buttons that's pretty common when using jQuery. Instead of each button having it's own handler function I would specify an event handler on a single DOM element (e.g. a list container) with something like $('#itemlist').on('click', '.delete', deleteItem). When 'deleteItem' is called 'this' will be the clicked button element that could have an attribute like 'data-itemid=123' which you use to fill in the 'id' part of the service call. And from there, after a successful service call, you can usually get at the parent element you want to remove from the list and take just that out instead of refreshing the entire list.
I found that odd. I do worry that many people use technologies because other people working at a completely different scale or in a completely different domain have hit a ceiling which wouldn't really apply to most people. They are convinced to start with a more complex and more difficult technology that's solving problems they are unlikely to be facing any time soon.
1. NoSQL <> traditional RDMS because of scaling/sharding
2. Angular <> jQuery (or anything similarly lightweight) because of the issues around huge complex webapps
3. 'Fast' languages <> 'nice' languages ( ;-) ) because of performance concerns
4. Static typing <> Dynamic typing because of maintainability across large teams.
5. Docker/Microservices etc <> traditional architectures because of... I really have no idea...
So I guess the degenerate case is some poor chap learning web development who decides to write their Pet Store as an angular app with a Scala API backed by Mongo and Solr deployed to a Kubernates cluster ;-)
This is a very good point; I also found the submission enlightening for that reason -- because of the 'rediscovery' of jQuery, and how for simple use-cases, it's actually fairly palatable.
All solutions go through a maturity cycle where we invent an ostensibly "better" way of doing it because we're frustrated with the old way -- jQuery came about because early DOM selectors were lacking, Angular came about because people built complicated client-side spaghetti code state machines with jQuery -- but eventually a new wave of people comes along and the 'new way' becomes the 'mainstream way', and the like.
Like this author has done, it's interesting to go back and rediscover how things were done in the past, and in many cases you learn more about the problem domain or your stack of choice by doing so. My age is also showing that Angular no longer counts as cutting-edge, early-adopter tech, but firmly in the camp of mainstream ways of doing client-side code.
I have a suspicion that this kind of thing happens with programmers who have not worked much on client side development moving to it from Enterprise Java development or similar disciplines. This suspicion also seems to be borne out/hinted at by the post.
Nope. jQuery came first. For me, it was a matter of spending a few years in Java shops. Most of the work was so server-side focused that I ended up forgetting a lot of my Javascript.
After leaving my last job, I decided I needed to update my skills and Angular seemed like a good road to go down. It was only recently that I decided to return to the old jQuery well to see what I could do with it vs. Angular. I'm glad I did.
Next time, try dropping jQuery, too, and just using vanilla JavaScript. Just for fun. Simple DOM manipulation is now as simple in vanilla JavaScript as jQuery, with the only big advantage jQuery has now is if you're animating. You may find you're not missing much. You'd have to get used to slightly more involved Ajax syntax, unless you can target only new browsers, in which case the `fetch` API is just as convenient as jQuery's Ajax.
Heck, if you can can transpile to ES6 or if you're only targeting new browsers, you could probably even drop the Handlebars in factor of template literals without losing too much convenience.
> ...with the only big advantage jQuery has now is if you're animating.
While you can probably get away with using $.animate for very simple animations, you'll run into jQuery's animation performance problems before too long.
Design by committee, you get crap. Ease of use is incredibly important. And don't even get me started on on the fly dom manipulation, vanilla js really sucks for that.
let div = document.createElement("div");
div.iMAlreadyBoredTyping = "Yes";
node.appendChild(div);
Even Angular is still difficult for me to grok and sometimes I wonder if stuff that comes out of Google "suffers" (for me) from Google having unlimited resources and employing superior engineers? Would Google have a difficult time empathizing with "average" programmers with limited resources?
I think Angular takes a considerable amount of time to wrap your head around. I think the largest issues that you will most likely run into is an ng-repeat with large collection of objects (which, due to dirty checking, may impact your site), memory leaking, and using multiple controllers or controller as syntax.
I used Mithril for a while and it opened up my eyes as far as thinking "functionally"; it makes your code easier to understand and extend.
If you use filters functionally with Angular, you can get great performance on large collections in a ng-repeat. Likewise, if you understand prototypical inheritance, it will make working with multiple controllers/states a lot easier.
I really enjoy developing Angular, but it took a lot of time to really process. jQuery just works out of the box, but for me, it feels like it is more for little snippets of codes across various pages. It just depends on what you are trying to do.
For Angular 1, I'd recommend sitting through Dan Wahlin's hour intro to Angular. Don't code, just watch. It really helped me get that initial chunk of knowledge in my head.
I think the reason Angular2 might be difficult for a novice programmer is because of the nature of problems it tries to solve. It is an MVC framework with an emphasis on dependency injection and test-driven development. A novice programmer probably has at most a limited understanding of MVC, dependency inversion, and TDD, so you would need to learn more about those concepts to even work through the tutorial. Taking that into account, in may or may not be the right tool for the job depending on the problem.
I've run into a lot of people who found angular hard to pick up; it's not just you.
One of them now works on the React team, and I found it pretty easy to pick up from the official docs: https://facebook.github.io/react/ . I recommend not bothering with stuff other than the base react library at first (although jsx/babel is nice); you can use react without it and potentially learn that later.
It's also totally valid to just start with basic js/html/jquery. The Mozilla's MDN docs for most html/js things are decent, and jQuery's api docs are pretty good in my experience.
carsongross|9 years ago
And that's why you should use http://intercoolerjs.org for most of your stuff, and a bit of jQuery where necessary for more exotic UX needs. The people who got sick of a mess of jQuery code were right, but they went the wrong direction to fix it. We have to go back.
I know people get tired of my shilling, but intercooler really is a better way for many, and maybe most, web apps to be developed.
andybak|9 years ago
I recently used a touch of intercooler on a Django project and it just felt so right. Once I'd included intercooler.js itself, everything else was done via normal http attributes. It felt clean and lightweight.
jordanlev|9 years ago
Silhouette|9 years ago
I would encourage you to tone down your rhetoric a bit, though. Intercooler looks like a good lightweight tool for projects with lightweight requirements, but based on your own documentation, the claim that it covers most of what is needed for most modern web apps just hurts your credibility.
pseudosavant|9 years ago
rowanseymour|9 years ago
jsmith0295|9 years ago
asciihacker|9 years ago
jasonkostempski|9 years ago
EDIT: Had the 'on' parameters mixed up. Here's the api doc: https://api.jquery.com/on/
nicolasMLV|9 years ago
impostervt|9 years ago
Maybe I'm getting old.
andybak|9 years ago
1. NoSQL <> traditional RDMS because of scaling/sharding
2. Angular <> jQuery (or anything similarly lightweight) because of the issues around huge complex webapps
3. 'Fast' languages <> 'nice' languages ( ;-) ) because of performance concerns
4. Static typing <> Dynamic typing because of maintainability across large teams.
5. Docker/Microservices etc <> traditional architectures because of... I really have no idea...
So I guess the degenerate case is some poor chap learning web development who decides to write their Pet Store as an angular app with a Scala API backed by Mongo and Solr deployed to a Kubernates cluster ;-)
niftich|9 years ago
All solutions go through a maturity cycle where we invent an ostensibly "better" way of doing it because we're frustrated with the old way -- jQuery came about because early DOM selectors were lacking, Angular came about because people built complicated client-side spaghetti code state machines with jQuery -- but eventually a new wave of people comes along and the 'new way' becomes the 'mainstream way', and the like.
Like this author has done, it's interesting to go back and rediscover how things were done in the past, and in many cases you learn more about the problem domain or your stack of choice by doing so. My age is also showing that Angular no longer counts as cutting-edge, early-adopter tech, but firmly in the camp of mainstream ways of doing client-side code.
bryanrasmussen|9 years ago
pcote|9 years ago
After leaving my last job, I decided I needed to update my skills and Angular seemed like a good road to go down. It was only recently that I decided to return to the old jQuery well to see what I could do with it vs. Angular. I'm glad I did.
bdcravens|9 years ago
jnbiche|9 years ago
Heck, if you can can transpile to ES6 or if you're only targeting new browsers, you could probably even drop the Handlebars in factor of template literals without losing too much convenience.
beebs93|9 years ago
While you can probably get away with using $.animate for very simple animations, you'll run into jQuery's animation performance problems before too long.
See: - http://wilsonpage.co.uk/preventing-layout-thrashing/ - http://velocityjs.org/
neogodless|9 years ago
"Vanilla JS is a fast, lightweight, cross-platform framework for building incredible, powerful JavaScript applications."
"In fact, Vanilla JS is already used on more websites than jQuery, Prototype JS, MooTools, YUI, and Google Web Toolkit - combined."
mattmanser|9 years ago
Nowt's going to beat $(".thing") vs:
Or Design by committee, you get crap. Ease of use is incredibly important. And don't even get me started on on the fly dom manipulation, vanilla js really sucks for that. vsmethyl|9 years ago
talmand|9 years ago
pbreit|9 years ago
Even Angular is still difficult for me to grok and sometimes I wonder if stuff that comes out of Google "suffers" (for me) from Google having unlimited resources and employing superior engineers? Would Google have a difficult time empathizing with "average" programmers with limited resources?
rajangdavis|9 years ago
I used Mithril for a while and it opened up my eyes as far as thinking "functionally"; it makes your code easier to understand and extend.
If you use filters functionally with Angular, you can get great performance on large collections in a ng-repeat. Likewise, if you understand prototypical inheritance, it will make working with multiple controllers/states a lot easier.
I really enjoy developing Angular, but it took a lot of time to really process. jQuery just works out of the box, but for me, it feels like it is more for little snippets of codes across various pages. It just depends on what you are trying to do.
quantumhobbit|9 years ago
The problem is not with you, but with a those that made angular more complicated than it could have been.
bdcravens|9 years ago
https://www.youtube.com/watch?v=i9MHigUZKEM
ruraljuror|9 years ago
ariabuckles|9 years ago
One of them now works on the React team, and I found it pretty easy to pick up from the official docs: https://facebook.github.io/react/ . I recommend not bothering with stuff other than the base react library at first (although jsx/babel is nice); you can use react without it and potentially learn that later.
It's also totally valid to just start with basic js/html/jquery. The Mozilla's MDN docs for most html/js things are decent, and jQuery's api docs are pretty good in my experience.
asciihacker|9 years ago
Angular isnt really a Google product - Misko Hevery and another guy (both Google SW Engineers) developed in their free time.
Dart is a Google product and I would say is much easier to grok than Angular.
nicolasMLV|9 years ago
https://learn.jquery.com/events/event-delegation/
tdubbs|9 years ago
c-smile|9 years ago
Routing, view, controllers in 60 lines of code + jQuery: https://github.com/c-smile/spapp
Template-less repeatable sections / lists in 100 lines of code + jQuery: https://github.com/c-smile/repeatable.
matchagaucho|9 years ago
JQuery encourages more fluent, purely functional reasoning, and one-way data binding of immutable data objects.
pcote|9 years ago
asciihacker|9 years ago
https://www.scala-js.org/