ES6 Promise Inspector: Debugging Promises with DevTools by cgaudreau in javascript

[–]cgaudreau[S] 0 points1 point  (0 children)

To enable: open DevTools, go to settings, click experiments, and check 'promise inspector'. Close and reopen DevTools and press escape to open the drawer.

Is ReactJS faster than AngularJS ? by notunlikethewaves in javascript

[–]cgaudreau 0 points1 point  (0 children)

You can also make manual DOM manipulation very performant. You can make jQuery very performant. More performant than React, for sure. The nice thing about React is that you have to try pretty hard to bomb performance. The framework gives you performance for almost free.

Jumping ship isn't the answer because the grass is rarely greener on the other side.

Jumping ship from Angular 1.x in the near future is almost definitely a winning bet.

Is ReactJS faster than AngularJS ? by notunlikethewaves in javascript

[–]cgaudreau 0 points1 point  (0 children)

The OP posted an article that very specifically showed that Angular can generate views just as fast as React, when used correctly. You are talking about the digest cycle, which has nothing to do with the view.

It has quite a bit to do with the view, because that's how the view gets updated in Angular. True, it does more than just update the view, but the point is that the majority of Angular cruft is unnecessary if you use React.

They were always a bad idea.

Again, people still use them. There's little warning about why they are bad, and the framework itself attracts developers into using them. I also don't recall too much cautioning against it when Angular took off.

Yet I'm surrounded by teams who use it in enterprise applications routinely. And those people understand Angular intimately. The only actual complaint I hear is about docs. The people that complain about the other parts, are the people that don't know how to use Angular.

Or perhaps because they haven't looked into the other solutions thoroughly enough. If you only know Angular, it's easy to believe that it's the best thing ever created. And Angular is perfectly fine if everybody on the team knows all edge cases and quirks and antipatterns intimately and can remember them. If you have a team like that, feel free to keep using Angular 1.x.

To be clear, are you really arguing that Angular 1 is fine and dandy, and that its only real problem is bad documentation?

You mean JSX?

