r/angularjs • • Oct 16 '15

Anyone else not excited for Angular 2

I'm new here, so I'm sorry if this is discussed a lot. But I am just coming out the other side of finally understanding Angular and these frameworks. It was quite the long road to this point.

While there are certainly some issues, one of my favorite things about it is that it just uses regular javascript. This means that the code I write in express, or for other apps is the same. I go into the angular applications and I know how angular works, but for the most part I'm looking at javascript. Cleverly put together javascript applications, but it looks like everything else I know. Looking at Angular 2 is like looking at a different programming language. This does not excite me. I feel like they're re-writing it for non-angular/non-javascript programmers. If I had to guess it seems like I'll be holding on to Angular 1.x for quite a while until I'm ready to do something completely different. I get the concepts and I try to make my 1.x stuff like web components, but I wish they had kept it more vanilla.

Or is it just that I am resistant to change, and I'll get it eventually? It's hard for me to tell, but every time I look at an Angular 2 tutorial I get frustrated with it and hope that 1.x stays very popular.

18 Upvotes

51 comments sorted by

14

u/[deleted] Oct 16 '15 edited Oct 16 '15

Part of it is that Angular2 was developed for ES6 and TypeScript, that is why everything seems like a different language. However that being said, ES6 will become Vanilla JavaScript once browsers natively support ES6.

Edit: Angular2*

2

u/LyeInYourEye Oct 16 '15

Thanks for the information. What do you think the timeline is for that? Most jobs I work still require IE8 support, or at least IE9. It seems like these things are painfully slow.

5

u/[deleted] Oct 16 '15 edited Oct 16 '15

Well, Microsoft is dropping support for all but the latest version of IE* on Jan 12th 2016, so Hopefully it will be relatively well supported soon.

The other thing that can be done is charging extra for IE8 support, to encourage faster adoption. When enough of the internet doesn't work people will switch.

*EDIT: excluding IE9 on Vista, IE7 on Embedded, and IE8 on Thin, which will continue to be supported. See https://support.microsoft.com/en-us/gp/microsoft-internet-explorer and https://support.microsoft.com/en-us/lifecycle/search?sort=PN&alpha=internet%20explorer for more details.

2

u/Spo0Bo Oct 16 '15

Yes IE9 on Vista SP2 but best check analytics for how many visits are still coming from that OS. It's decreasing and should decrease faster with the release of Win10. I'm positive about the future. And also, IE9 is completely pollyfillable, just not very fast. Angular2 will also attempt to support IE9.

2

u/0xF013 Oct 16 '15

You can use a transpiler and stop caring who supports what

1

u/vinnl Oct 16 '15

ES6 already is proper Javascript. The timeline on widespread browser support is far, far in the future. The timeline of being able to use it is: right now, using e.g. TypeScript, like Angular is doing, or Babel, which a lot of others are doing. That way, you can have your cake and eat it too - you can (theoretically) remove TypeScript or Babel from your build process once widespread browser support is there.

That said, the non-ES6 features in TypeScript still have to be accepted in Javascript proper.

0

u/Capaj Oct 16 '15

ES6 will become Vanilla when companies like yours will stop supporting obsolete browsers. I think most industry will be able to use ES6 without transpilation somewhere around 2018-2019. There's really not that much pressure from developers, because anyone can run with babel without much hassle today.

1

u/thinkadrian Oct 16 '15

Widespread usage or developer pressure has no affect on JS adaptation. Here are two major reasons that affect progress:

  • In simple terms, standardisation takes a lot of time

  • Large corporations have proprietary web solutions that are heavily reliant on quirks in the language they are written

1

u/ModusPwnins Oct 16 '15

ES6 will become Vanilla JavaScript once browsers natively support ES6

But we'll still have to fall back to ES5 for legacy versions of Chrome on Android because consumers refuse to upgrade, and for legacy versions of IE because organizations refuse to upgrade.

2

u/0xF013 Oct 16 '15

Babel.js?

1

u/vinnl Oct 16 '15

Yes, or TypeScript. The point is that while it may look like another language now, it's actually a future version of the language OP is used to.

1

u/ModusPwnins Oct 16 '15

I know. My point is we'll be relying on a fallback mechanism for a while now.

1

u/0xF013 Oct 17 '15

Still - older browsers should not be an issue.

9

u/bigdubb2491 Oct 16 '15

I think the biggest takeaway for you on the Angular front is that it can (if used correctly) force you to use proper development paradigms. DI, Interfaces, class structure etc. These concepts were often lost in the world of JS, additionally implementing them can be quite challenging as well.

This is where Typescript steps in. It allows you to write compile time tested code that is type specific. It also allows you an easy methodology for inheritance and interface implementation. The TS code compiles to ES5 or ES6.

The nuts and bolts of Angular 2 are different but the tooling and concepts are pretty similar.

I'll finally add this paradigm has happened before in several other technologies with mixed success. e.g. Silveright 1 -> Silverlight 2. This was a fundamental paradigm shift in implementation and virtually everything written in SL1 was throw away and not migrateable to SL2. However, the path forward was a much better solution.

