I started using it when this app was very much a POC last summer, just as the Angular team was finishing up the 2.0 release.
I learned firsthand last summer the issues with using a framework that was still in the oven: constant updates and some dependency changes. That was no fun for some time.
But I'll say now that it was worth it. (Maybe I should have started a little later, post-2.0 release). But I'm now building out a decent sized and complex application much faster than I'd ever done before.
It is strongly typed, it is modular, and it has dependency injection. Oh and it's strongly typed. I can't emphasize the importance of this enough. I know you can use typescript without Angular, but that the Angular community and the docs are all in typescript make this a typescript-native framework.
I'll never look at JavaScript again if I don't have to. You and your IDE and the rest of your team can know an object's Type without having to scrounge around, it's such a blissful departure from JavaScript.
It definitely has a learning curve. If you're spinning up a simple web app it may or may not be for you. (...though now I use it to spin up simple web apps because I'm used to it and it's so good for that) But for anything complex that is being worked on across a team, I recommend you take the time to learn it.
It's not perfect, nothing is. But it is leagues ahead of any framework I've used on the front end. And having gone to Typescript, I will never use a native JavaScript framework again.
I use VS Code (with the Chrome debugger plugin) and that works like a charm. I don't debug javascript in the browser anymore.
TS provides source mappings to map the compiled javascript back to the source (similar to a .dll's .pdb maybe?).
It took me some time to set up the config file which proved to be a headache (because webpack was screwing with the source maps), but again once that was set up it has been a breeze to debug right in my IDE whenever I want.
Perhaps you can describe the steps you followed? I tried installing the plugin and launching chrome with the debug flag, then setting a breakpoint in vscode. Is there something I am missing there?
Moreover, Flow is pure annotation, which can be removed by Babel. And Flow is also backed by a large company (Facebook instead of Microsoft).
However, if you do want to generate JS, use a language that elminiates runtime errors almost completely, such as Elm or OCaml (through bucklescript or js-of-ocaml).
[1] The following presentation contains some scary examples of incorrect code not rejected by Typescript. I'd rather prefer Flow which errs on beeing too strict: https://djcordhose.github.io/flow-vs-typescript/elm-flow-typ...
Debugging javascript produced by Babel is generally hell in comparison. The transforms done by Babel are not designed to be human readable and they generally aren't.
Only Facebook doesn't care much to back or promote Flow, besides the occasional blog post, whereas Microsoft has created a whole IDE / VS Code support for it, great tooling, documentation, etc.
- Compile time means that it takes more time to debug anything.
- The rigid interfaces mean that I need to spend more time researching how to use various modules/libraries (maybe code completion would offset this problem but this is only possible with a heavy IDE that has intellisense or similar - Not Atom).
- When I want to test something quickly, I often get annoying compile-time errors along the lines of 'code is unreachable...' among others.
- It requires more planning to do anything (since you have to design the interfaces before you can start to implement). This is also not good if you just want to try something quickly and then roll back later.
- Changes to one class/interface tend to have a large cascading effect on other classes/interfaces so it takes more time to make changes to code - This happens with JS too but to a much lesser extent.
- Adds lots of unnecessary dependencies to my project.
- Complicates setup and DevOps tasks, Dockerizing, (E.g. due to version mismatches and thousands of other potential issues) etc...
The reason why I don't like heavy IDEs is because:
- They're slow and clunky (sometimes they freeze for a long time in order to index content)
- The use up a ton of memory.
- They make your team lazy when it comes to structuring your source code into proper folders (since you start to rely more on search features of the IDE to find things).
- They take ages to install.
- Support fewer operating systems.
- Are usually proprietary and difficult to customize.
- More prone to bugs.
- They're slow and clunky Not anything I've used. Eclipse and Visual Studio run nice and smooth on a decent machine.
- The use up a ton of memory. Who cares. Slack and anything based on electron uses hundreds of megabytes. Chrome regularly uses gigs. Most of the IDE's I use take less than 500 megabytes of ram, even phones have plenty.
- They make your team lazy when it comes to structuring your source code into proper folders Absolutely not. Your reasoning is that making things easier = making code worse. The IDE you use has nothing to do with your dev culture
- They take ages to install. Some of them do, notably Visual Studio. All the other ones I've used just take a few minutes. Also, who cares??? You only have to install it once, what is 5 minutes for an app you're going to use for thousands of hours???
- Support fewer operating systems. No. IDE's based on java run on almost anything. Again I think you're speaking from the experience of using visual studio.
- Are usually proprietary and difficult to customize. Also no. Every IDE I've used supports plugins and an unholy amount of configuration options. Every IDE I use is open source, again except visual studio.
- More prone to bugs. What? Why? How?
Why, otherwise you'd just throw random parameters in a module's functions and see what sticks?
>Compile time means that it takes more time to debug anything.
Most people compile their JS anyway, TS or not, with Babel et al.
>maybe code completion would offset this problem but this is only possible with a heavy IDE that has intellisense or similar - Not Atom
VS Code has code completion for TS and is similar to Atom. And even Sublime Text has code completion for TS (based on tools MS itself provides for "intellisense" style predictions).
>- It requires more planning to do anything (since you have to design the interfaces before you can start to implement). This is also not good if you just want to try something quickly and then roll back later
Doesn't make any sense. It's not as if you don't need to know the interfaces before you start to implement with regular js. Only there you need to hunt for the documentation to tell you what's expected to pass -- instead of seeing what the types are directly (e.g. with intellisense).
>- Changes to one class/interface tend to have a large cascading effect on other classes/interfaces so it takes more time to make changes to code - This happens with JS too but to a much lesser extent.
It happens to the exact same extend in JS. Only with TS you are shown where the problems are automatically, with JS you have to hunt those places or discover it at runtime.
The rest goes downhill...
Since you can pretty much type javascript in to a TS file and it will work I don't see this being valid.
Also planning is good, if your not thinking about the structure of your code (which does not take that long) then your just producing diarrhea.
how can this be an issue? even javascript needs to be concated minified and whatever to take it into production. it's not like that any human writes minified and mangled javascript with direct gzip.
P.S.: I'm not a fan of TypeScript. But to say you need to compile it, is just an excuse.
Though it's just as easy to use a good IDE's build button (VSCode Ctrl+Shift+B for instance) or TS works well as a watch process that watches for saves and compiles them when you save.
That's the idea. You think about what you're going to write in a strongly typed language rather than just throwing stuff at the wall hoping that something will stick.
> - The rigid interfaces mean that I need to spend more time researching how to use various modules/libraries
I don't understand this. In one case you have an API where the types of all the functions is available, so you can see almost right away how to use it. In the other case you have to rely on someone providing you really good documentation OR you read the implementation.
> - Changes to one class/interface tend to have a large cascading effect on other classes/interfaces so it takes more time to make changes to code - This happens with JS too but to a much lesser extent.
It's either you find the error at compile time or at run time. Don't kid yourself, there's a 'cascading effect' in both typed and untyped codebases, just in the typed one the compiler will help you find errors.
Granted, I'm not the biggest TS fan, I'd take Elm or Purescript, or even Flow. But your gripes seem to be directed to typed languages in general.
> That's the idea. You think about what you're going to write in a strongly typed language rather than just throwing stuff at the wall hoping that something will stick.
I think this is a valid point for developers who only have a few years of experience but I've been coding professionally for over a decade now - I don't need the compiler to artificially slow me down - I'd rather spend my mental energy thinking about the algorithm/architecture in its purest form without getting caught up in trying to satisfy the compiler's tedious requirements.
For me programming in a typed language is like using software that always asks you "are you sure you want to do this?" every time you tell it to do something. It's OK if you're a beginner, but I just find it frustrating.
I spent many years programming in ActionScript 3 and then Java so I feel like I've given typed languages a fair shot.
It's slowing you down because you've written code with errors. Those type errors are still in your dynamic code, you just can't see them.
> I spent many years programming in ActionScript 3 and then Java so I feel like I've given typed languages a fair shot.
I don't think you have, you've missed many wonderful modern type system features.
Algebraic types, for one, aren't present in either of those languages and are massively useful, replacing 'null' (with a type like Option/Maybe) and exceptions (with a Result/Either concept) in many languages that have them.
Not to mention, with a language that has type inference, you don't even have to write the type in many cases, and yet you keep the guarantees of a strongly typed language.
You'd be surprised.
There's a reason that developers after decades of dynamic languages turn increasingly to types (of which Flow and TS are examples in the JS world).
Obviously, to each his own.
I'd encourage you try Typescript again though. Your given reason doesn't make much sense. Regardless of whether the language is strongly typed or weakly typed, you still need to use modules and libraries correctly. "Not having to research" means you're just going to end up throwing data at a library without knowing what it's expecting. The research has to happen in both scenarios, but with typed languages it's easier. The research is just in the code already. (Try VS Code, not a "heavy" IDE by any means, but it has native support for TS code completion.)
If I have any modular interface, you need to know what to pass me. If you're receiving data from me, you need to know the structure of what I'm sending back to you.
In a weakly typed language, you can guess at what data structure I'm going to want. You can fish around in my returned data for what you're looking for with no guarantees. You have to look for docs, which may or may not be up to date.
But in a strongly typed language, the code is the doc. You and I and your IDE and my IDE are all on the same page. And the docs are always up to date. You can't pass me data that I'm not expecting and you always know how to access the data I'm returning to you.
Vue has HTML templates like Angular and virtual DOM like React. It is faster than both of them. It has a smaller file size than both of them. It has a clever single file component concept that makes developing components much easier. It uses a one-way data flow concept like React+Flux. Vue even has it's own competitor to redux/mobX called Vuex, and what makes it easier is that Vue is cognizant of Vuex's existence. There are really solid dev tools for Chrome as well (Vue and Vuex are aware of the dev tools as well).
I run a dev meetup, and I had planned to give a talk there on Angular 2. I even gave talks on JS tooling a year ago and TS last summer in preparation. Instead, I gave a talk on Vue this month, and people loved it. Here are the slides if you want to check it out (there are even embedded Vue apps!): https://azurelogic.github.io/vue-js-2.x-talk/#/
to each their own, of course.
I don't care about templates being "bad" a as long as it works for us. I'm sold.
Other than that, this looks awesome. Time to develop a todo app.
To not have HTML templates means you need to do something more invasive to retrofit client-side templating into place. It's personally why I don't bother with libraries that don't offer similar, because I don't always have total control over what I am working on and I still need to get work done.
I love Vue.js too, but just for small projects or when I need to add some complex functionality to an existing site that is not SPA.
I guess it comes down with the saying "the right tool for the job".
That's just FUD, there is nothing in Angular that makes it more oriented toward Enterprise than Vue.js, unless you consider bloat an necessary component of any enterprise oriented solution, which is obviously a lie. What will decide which framework is "enterprise" is the ecosystem, the amount of widgets, not the bloat.
> I guess it comes down with the saying "the right tool for the job".
Exactly, the right tool for the job, AKA using a library that does only what it should do instead of trying to be anything and everything because its creators think the complex it looks, the more enterprisey it sounds. They will learn the hard way, and so will you.
The concept of modules and dependency injection was nice before we had any sort of module systems, but at this point it's essentially entirely busy work, given tools like proxyquire when testing.
Template compilation errors are a nice step up from 1, but those that I've seen have been very misleading and have been the cause of wasted hours debugging.
Angular 2 makes extensive use of the Reflection API for metadata, which combined with the fact that angular-cli is hard-coded to perform static analysis (even if you disable AOT) is another pain point. I'm trying to build the equivalent to "react storybook" for our platform, and it's taken me about 3x the time it would have with React.
With all of that said, if you need a "think-inside-the-box" tool for a large, decentralized dev team, angular can win out- there are fewer places to look for documentation, which will be nice when angulars documentation improves.
I actually find that React better encourages smaller, cleaner components with fewer responsibilities, but that's also likely due to being very familiar with the redux paradigm.
Finally, if you want very flexible components, react wins hands down, because components can be used as properties to other components; dynamically rendering components in angular has always had an inversion of control issue.
That's been my experience; ymmv.
It was released 5 months ago.
I probably won't ever use Angular unless I find myself desperate for work and can't find anything else. The problem I see inherent in frameworks is that they are all dogmatic about their opinions, and thus criticism of frameworks often do boil down to "I don't agree with their opinion", sometimes with rationalizations mixed in.
Preferences aside, Angular is objectively one of, if not the most, heaviest frameworks for web front-ends. It is not just a matter of bandwidth to the end user, but also a lot of magic under the hood that developers have to deal with. Consider the Java mindset that may have inspired Angular, people don't want to deal with that level of verbosity and enterprise mentality.
Unfortunately, there are increasingly few employment options if you want to use anything other than React or Angular. So rather than framing this argument in terms of framework hate, consider it a problem that lots of developers are forced to use these frameworks in order to be more like easily replaceable cogs in a machine, or be unemployed.
For me, the real problems in web app development are
1. State management
2. Side effects
3. View layer performance
Angular pales by comparison to things like React+Redux which were born out of necessity, and as such, tackle those issues with laser like focus.
Angular doesn't feel like it was born out of necessity, but out of some desire to just build a framework. As such, it's complicated and magical feels clumsy by comparison.
When combined with things like Immutable, Sagas, and ReSelect, the Redux/React style of architecture (feel free to swap out Redux or React for whatever you prefer) is so much more practical and useful compared to Angular.
I don't know what it is that makes Angular popular with back end developers, but they seem to be Angular's biggest supporters. I consider my self full stack, but front end first, and I've noticed that people like me tend to favour libraries over frameworks. There's obviously something that is informing each groups opinions on this matter, but I don't know what it is.
You can use all that with angular 2. I am.
Redux -> @ngrx/store
Immutable -> same
Sagas -> @ngrx/effects
ReSelect -> same
Example here: https://github.com/ngrx/example-app
The react apps I've worked on have been much more successful; we haven't had to throw the whole thing away (unlike one of those angular ones...)
I'm sure other people have had other experiences, but after two terrible experiences, the questions I would ask are:
- Why would I bother looking at angular again?
- What has significantly changed in the last year to reduce the complexity, increase the component ecosystem or increase the quality and quantity of the documentation?
If you can't answer either of those with meaningful answers, I don't see any reason, given the other alternatives to angular that are around, to try using it again.
That being said, Angular is still a valid option (haven't tried Angular 2, but from what I've read it's a nice upgrade over Angular 1). I'd still take React any day of the week over it, just for the simplicity it brings. Of course there are other drawbacks to using it, but nothing's perfect.
The most funny thing probably is the typescript sale pitch (I use and like typescript) where you actually don't beneficiate from typescript at all with half of angular (string templates means no type checking or intelliSense on component names, model properties, component apis, etc)
It's also pretty fat and not exactly performant. It's simply a no-no on mobile. Its niche use case seems to be backend developers who know OO well, FP not so much, developing low/average quality back-office apps quickly without having to care about what's going on behind the scene.
The angular core devs always favor magic and shortcuts over simplicity. Its API surface is enormous, so have fun keeping up with the versions. It's optimized to get started quickly and be decently productive as long as you only use the core directives.
It's not terrible, but it's just not good if you care about the UX and maintainability of your app.
SomeClass.SomeDep = MockDep;
In other words, inject through static properties. I do this with normal classes to test models and the like with no issues. No DI container necessary.Ng2 felt too different. Ng1 to Ng2 made me look outside and there was React gaining ground - perfect timing. In its original state React is so much simpler than Angular. But then React with just the basics can make you create bad code - that's what happened to me. React with best practices - is hard to digest.
So I went back to Ng2 - soon enough I was craving to go back to React. Suddenly I started hating Angular2 (but loved TypeScript).
I spent time learning React best practices - that require some patience. But one thing I brought on from Ng2 was TypeScript. TS makes you a lot more productive. Now React and TS is not a widely accepted combination - but its very productive as your app grows.
There's something about it -- feels clean and minimal, works really well with my ruby- and rails- influenced mind, organizes my thinking about an app and makes it easy to have things in their right places, at a correct level of abstraction, effortlessly.
My reaction after encountering vuejs was one of relief -- finally seeing an option I resonate with, a vision driven by someone whose thinking is aligned with my desire to avoid confusion, complexity and frustration.
The free screencasts at laracasts and egghead.io are quick and fantastic.
1.X felt messy, but writing web apps in Angular > 2 feels really clean when done right.
Disclaimer: It's a commercial product and I'm the lead developer.
It does not 'feel' heavyweight or that it gets in my way too much, but the contrary is true. Of course, it has it`s quirks, as every larger lib have, but it`s pluses outweigh minuses by far for me.
Preferences aside, does Angular make you less productive than other options? Do you feel that you fight the framework? Can you finish non trivial frontend apps, involving 5+ team members, 'better', with cleaner code and much faster with other options?
This are just honest questions. I wanted to start some pet project in angular2 soon, but would listen to alternatives, maybe it is a right moment to try some of them.