Live data from Hacker News

Stepping Backwards from AngularJS to JQuery – An Experiment

hundredminutehack.blogspot.com

31–40 of 68 posts

Re: Stepping Backwards from AngularJS to JQuery – An Experiment

#31
post #6

Caveat: novice programmer here. 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 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.

Re: Stepping Backwards from AngularJS to JQuery – An Experiment

#32
post #7

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…

http://vanilla-js.com/

"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."

Re: Stepping Backwards from AngularJS to JQuery – An Experiment

#33
post #10

Earlier quoted context omitted.

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/shar…

My friend was brought in by a client after the previous contractor had spent 300+ hours coding a simple organizational website - here is who we are, here is our phone number - using node.js. I doubt the website will ever see more than 20 concurrent visitors.

It's probably featured in the Previous Contractor's portfolio though.

Re: Stepping Backwards from AngularJS to JQuery – An Experiment

#34

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 'da…

yes, that is event delegation : https://learn.jquery.com/events/event-delegation/

I almost went down the event delegation route. The only thing that stopped me was having stumbled upon a tactic that happened to work where I just attached individualized event handlers one at a time. I appreciate the input and will make sure to give event delegation a second look.

Re: Stepping Backwards from AngularJS to JQuery – An Experiment

#35
post #10

Earlier quoted context omitted.

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/shar…

My friend was brought in by a client after the previous contractor had spent 300+ hours coding a simple organizational website - here is who we are, here is our phone number - using node.js. I doubt the website will ever see more than 20 concurrent visitors.

Even still, that's just the completely wrong technology to use for something like this regardless of scale. It sounds like it's literally static content. Just write an HTML file directly if it's a single page, or use something like `Assemble` to get easily re-usable partial support if you have multiple pages that want to share a header and footer or something.

Re: Stepping Backwards from AngularJS to JQuery – An Experiment

#36
post #7

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…

Check out https://developer.mozilla.org/en-US/docs/Web/API/Web_Animati... for animation without jQuery

Re: Stepping Backwards from AngularJS to JQuery – An Experiment

#37

I found this interesting because it seems to have been written by a person who learned Angular before jQuery. I haven't run into that before. Maybe I'm getting old.

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.

Re: Stepping Backwards from AngularJS to JQuery – An Experiment

#38
post #13
post #7

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…

What's the big advantage of jQuery with animating? Are you referring to the animation built into jQuery?

Actually, looking over the new Web Animation API, it looks like jQuery doesn't even offer much of an advantage for animations as long as you're targeting new browsers that have the Web Animation API (yes, I was referring to the animation support built into jQuery).

Re: Stepping Backwards from AngularJS to JQuery – An Experiment

#39
Amazed at how Angular has created a generation of programmers that accept 2-way data binding and MVC as "the only way" to develop web apps.

JQuery encourages more fluent, purely functional reasoning, and one-way data binding of immutable data objects.

Re: Stepping Backwards from AngularJS to JQuery – An Experiment

#40
post #20
post #7

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…

> ...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. See: - http://wilsonpage.co.uk/preventing-layout-thrashing/ - http://velocityjs.org/

Yeah, but then you just add velocityjs (as you reference). But I'm really referring to simple animations here, for anything complex I'd use Canvas or possibly SVG (although SVG can also have performance issues).
Post reply on HN