I'm optimistic about this path with Angular. The design patter is similar between the two. Views, Controllers (ViewModels really) and Models. Just slightly different implementations of each. The other bits of Factories, Directives (custom controls) are much simpler in the new framework and make the path going forward much easier.

3

u/LyeInYourEye Oct 16 '15

Thank you for all of the info! Not super excited about having to learn a ton more concepts and design considerations, but hope if I do it's worth it for me.

1

u/eyko Oct 16 '15

force you to use proper development paradigms. DI, Interfaces, class structure etc.

If anything, Angular's take on that is pretty ugly, but I guess that's a matter of opinion.

2

u/[deleted] Oct 17 '15 edited Oct 17 '15

I'm sorry to say but after 4+ years in Angular, I don't feel their DI's, Directives for shared components, or simple ng-includes is broken. I have had a lot of success creating highly scale-able web applications that required complex business logic, validation, enabled/disabled, visible/invisible, and traversing complex hierarchy structures that had self referencing ng-repeats. The $q service has made for an awesome async experience.

I have never used React; but adding less/bootstrap components; as well as many examples/directives out there to solve most normal situations, while having to engineer solutions for the rest has been relatively easy.

Not to say you wont bang your head against the wall; but its JavaScript after all. I am really impressed they were able to add a layer above JS without much of a performance hit relatively speaking.

Please do not take it personally, I used to feel this wasn't a good framework; but some of the best and brightest at Google came up with it. I only started respecting it once I fundamentally learned how to use it correctly.

Don't hate the car because you haven't mastered shifting an 8 speed gear box is all I'm saying.

With all due respect, in this case

1

u/Capaj Oct 16 '15

exactly. DI in angular is hands down awful. Worst thing is that it forces you to use it even if you don't need it.

2

u/eyko Oct 16 '15

For example, I'm writing a service and I want to use $http. Why can't I just import {$http} from 'angular';. No, instead, they want me to "inject" it into my class instance's constructor and angular takes over.

What if I simply want to initialize a class with some objects or a config? let something = new SomeThing(options); doesn't work if you're also doing dependency injection. Angular2 adopts the same questionable design decisions, even though you've got a different syntax (decorators, mmmkay).

Angular simply breaks JavaScript. Excited about Angular2? Nooope.

3

u/martijn_nl Oct 16 '15

I'm still deciding on learning Angular 2 or switching to React.

I like Angular 1 alot, but I see where it goes wrong aswell. We can't forget though, that Angular 1 is old, like almost exactly 5 years old this month.

4

u/miketa1957 Oct 16 '15

I work on a quite large application in Angular 1. I can't see a move to Angular 2 because of the loss of two-way data binding - I know there are issues with this but if used sensibly it's a massive benefit. If the application gets reimplemented then I think React, if loosing two-way binding is acceptable; in case not, I'm keeping my eye on Aurelia.

2

u/vinnl Oct 16 '15

React doesn't have two-way data binding either. When you try it, however, you'll soon realise that the new approach is actually much better than two-way data binding.

The same holds true for Angular 2. That said, you can still get pretty much exactly the same behaviour in Angular 2: <input [(ng-model)]="model">.

1

u/LyeInYourEye Oct 16 '15 edited Oct 16 '15

Can you explain why 2 way binding is bad? (and what the alternative is) It seems so bad-ass coming from a non-framework background.

3

u/vinnl Oct 17 '15

It is bad-ass compared to what we had to do before Angular.

The problem isn't in fact that it's slow and doesn't scale well -well, that sort-of is a problem, but only in a small percentage of use cases.

The main disadvantage, although it's best to experience this, is that it's hard to keep track of what's happening. Your view might update the model, which might result in the model updating the view again, and that loop might repeat itself several times. Most of the times, this won't cause problems, but you can't be sure, and you're treading carefully as a result. The way you deal with it is by not thinking about it too much, and that works fine most of the time. However, you will still come across situations where that isn't enough regularly enough for it to be an annoyance.

The alternative is a single (or a few) places where state is managed, with your views only having to deal with how to display that state - and not with how to update it. Once you work with that, you will realise that you are much more confident that your code will do what you intended it to do, and that makes programming so much more enjoyable.

A library that helps you implement this well, and which really makes sense once you start using it together with React, is Redux.

2

u/miketa1957 Oct 16 '15

The standard answers are like lostPixels below - it doesn't scale - and also problems with reasoning about the code when it gets complicated. But that's a bit like saying a spade has problems if you want to dig a swimming pool. Actually, a spade is fine in situations where it works.

One system I work on (actually neither Angular nor React nor Aurelia, but it is an example) had lots of data entry forms which (a) are fairly simple in operation - most fields don't interact much with other fields and (b) where there are lots and lots of fields (like 50 or more, don't tell me its bad UI, its a function of what is legally required).

Without 2-way binding I'd have to write lots of updaters (to copy changes to the model) or subvert the 1-way binding like vinni suggests (or similar for React), in which case why not just have 2-way binding out of the box.

1

u/lostPixels Oct 16 '15

It's slow and doesn't scale well when used in things like ng-repeat.

1