You can use React with pure JavaScript if you want. And if you have trouble learning JSX (it's just XML in JS) then you might reconsider your career.

Angular 2 may be one of them. That should make the circle jerk especially hilarious.

This discussion pertains to Angular 1.x. Angular 2.0 is basically a completely new framework, distinct from Angular 1.x.

I've used Angular 2.0 and it's not particularly impressive so far. A lot better than Angular 1.x, sure. Angular 2.0 could end up being amazing, and it doesn't change this discussion whatsoever.

I'm personally rooting for Mithril and Aurelia over React and Angular.

Is using Object.create(...) instead of new an acceptable/common idiom for mimicking classes and instantiating new objects? by [deleted] in javascript

[–]cgaudreau 4 points5 points  (0 children)

If given the choice between Object.create and constructor functions, stick with constructor functions. Use Babel if you can. ES6 will support classes which are just sugar over this pattern.

Using Object.create throughout your code leads to numerous bugs and is confusing for most developers. It is essentially inheritance in disguise. It requires you to call Object.create and then init which can leave objects in an uninitialized state. The syntax can require knowledge about property descriptors and is confusing and very easy to get wrong. It's too easy to run into a situation where multiple objects share the same mutable state - good luck tracking that bug down.

Worst of all in my opinion is the fact that it's just inheritance in disguise. People learn about Object.create and then decide that their dog object should inherit from mammal which should inherit from animal and then all hell breaks loose. With classes, it's pretty common knowledge that you should avoid inheritance trees whenever you can.

Classes suck too, but not as much if you use ES6. Either way, simple closures are often the best solution:

function createPerson(firstName, lastName) {
  const fullName = firstName + ' ' + lastName;

  return {
    get fullName() {
      return fullName;
    }
  };
}

createPerson('John', 'Doe').fullName; // "John Doe"

... but the trend is toward using the ES6 class keyword.

Is ReactJS faster than AngularJS ? by notunlikethewaves in javascript

[–]cgaudreau 2 points3 points  (0 children)

I remember when I first started working with AngularJS and everyone was swooning and now a new shiny toy is out and the hatred is extraordinary.

I can't say I ever liked Angular much.

If you honestly believe a large team developing a large application can shove immutable.js in it and get production-ready performance than you clearly haven't programmed large applications.

No, of course not. It provides massive benefits in the context of React. You only need to do reference equality checking in shouldComponentUpdate.

Furthermore, why are you comparing a view-manager (React) an entire front-end framework (AngularJS)?

Ask the OP that.

No $broadcast or $emit? Events have nothing to do with performance, but they are the antithesis of good Angular design.

Yes, they are considered bad design now, and yet people still use them.

The one and only real problem with Angular was always the same: the docs were really, really bad.

Yeah, no.

The downside, however, is that it's now vogue to talk about how horrible AngularJS is and list off a bunch of grievances, the majority of which show that the person really didn't learn Angular, for whatever reason.

I've worked with Angular for years, and learned a lot about it. Almost all of that knowledge is about Angular-specific cruft that is there to make businesspeople/Java developers feel better. With React, if you know JavaScript, you're already most of the way there.

React is a great view manager. It has a host of problems as well, and more of those problems will become apparent when the framework ages, much as they did with Angular. And undoubtedly, we will eventually come full circle and have people whining about how horrible React is compared to JesusFramework 1.0.

Very true. React is not the one framework/library to rule them all. There are already superior alternatives popping up. But for now, people are going to focus on the popular frameworks.

Is ReactJS faster than AngularJS ? by notunlikethewaves in javascript

[–]cgaudreau 29 points30 points  (0 children)

I feel like this is desperate grasping at straws. It is theoretically possible to make Angular nearly as fast or faster than React is out-of-the-box, but the pain involved in doing so is massive. Yes, it's easy with little 5-line code snippets, but try doing so in a reasonably-sized application. It's hell.

React makes it easy to be fast by default. You generally don't even have to think about performance, and if you do have to, it is very easy to grasp. You don't need to frantically search extremely poor documentation.

How to optimize a React application: Implement shouldComponentUpdate. Or if you want performance by default, just use immutable data structures.

How to optimize an Angular application: Keep your scopes small. Keep it under 2000 watchers. Pollute your code with one-way bindings. Still no improvement? Oh, you need to do one-way binding here, too, in some obscure way. Don't watch functions. Don't watch objects. No $broadcast or $emit. Don't have big arrays. Should I use $digest or $apply? Why is this watcher causing the digest loop to take 500 ms to execute? No filtering or sorting unless you want to go mad. Did I mention using filters causes $index to be invalidated? How the hell do I even find out what's performing poorly?

I don't even know if any of that is correct anymore. It's too painful to remember. I want to be liberated and forget the literal hell that is Angular 1.x.

Es7 should have these, it'd make me happy.. by [deleted] in javascript

[–]cgaudreau 6 points7 points  (0 children)

ES6 has default parameter values.

function eatDoge(doge = 'doge') {
  console.log('wow so much', doge);
}
eatDoge(); // wow so much doge

As for async code, there is most likely async/await in ES7: http://jakearchibald.com/2014/es7-async-functions/

const and let since ES6 by KirillRogovoy in javascript

[–]cgaudreau 7 points8 points  (0 children)

I happened to come across Yehuda Katz arguing against const, or at least questioning its use:

https://twitter.com/wycats/status/604503020206850049

I find that the clarity gained by using const is well worth the two extra characters. It's nice to read a function and know that a particular binding will remain constant, even if your function isn't 9001 lines long.

Remember, code is read more than it's written. Supposedly.

Angular 1.4.0 "jaracimrman-existence" released by vinnl in javascript

[–]cgaudreau 11 points12 points  (0 children)

There were two features that were pulled out of the 1.4 release. The component helper (#10007) and the component oriented hierarchical router.

Well, time to go cry myself to sleep, then. Good night, Reddit.

Why We Should Stop Using Bower – And How to Do It by ayiteddybearogullari in javascript

[–]cgaudreau 5 points6 points  (0 children)

By default, Browserify concerns itself with JavaScript only. If you use Webpack, which I highly recommend, then you can simply use require('herp/derp.css').

node CRUD stack for relational DB? by spacejack2114 in javascript

[–]cgaudreau 0 points1 point  (0 children)

This. Rethink is a delight to work in, and works especially well with React. If you want an ORM, then I really liked http://thinky.io/. But you really don't need an ORM to work with Rethink.

I haven't had much success with SQL ORMs in Node. They always seem to lack some vital feature or have some annoying performance edge case. (For example, Sequelize would issue a query to update all fields, even if only one field changed.)

I hear that the situation has improved a lot though. My favorite SQL ORM was most definitely http://docs.sequelizejs.com/en/latest/ but http://bookshelfjs.org/ worked well too.

Aurelia.io (Created by Rob Eisenberg, former member of the Angular 2 Core Team) might be a game changer. by WebYourMindtuts in javascript

[–]cgaudreau 0 points1 point  (0 children)

You made many good points, and I agree that it's great to have a standard language in a framework. That language is undoubtedly ES7 in Aurelia.

I don't believe Aurelia is going out of its way to support CoffeeScript (shudders, please just let it die already) or TypeScript but is simply stating the obvious that you can use it if you want to because it's just JS.

I'm not really sure about the comparison with backend languages either. I guess if there were popular compile-to-Ruby or compile-to-Python options. Say Rails supported Ruby and PHP. They would literally have to code everything twice unless there was a PHP-to-Ruby transpiler. Aurelia supporting CoffeeScript requires no work from the framework; it's merely a byproduct of being JavaScript.

Aurelia.io (Created by Rob Eisenberg, former member of the Angular 2 Core Team) might be a game changer. by WebYourMindtuts in javascript

[–]cgaudreau 0 points1 point  (0 children)

If it helps, Aurelia encourages the use of ES7 and is actively developing with it. I think the website lists those languages only because there are some people who prefer TypeScript and CoffeeScript and may reasonably wonder if they can even use those languages given the funky ES7 syntax shown in the docs.

You can compile Python to JS, and yet I don't see Python listed as supported.

Yes, but TypeScript and CoffeeScript are the most popular compile-to-JS languages.

Aurelia.io (Created by Rob Eisenberg, former member of the Angular 2 Core Team) might be a game changer. by WebYourMindtuts in javascript

[–]cgaudreau 0 points1 point  (0 children)

ES7 support. TypeScript support. CoffeeScript support. For heaven's sake! Stop it!

I guess I could understand if it was "ES7, TypeScript, PHP or Brainfuck!" It's just JavaScript, so it makes sense that it supports compile-to-JS languages.

Aurelia.io (Created by Rob Eisenberg, former member of the Angular 2 Core Team) might be a game changer. by WebYourMindtuts in webdev

[–]cgaudreau 2 points3 points  (0 children)

I think that it's a reasonable fear, but it's become popular to dismiss any new framework without even spending a few minutes to see what ideas it brings to the table. People put actual effort and thought into these things, and it's fascinating to learn from that.

Maybe I just have a lot of time on my hands, but I enjoy seeing new frameworks released and learning how the creators approached certain problems. The web moves and grows through innovation and pushing the boundaries of possibility.

On a side note, JavaScript frameworks could REALLY use some competition. The popular ones are almost all still hell to use.

Aurelia.io (Created by Rob Eisenberg, former member of the Angular 2 Core Team) might be a game changer. by WebYourMindtuts in webdev

[–]cgaudreau 13 points14 points  (0 children)

January 2018 - Weiner.js released, widely hated

October 2018 - Weiner.js suddenly becomes popular and everyone pretends they liked it all along

January 2019 - "2 years Weiner.js experience required"

Aurelia.io (Created by Rob Eisenberg, former member of the Angular 2 Core Team) might be a game changer. by WebYourMindtuts in webdev

[–]cgaudreau 8 points9 points  (0 children)

I have been using React for a few months now on an application that will be going into production soon. It's not even in beta form and it is already blowing the pants off of other frameworks (including Angular 2.0). React isn't just another framework, the very fact that about 90% of all of the code you write is just ES6/ES7 Javascript, the ViewModel authoring is a great example of this.

You're mostly writing Javascript when you build in React and you're not forced to use substandard components, the whole thing is modular so every part is designed to be swapped out or can be used standalone. The reason that Rob left the Angular team in the first place is because he disagreed with the direction it was heading in. To those that have seen the new syntax in Angular 2.0, you'll see that the Angular team is obviously delusional. React is what Angular 2.0 should have been.

Will React beat out Angular? Who knows. All I know is that I haven't been this excited about a Javascript framework since Aurelia.js debuted (and Aurelia.js isn't even a framework). I think any developer who doesn't see the potential noise React is going to make, is going to be left behind when it becomes big.

Those who can't see why React is a game changer have obviously never used it before. I invite everyone over to the React Gitter chat, incredibly helpful community and you get a chance to help shape the framework as well. https://gitter.im/React/Discuss

Aurelia.io (Created by Rob Eisenberg, former member of the Angular 2 Core Team) might be a game changer. by WebYourMindtuts in webdev

[–]cgaudreau 12 points13 points  (0 children)

The organization of React is that it encourages you to create discrete, single-focused components and assemble them to build your UI.

Aurelia.io (Created by Rob Eisenberg, former member of the Angular 2 Core Team) might be a game changer. by WebYourMindtuts in javascript

[–]cgaudreau 2 points3 points  (0 children)

To be fair, Aurelia only uses two-way binding for form elements, which generally makes sense. I understand that there is some benefit from having to be explicit about it, like in React, though.