News for hackers. Stuff that matters.
Re:Learn AngularJS by jhall1468 on Friday April 03, 2015 @11:14AM (#9316318)
Your latter two points are odd since they are directed at Angular when they can be used to describe literally every frontend framework ever created. The third point, in particular, is fundamentally what a framework does... it does some "magic" in the background to prevent you from HAVING to understand what's going on in the background.

The second point is one of the tired pieces of non-sense that seems to never go away. Their was NOTHING wrong with the Angular 1.x approach to web development, because it started some time before the initial release in 2009.

A proper warning for anyone learning AngularJS should be a warning for any frontend framework:

* Much of the code abstracts away the DOM and some Javscript nuances, so don't expect learning a front-end framework to be the same as learning JS (In the same way that learning Rails is not learning Ruby).

* All client-side frameworks take somewhat different approaches, and often use new terminology to explain that approach. This does not necessarily translate from one framework to another, but can.

* Angular 2, an in-development long-term replacement for Angular 1 uses a very different approach to development, and will not translate well from 1.x to 2.x. However, Angular 2 is a modern-browser only framework, and the 1.x will be developed for the foreseeable future.

Re:Learn AngularJS by lhorie on Friday April 03, 2015 @11:36AM (#9316431)
> Your latter two points are odd since they are directed at Angular when they can be used to describe literally every frontend framework ever created.

I disagree. There are abstractions whose knowledge is easily transferable (e.g. promises, looping through a list of DOM elements), and abstractions that are not (e.g. directives/transclusion/$compile/etc). Angular is notorious (and has received a lot of flak) for having a lot of the latter, so I think the non-portability/magic warnings are warranted.

Re:Learn AngularJS by debaserab2 on Friday April 03, 2015 @12:26PM (#9316758)
When have you ever picked up code that was written as an integral part of an application using a framework (not just a library) and dropped it into another completely different one without a fair amount of re-work?
Re:Learn AngularJS by lhorie on Friday April 03, 2015 @12:57PM (#9316958)
Code and knowledge are two different things.

Unless you're using highly well-established APIs (such as promises), then of course, you'll have to rewrite things to match the new expected syntax.

Portability of knowledge is a different beast. For example, the vast majority of ng-repeat related concepts is completely non-portable (think `ng-repeat-start`, `track by`, `(x, y) in foo`, `$index`, etc). You learn that `ng-repeat="x in foo | filter: bar"` is equivalent to a for loop that displays only some items, but you can't really apply that knowledge anywhere outside of Angular.

You can't reuse your basic knowledge of for loops and if statements coming into Angular, and you can't use your knowledge about the pipe syntax anywhere else when you leave Angular.

In contrast, a framework that employs `.map` and `.filter` might teach you a bit about FP, and this is something you can use in Angular, Ember, React, and even vanilla js.

Re:Learn AngularJS by jhall1468 on Friday April 03, 2015 @02:37PM (#9317568)
You are moving goal posts.

You are arguing that syntax equals mobility which is incorrect. .map and .filter can have different syntax depending on the language, just as ng-repeat (the equivalent to a for loop) has a different syntax than a for loop in Perl.

Knowledge and syntax are two different things as well.

Re:Learn AngularJS by lhorie on Friday April 03, 2015 @03:53PM (#9318007)
> You are arguing that syntax equals mobility which is incorrect

No, I'm saying that the knowledge of the concepts of map and filter (as an example) is easily transferable even if syntax isn't. Once you understand those concepts, you can go look up the Ruby/Haskell/whatever syntax and you can reuse your new knowledge of higher order functions, and maybe learn about transducers, or maybe you can go look into point-free style, and the testability benefits of pure functions vs procedural style, etc, etc, etc. Not to mention that by knowing `.map`, you already know a great deal about the template languages for React, Mithril and Mercury.

In contrast, say I've learned about pipe operator precedence in ng-repeat expression clauses. Now I know I can write `x in (foo = (bar | filter: baz))` to memoize a filtered list for use later in that template. But only in Angular template expressions. But not in Javascript. Or Ruby. Or Haskell. And it's a terrible idiom to use in Angular anyways because [insert long rant about a bunch of unrelated topics].

Aside from the knowledge that operators can be recursively composed into god-awful expressions, what part of all that is useful if I migrate to Ember?

Or, say I learn about directives, and transclusion and the ngModel attribute micro language, and $compile and priority and the ngModelController API and ...

These are most certainly not syntax-related concepts. What does learning that get me?

Re:Learn AngularJS by Bahamut on Friday April 03, 2015 @02:57PM (#9317699)
That is a fairly edge/small point - using something like `.map` and `.filter` to generate the DOM itself is pretty ugly, and those functions quickly become useful in other contexts.
Re:Learn AngularJS by deckiedan on Friday April 03, 2015 @11:08PM (#9319754)
Check out Mithril: http://lhorie.github.io/mithril/ Using the regular syntax isn't actually that bad. It's unusual, certainly, but compared to HTML (when you actually think about it, rather than just say, "It's different and I don't like it"), it's alright.

Also, as a framework, it's got a lot less magic than Angular, and lets you write javascript code that's much more like normal JS code than angular does. (IMHO).

Also, the articles by the Mithril main author about JS & development philosophy are really good. I really like his style and approach to front-end development.

Re:Learn AngularJS by blooberr on Saturday April 04, 2015 @12:17AM (#9319881)
I'm curious... Any major websites using Mithril in production?
Re:Learn AngularJS by lhorie on Monday April 06, 2015 @09:30AM (#9327960)
Guild wars 2 uses it for its marketplace interface.

lichess.org is another relatively large project that uses it (I mention this one because it's also open source)

Re:Learn AngularJS by hippich on Friday April 03, 2015 @12:31PM (#9316794)
Short answer - more often, than I could do it with angular code :) This is personal anecdote of course.
Re:Learn AngularJS by jhall1468 on Friday April 03, 2015 @02:40PM (#9317588)
What's the long answer? I think it's laughable to say that you can take a part of a monolithic framework and drop it in as a replacement in a different framework.

Actually a short answer will do fine. Ignoring Backbone, name ONE part of a major framework you can do that with?

Re:Learn AngularJS by hippich on Friday April 03, 2015 @03:07PM (#9317748)
very short answer - backbone.

longer answer - there is rarely drop in replacement, but when framework uses other well designed technologies, instead of reinventing the wheel, knowledge about these technologies way more useful, than knowing details and gotchas of $digest loop.

Examples:

* handlebars templates used in many frameworks. Quite often you can literally copy templates over into new project.

* usage of real promises allows you to use chai async tests without looking back at framework, instead of relying on right timing of firing $apply() (and making sure to not call it twice!)

* not relying on dirty-checking, and instead use setters/getters quite often forces you to think and isolate model code from glue.

* describing state via html (as it is proposed with ui.router - very popular component) can not be easily migrated at all, since most of frameworks define state in code and/or configs. This is paradigm shift.

While I agree, the bigger framework, harder it gets to write portable code, but angular in practice tends to make it even harder in my experience.

Re:Learn AngularJS by jhall1468 on Friday April 03, 2015 @03:30PM (#9317879)
So basically, your problem is you like to pick and choose modular pieces from non monolithic frameworks and "Angular sucks" because it doesn't do what you like.

There's nothing wrong with Backbone, particularly when you like to replace parts with other parts. But Angular is not bad simply because modularity wasn't a design goal.

It's notable that your arguments aren't arguments against Angular persay but against every single non-modular framework ever made.

I don't mind people disliking Angular. I mind it when people pretend their preconceived notions about software design are "right" and software that doesn't align with their notions are "wrong".

Re:Learn AngularJS by hippich on Friday April 03, 2015 @04:16PM (#9318198)
I don't like when I can't replace broken part of framework. And this is often the case with angular. Mostly because of foundation it is built on - dirty checking and it's own dependency injection mechanism. Because of these two there are a lot of things backwards. dirty checking is major cause of whole $digest loop, as well as every async function being mirrored via $-equivalent and non working promises. This cruft accumulates over time and wastes a lot of human resources.

The only reason you might not dislike angular is if you never had to deal with issues above OR you never had different experience, sorry.

Re:Learn AngularJS by jhall1468 on Friday April 03, 2015 @06:26PM (#9318963)
Like I said, that's a ton of opinion based entirely on YOUR desire to replace parts YOU don't like. Dirty checking isn't perfect (by any stretch) but it's not the worst thing to happen since the cold war either.

The bottom line seems to be that your bad experience is relevant while all good experiences are irrelevant because they weren't your bad experience.

That tells me you simply don't know how to use it, sorry.

Re:Learn AngularJS by radicalbyte on Friday April 03, 2015 @01:45PM (#9317262)
A number of times: but the code was heavy on business logic, which was factored into a domain model. The UI code was simple, it was broadly mapping domain concepts (states etc) to UI concepts (colors, visibility of various elements).
Re:Learn AngularJS by hippich on Friday April 03, 2015 @11:59AM (#9316591)
There are different "level" frameworks are out there. Ember/Knockout/Angular gives you a lot of magic. Backbone - not so much.

Most concepts in Angular came from Spring Java (server-side, one request at a time,) which is absolutely unique to client-side frameworks world at this time. Reason behind this is very likely that Misko himself was server-side engineer at Sun before coming up with Angular, and he invented framework without working with other client-side frameworks, so he could not learn from their mistakes. So these specifics are not transferable to other client-side framework. Moreover - this knowledge likely will not be transferable to Angular 2.x too.

Re:Learn AngularJS by tegeek on Friday April 03, 2015 @05:15PM (#9318591)
You are completely wrong on your assumption when you are linking AngularJS's origin to Server-Side Java.

Most of concepts in AngularJS directly came from Silverlight and WPF. Before even Angular came into existence, I used to use the same pattern for building Windows/Browser centric client side apps on WPF/Silverlight. When AngularJS announced in 2009, it took me 30 minutes to get my head around everything & there has not been much changes since then.

The only thing AngularJS invented was Dependency Injection for JS.

Re:Learn AngularJS by hippich on Friday April 03, 2015 @10:08PM (#9319618)
If memory serve me well, WPF and Silverlight were brought around 2007-2008 by microsoft. Angular was released around 2009. Spring Framework in 2002. Misko was Sun employee and worked with Spring a lot and mentioned it a lot. I did not find any reference to silverlight and or wpf in his talks/posts so far.

Next - I am not saying that idea of applying server-side mvc patterns as-is is unique, it is certainly not - your example of wpf and silverlight are good examples. Also, probably, reason why these did not stick well outside corporate environment, where decisions are made by managers and not people actually having to deal with it.

If you have solid source explaining origin of angular - i will be happy to be corrected, but from everything i read so far to understand better motivation behind sometimes very questionable decisions I always find similarities between sun/java/spring.

Re:Learn AngularJS by pcthrowaway on Saturday April 04, 2015 @02:27AM (#9320145)
In the process of learning Backbone using Addy Osmani's excellent guide (http://addyosmani.github.io/backbone-fundamentals/) as well as reading the heavily annotated Backbone source code (http://backbonejs.org/docs/backbone.html), I've learned a lot about javascript, the problems SPA frameworks have to solve, common patterns for solving those problems, and how they can be implemented. Before backbone, I tried my hand at angular and stopped when I realized the only understanding I was going to gain by learning Angular was how to use Angular. It's a very different kind of beast.
Re:Learn AngularJS by cw0 on Saturday April 04, 2015 @03:07AM (#9320225)
I previously had no interest in Backbone but those are absolutely amazing learning resources.
Re:Learn AngularJS by randomdrake on Friday April 03, 2015 @12:20PM (#9316714)
> Your latter two points are odd since they are directed at Angular when they can be used to describe literally every frontend framework ever created.

I'm going to wager you haven't used, or are even aware of, "literally every frontend framework ever created," so we can agree you're being hyperbolic.

There are plenty of front end frameworks that utilize JS, HTML, and little else, without introducing "magic" or vocabulary that isn't applicable. I agree with the OP that Angular, in particular, has a great deal of vocabulary to learn and a lot of things that are only applicable in the Angular world. This is one of the main reasons that I, and many other folks, have not spent much time with it.

> The third point, in particular, is fundamentally what a framework does... it does some "magic" in the background to prevent you from HAVING to understand what's going on in the background.

Just because you don't take the time to understand what's going on the background, doesn't mean the framework is "preventing" you from you having to understand what's going on in the background. Au contraire, we hear stories over and over about how the "magic" introduced by a framework caused issues that actually required knowledge of what's going on in the background. This isn't the fault of the framework, or the goal of the framework, it's a fundamental part of software development.

For what it's worth, you're contradicting yourself by saying that "literally every framework ever created" applies to the OP's points, yet concede in your own point that "This does not necessarily translate from one framework to another, but can."

Frameworks get in your way only as much as you let them. The underlying technologies are still there.

> In the same way that learning Rails is not learning Ruby

Learning Rails is a perfectly fine way to be introduced to Ruby. You're learning syntax, constructs, philosophies, and you can break out of Rails and do things with Ruby at any time. I mean, what do you think you're writing Rails code in?

When learning to counter an argument, its best if you don't reiterate all of the points they made in some other way. You basically repeated all of their points, but I don't know if you're aware of it.

OP:

> This is Angular 1.x course. Angular 2, which is in the development right now, totally different.

Your point:

> Angular 2, an in-development long-term replacement for Angular 1 uses a very different approach to development, and will not translate well from 1.x to 2.x

OP:

> Much of the code abstracts away the DOM and some Javscript nuances, so don't expect learning a front-end framework to be the same as learning JS

Your point:

> Knowledge you learn from using Angular is unlikely to be applicable to any other client-side framework, as original creators invented many new terminology as well as their approach to many things is unique

OP:

> A lot of "magic" will prevent you from understanding what is really going on behind scene.

Your point:

> Much of the code abstracts away the DOM and some Javscript nuances, so don't expect learning a front-end framework to be the same as learning JS

I'd be interested to hear some valid counterpoints to the OP, since I tend to agree with them, but these don't appear to be them.

Re:Learn AngularJS by jhall1468 on Friday April 03, 2015 @02:31PM (#9317532)
> I'm going to wager you haven't used, or are even aware of, "literally every frontend framework ever created," so we can agree you're being hyperbolic.

The definition of a framework is abstraction. That's not hyperbole, that's fact. Frankly abstraction is programming since all programming languages are is an abstraction of machine code.

I'm not going to bother responding to you point to point, since I made valid counterpoints that you are hardly qualified to dictate as "not valid". The OP's post was opinionated half-truths designed to be pissy about Angular because that's what the Cool Kids(TM) do these days. It's gotten boring...

But hey, it won't be but a moment before more boring people have more boring complaints about React. Naivety has no end.

Re:Learn AngularJS by hippich on Friday April 03, 2015 @03:10PM (#9317762)
It is funny how you bring up another "Cool Kids" tech aka react.js, which is not even comparable to angular's scope in the first place. React at best is abstraction on view layer. And over engineered one, btw. If you want to have separate view layer with little binding boilerplate I personally recommend checking ractive.js (this is only view part! not a full framework, so don't try to compare it to angular)

Also it is not "Cool Kids" thing, it is personal observation how backwards some angular solutions are from working for a year on large team and large angular project and reading ALOT on all possible best practices.

Re:Learn AngularJS by jhall1468 on Friday April 03, 2015 @03:40PM (#9317937)
You miss the point. The Cool Kids comments was about how it's become fashionable to talk down about every new framework, UI library or whatever that becomes "big" because something 12 people use is OBVIOUSLY so much better.

To me much of this "this is better because this" is a lack of understanding your tool and/or personal bias leaking into the design decision for a piece of software.

I like Angular for what it is and using it on a year long project with a large team on a large project suggests that your decision makers did virtually NO research on what Angular excels at.

The problem (judging based on your small comment history on this thread) suggests that Angular isn't a problem, it's that EVERYTHING is over-engineered if it's not modular. And while I appreciate the modular approach having many benefits over non-modular frameworks, pretending that it's "The Only Way" is just as silly as pretending Angular is the answer for everything.

Re:Learn AngularJS by hippich on Friday April 03, 2015 @04:22PM (#9318247)
As i mentioned in other reply, you are wrong about reasons I dislike angular and why I can not recommend it to newcomers. Reason is - incorrect foundation of the whole framework, the rest is just consequences of it. Angular 2.x might change whole picture, but, again, it will be totally different beast. To the point that I am not sure it is reasonable to call it angular anymore, except for marketing purposes.

In fact if you spend a bit of time to see where from creator came, you understand why he did what he did. Also, if you had experience with server-side mvc frameworks you find all these concept very familiar. Also, if you built any type of complex client-side application, you will find, that server-side MVC concepts, based on single request = single response are not appropriate for long living client-side apps.

Sorry, there is just lack of perspective on your side and there is not much we can argue about.

Re:Learn AngularJS by ssmoot on Friday April 03, 2015 @02:59PM (#9317708)
> "The definition of a framework is abstraction."

It's actually "a basic structure". Which seems to work much better. Your definition would make this:

  trait Storage {
    def put(path: String)(bytes: TraversableOnce[Byte]): Unit

    def get(path: String): TraversableOnce[Byte]

    def rm(path: String): Unit
  }
A Framework. Which is obviously wrong.

Reusing a basic structure to short circuit some engineering tasks and hopefully accelerate the development of others. That's a Framework.

Re:Learn AngularJS by jhall1468 on Friday April 03, 2015 @03:32PM (#9317893)
You do understand the difference between oversimplification and being wrong, yes?

But the funny part:

"Reusing a basic structure to short circuit some engineering tasks"

So, you mean abstracting away some difficult task?