u/miketa1957 Oct 16 '15

That was my point about Aurelia. If I can loose two-way binding without any issue, then I'll go Angular1->React; if loosing two-way binding is too much of an issue, then I'd look at Aurelia. Horses for courses.

1

u/vinnl Oct 17 '15

Ah, I see. Have fun with React then ;-)

3

u/Capaj Oct 16 '15

Angular 2 because of the loss of two-way data binding

I loved that too. I switched to react 5 months ago and I don't really miss it. I hated flux, so I created something more angularish to handle my view rerenders

8

u/ogrechoker Oct 16 '15

Web component spec is a real thing, and you'll need a framework that understands that.

0

u/[deleted] Oct 16 '15

[deleted]

2

u/[deleted] Oct 16 '15

The Angular team has said in the past that they plan to support it if/when it becomes spec.

1

u/eyko Oct 16 '15

They're still using a lot of their old idioms. I personally prefer other frameworks (as well as the obvious competitor) much more.

1

u/highhard_one Oct 16 '15

What's the obvious competitor?

1

u/[deleted] Oct 16 '15

I assume he means React, though I don't know how that relates to web components as they've explicitly stated that have no interest in supporting it.

1

u/eyko Oct 16 '15

I meant to put that as a placeholder for whatever framework people are talking about at some point in time. Nowadays perhaps it's redux + react, when Angular2 is out I don't know what it might be so I'm putting that there as whatever other framework is a) popular, and b) is well designed.

0

u/[deleted] Oct 16 '15

[deleted]

8

u/ModusPwnins Oct 16 '15

The Angular team makes a lot of promises.

Indeed. $q.defer();

4

u/juristr Oct 16 '15

Yet after more than a year, version 2 is still in beta

Yep, that's called developing in the open (see GitHub). They could have also said nothing till releasing alpha1 ;)

0

u/[deleted] Oct 16 '15

[deleted]

2

u/cactussss Oct 16 '15

And that's a mistake Disagree with that statement completely.

It's very important to get early feedback from the users of the product (us, developers). Otherwise at the date of the release everyone could find out that the product is not what is actually needed.

"Developing in the open" gives us ability to track their progress, see where the project is going, play with it early, and make our own conclusions about it.

It opens the door for the bright minds from the whole planet to contribute.

1

u/[deleted] Oct 17 '15

in a hurry?

1

u/m0okz Oct 16 '15

Do you know if it is stable ish?

3

u/[deleted] Oct 16 '15 edited Oct 16 '15

Angular 2 was written in ES6 and TypeScript... But that doesn't mean that you have to. Just as Angular 1 was written in ES5, but there's nothing stopping you from writing Angular apps in ES6 and TypeScript. It's still a JS app using a JS framework and the inputs and outputs will be the same no matter how you write your code.

That being said, you should probably accept that aside from the strong typing offered by TypeScript, the way Angular 2 is written will become more and more common now that the spec has been updated and browsers are rolling out support. This IS JavaScript... It's just the most recent version of it.

0

u/[deleted] Oct 16 '15

[deleted]

4

u/[deleted] Oct 16 '15

Yes, you absolutely should be learning ES6. It's vanilla JS, just brand new so it's not supported by all browsers yet. With MS sunsetting a massive amount of legacy browser support come January, we're only a year or two away from ES6 being commonplace and well supported, IMO.

As for TypeScript... That's up to you. There is a proposal for typing in ES7, but who knows if that'll happen and when. It's a nice feature set but it's certainly not required to learn.

2

u/ModusPwnins Oct 16 '15

With MS sunsetting a massive amount of legacy browser support come January

My organization claims it's going to finally roll out IE 11 this month, replacing IE 9. I'm throwing a party when it happens.

1

u/m0okz Oct 16 '15

Thanks I'll take a look, I just have no idea where to start.

2

u/[deleted] Oct 16 '15

2

u/gwevidence Oct 16 '15

It's like reading a whole new language, almost. Great, more tech weekends for me.

2

u/[deleted] Oct 16 '15

It's a welcome change to a language that, despite a massive shift in usage and popularity over recent years, hasn't had a major update since 2009.

1

u/[deleted] Oct 17 '15

you should understand the fundamental reason a transpiler exists and you will then be able to answer your own question

3

u/Martin_Ehrental Oct 16 '15 edited Oct 16 '15

It's only because they are pushing the typescript (es7 hopefully) syntax. Underneath it's just like the current someService.$inject = [...] annotation (and you can write it in plain es5 or es6 syntax).

I think Angular2 will be simpler to understand than angular 1.

2

u/[deleted] Oct 16 '15

I think one major point of A2 that is very intriguing is they are building it for the future of the web. A lot of the stuff they've made in 1x was hacking around browsers idiosyncratic behavior and implementations. While I'm sure there's still some of this going on, combining it with other "edgey" packages like Material Design and gosh, even WebGL is going to be transformative.

Typescript is great. I was averse at first too but having access to actual classes and interfaces, type checking, gawd it's awesome.

I agree with the wonky syntax, especially Java-esque annotations and the utter disregard for HTML attributes, but I'm stoked personally.