5 ms·
I'm quite disappointed by this presentation, I see only new syntax everywhere for approximately zero benefit. There is not even any mention to the Object.obser
by realusername 12y ago
I'm quite disappointed by this presentation, I see only new syntax everywhere for approximately zero benefit.
There is not even any mention to the Object.observe integration which would be the most exiting feature to improve Angular apps.
Angular looks and feels now like a Java framework, with ugly decorators and bloated APIs, that's really sad...
- kuni-toko-tachi 12y agoAgree 100%. Things like dependency injectors have no real place in JavaScript, where programmatic wiring and modules already solve the problem in an idiomatic way. Angulars modules factories services etc are absurd and attempt to reinvent what the language naturally provides.
- Bahamut 12y agoIt isn't quite a solved problem in the regular ecosystem. Currently importation is rigid - you end up testing the functionality of what you are importing instead of purely the logic of your modules. The tests are polluted with logic that really tests both the details of how an api provided by another library functions under the hood. DI is the solution to that. It has every place in a language like JS, and I am excited with having it available.
- nilliams 12y ago>> where programmatic wiring and modules already solve the problem in an idiomatic way Can't agree with that. Not sure what you mean by 'programmatic wiring' as it sounds vague, but certainly modules do not solve the same problem that DI solves. Modules, (assuming you mean stuff you require() or equivalent), provide module-level dependencies but do not provide object instances. For example, if an instance of House requires a Door it is not enough to just require('Door'). You still have to do the equivalent of `new Door()` in your House module to get an instance. By doing so within the House module you just tightly coupled House to Door (your House now knows how to create Doors). DI allows you to provide an object with object instances it depends on without tightly coupling said object to those dependencies (pass a Door instance into a House instance, advantage being you can pass in any type of Door and House doesn't need to care - thanks polymorphism)! I'm not sure that's a great explanation, but it's worth trying every now and then right? You seem to be making the argument that the language provides alternatives, and it's true that in dynamic languages you can eschew some of the benefits of DI by doing monkey patching instead (e.g. to mock out an object's 'tightly coupled' dependencies during testing), but to myself and many OOP proponents DI leads to cleaner design and simpler tests.
- kyllo 12y agoFor example, if an instance of House requires a Door it is not enough to just require('Door'). You still have to do the equivalent of `new Door()` in your House module to get an instance. By doing so within the House module you just tightly coupled House to Door (your House now knows how to create Doors). So what? What is so bad about House and Door being "tightly coupled"? Here's a House constructor that can take any kind of Door instance: function House(door){ this.door = door; } This is JavaScript, let's stop trying to make it into Java.
- nilliams 12y agoWhat you just wrote as a code example is Dependency Injection, it's just manual dependency injection as opposed to using an IOC container or any of the mechanisms Angular provides. I am very much in favour of the approach you posted. That's exactly how I write my code (I don't currently use Angular), but yep ... that's DI. As James Shore said 'Dependency Injection is a 25-dollar term for a 5-cent concept'. [1]. What you show in that code example is what in my head I call "poor man's DI" or ... "passing stuff in" but it's actually my favourite kind as it demonstrates the fundamental idea and is easy to explain to people - as soon as you start talking about IOC and service providers things start to get murkier. I think that's definitely where Angular is losing some people. You can get a long way with the basic "poor man's" approach. [1] http://www.jamesshore.com/Blog/Dependency-Injection-Demystified.html http://www.jamesshore.com/Blog/Dependency-Injection-Demystif...
- fetbaffe 12y agoI remember the first time I heard the term Dependency Injection. I sounded really advanced and I felt like a fool not knowing about. Like have been living under a rock for last years. When I realized it was "passing stuff in" I wanted to shout, I have done that for years!
- coldtea 12y ago>When I realized it was "passing stuff in" I wanted to shout, I have done that for years! Well, it's the "automatic" part that is important, not just the DI.
- andybak 12y agoThe topic of DI and/or IOC in dynamic languages is an interesting one. I've seen a similar debate play out in the Python world and the debate seems to polarize into two camps: "You have never built anything complex enough and therefore you don't understand the benefits of DI/IOC" vs. "You've come to a dynamic language from some verbose public static void main hell-hole and are suffering from some form of Stockholm Syndrome"
- rdsubhas 12y agoCame here to say this. In the last slide, when they were piling "RIP Directives", "RIP DI", "RIP Modules", etc., the only thing I had in mind was "RIP Angular". Very disappointing.
- GhotiFish 12y agoReally? Because I found angular to be highly convoluted in practice (and I have implemented it in practice). Most of my team eventually settled on the conclusion that "the cognitive load of working through the implications of how these nested directives play out in an application is simply not worth it". Or something to that effect. We all studied angular studiously, we all did our best to implement it in an effective and sound manner, and when things went wrong, and they always go wrong, the shear complexity of the framework tied our hands and forced us to do some very ugly hacks. I look at our application as it stands, and I regret using angular. If angular 2 is simplifying it's framework, the only thing I have to say to that is "Thank god, maybe I'll try it again"
- zghst 12y agoEver since reading Angular 2's goals, I put 2 and 2 together, the API was definitely going to have to change massively to accommodate ES6. I'm sure they're using Object.observe it just wasn't mentioned in the presentation.
- spion 12y agoThis is not even ES6, its some weird abomination (AtScript) on top of ES6. We definitely wont be switching to Angular 2.0. Hello React.
- zghst 12y agoWhile terribly written and in poor format, it has some semblance to ES6.
- Cthulhu_ 12y agoI like how a lot of people see React as a full-on alternative to AngularJS. It's not, React is just for the view (think jQuery), you'll need other components or a lot of manual work to build a full application with React.
- lowboy 12y ago> React is just for the view (think jQuery) That is comparing apples to oranges. I agree that React is a view layer, but jQuery is most definitely not. The only thing they have in common is that they (usually) act on the DOM in some way. Agreed on your point about needing other components/architecture to use React.
- zghst 12y agoReact's V and Angular's V aren't entirely compatible, in fact it's be nasty to use them together. Sure it's not a full alternative, but I believe when people are saying React, they are inferring that they will be using Flux with React (Or Backbone, Knockout, etc). React can be much more than just a view. Even before integrating Flux or a lightweight library, React can be powerful.
- 12y ago