4 ms·
It's very nice for people to be able to just write code that appears to magically work, without any extra noise. Unfortunately, it isn't always so nice for the
by Silhouette 13y ago
It's very nice for people to be able to just write code that appears to magically work, without any extra noise.
Unfortunately, it isn't always so nice for the guy who has to read it three years later and figure out what's going on. Sometimes there is a fine line between useful tools that reduce boilerplate and leaky abstractions that hide important details you're often going to need anyway. I suspect some of the features in Angular today will prove to be on the wrong side of that line, though to be fair it's hardly the only JS framework from the recent crop where that concern applies.
- caitp 13y agoThe 1.x injector is not a very difficult pattern to understand, so if you're working with Angular you should pick up on it quickly. However, for production apps, you're probably not using "magic" function annotation, at least not without the help of ngmin or a similar tool. It's just a nice way to quickly write demonstrations and explain code. Arguably, the explicit annotations would not really inform you any better than implicit annotation, if you were unfamiliar with the framework. So, I agree that explicit annotation is important, but I think the "magic" annotation also makes the framework a bit more accessible to new comers, and is also very handy for producing small demos, reproductions, or other small apps. The fact that we can offer the choice here is great. A little bit of experience with the framework and all this stuff becomes pretty much second nature. I expect Ember or Knockout would be similar in that regard. Basically, 1) understand the fundamentals of your framework. 2) use the right tools/methods for the right job. You can certainly write maintainable and understandable apps using all of the annotation styles. At least, in my opinion.