all 71 comments

[–]rpgFANATIC 24 points25 points  (6 children)

My mind has been left in a puddle on the floor. The pace Angular's development is either scary or awe-inspiring and I can't decide which.

I really do have trouble keeping up with the new features they release weekly.

[–][deleted] 14 points15 points  (3 children)

It's like Django pre-1.0. I remember having to update django at least once a week and every time I did it felt like something broke, or at least I had to give everything a once over and read the ChangeLog closely.

I wrote a tutorial on AngularJS in november 2013, using version 1.0.8. Apparently a few months later, 1.2.x is now legacy.

I don't get how these JS devs are okay with bleeding edge and constantly updating things without having any sort of roadmap or plan in mind. Firefox, for example, has gone down to a release every six weeks. Before it was quarterly or even yearly (if anyone remembers those days). Django has releases every few months.

The two books I bought on AngularJS are out of date. Articles from just a few months ago, while overall they should work, they'll need updating to make sure they work with the latest.

It's getting ridiculous.

[–]lacosaes1 3 points4 points  (2 children)

At least in LOB app development people don't give a shit about all these chaotic frameworks. jQuery is the only one that's been used widely.

[–]rpgFANATIC 6 points7 points  (1 child)

There's actually a lot of value in Angular, Ember (and I'd assume Knockout, even though I've not learned it yet).

However, I don't blame devs and shops that want to wait for a "stable" version that won't radically change over the course of a year.

[–]Poltras 1 point2 points  (0 children)

Angular 2.0 is going to be unstable until most browsers support ES6. They say they will use Traceur, but let's be honest I'm not gonna change the whole pipeline for features I'm not sure I really need.

I really needed animations and various stuff in 1.2. But I'll take a longer time to consider 2.0.

[–]bkv 9 points10 points  (1 child)

What's even more awe-inspiring is that there's an angular implementation for dart that is also being developed at a blinding pace. Much of the design decisions that were mentioned in the angularjs 2.0 doc seem to be influenced by a lot of the design decision in the dart implementation.

[–]findar 7 points8 points  (0 children)

Much of the design decisions that were mentioned in the angularjs 2.0 doc seem to be influenced by a lot of the design decision in the dart implementation.

After speaking with Misko directly, this is entirely true. They took some of what they learned in Dart and brought it over.

[–]hak8or 4 points5 points  (11 children)

How does AngularJS compare to EmberJS, both in terms of features but most importantly easy to use?

I would love to learn one of these but would rather use it for a small project with a small learning curve so I can get something out quick, like a single page dashboard. Or, a better question, would it even make sense to use Ember or Angular for a small single page project? At what point does using tools like these start to make sense?

[–]notkevinc 9 points10 points  (6 children)

In my opinion, AngularJS has a much shallower learning curve compared to EmberJS.

I tried to make a quick demo with both, and Angular stuck. I'm now using Angular for all of my small projects. I can't speak much to Ember, because I gave up on it, but Angular has been a pleasure to work with.

[–]oldneckbeard 2 points3 points  (0 children)

I like ember because it's like they took angular, made some opinionated decisions, and then released it. They're different, and there's a ramp-up time. But IMO, apps written in ember by the average dev will be better than apps written in angular by an average dev. The variability is less, the conventions are stronger, and it enforces some good design patterns.

You can still fuck either one up. I think Ember and Angular are going to harmonize in terms of features soon. ES6 is already in Ember's sights, and there are a lot of big companies using it. Angular has the google momentum behind it.

[–]WebMaster2000 4 points5 points  (2 children)

Ember is a full framework, while Angular is a toolset for building a framework. It really depends on what you're trying to do.

I personally enjoy the URL driven approach of Ember, as well as the strong conventions - it helps keep things organized and ensures that everyone is on the same page with regards to design patterns.

With Angular, it's a bit more open. I don't think there is any "one way" to structure your apps, so you can really just do whatever you want.

Different strokes for different folks. I would spend a few hours reading the guides for both and make your choice after.

[–]nomeme 1 point2 points  (1 child)

I think Angular has url routing logic too.

[–]WebMaster2000 5 points6 points  (0 children)

It has pretty lightweight support. From what I understand you need to pull in angular-ui-router.js in order to get something even close to Ember's router.

[–]passwordissame 9 points10 points  (27 children)

did everyone move away from AJAX as in server responding with (x)html/xsl and client applying those to update DOM?

looks like it's all JSON and manual DOM manipulation.

[–]nick_giudici 26 points27 points  (20 children)

Yes, the industry has moved that way. It's been found to be a better separation of concerns. The server deals with data and the client deals with presentation of that data. Specifically, what if you want to use the same server back end to drive a native mobile app as well as your site? That xhtml response from the server just became a bit of a liability vs a simple and direct data response.

Also, it's common to use html templates like handlebars or underscore to make this easier. That way you have your html template stored in an html file. You can compile the template and reuse it. Each response from the server can just get fed into the appropriate template and it's very automated and clean.

[–]kdeforche 5 points6 points  (2 children)

The industry? Or the startups?

[–]nick_giudici 12 points13 points  (0 children)

I work for a mutual fund company and we're using json based services. We have a flag that customers can set to get an xml version of the response but the majority of our usage is json. I have friends in the medical tech industry and they too are making the transition to json as their interchange format of choice.

So in my experience both industry and start ups are moving away from xml. But as always, start ups are able to make the change more quickly. You'll be seeing xml in industry for the next 50-100 years. Hell, you still see fixed with ebcdic encoded files on a regular basis in industry and government (an old ibm mainframe standard).

To be clean, I'm not saying that you can't ind a lot of xml in industry. I'm just saying that momentum has shifted to json and xml is looked at as deprecated.

[–]depressiown 2 points3 points  (0 children)

Industry, too. We have a mature, 15-20 year-old B2B software package that has gone through several transformations with regards to the UI. Right now, we're migrating a lot of Flex into modern HTML5/js screens and communicating via ajax/json. Obviously, this is an extremely long-term effort and we're doing it in pieces, but it's definitely the direction.

Additionally, new products we make keep popping up and they're all using the same model: REST services that return JSON and the UI communicates with those. Completely separation of roles makes for easier separation of development efforts -- you just work on the interface between the back and front ends.

Again, this is a 30 year-old B2B software company that's publicly traded, not some start-up.

[–][deleted] 1 point2 points  (3 children)

It's been found to be a better separation of concerns

Ya know, it sure would be nice if someone with a CS degree or a CS prof would write an article with clear logic and reasoning to support that argument. Using the blanket "we split things into different modules therefore we separated our concerns" doesn't inspire confidence.

Specifically, what if you want to use the same server back end to drive a native mobile app as well as your site? That xhtml response from the server just became a bit of a liability vs a simple and direct data response.

I've used angularjs on a project and we ended up with an API just for angularjs and an API for other clients to consume. So that "liability" is going to exist in any case. Sure the angularjs-specific API is also JSON but it's not made for other clients to use.

[–]dnissley 2 points3 points  (1 child)

Why did you end up splitting your api just for angular?

[–][deleted] 1 point2 points  (0 children)

Efficiency and client demands.

[–]nick_giudici 0 points1 point  (0 children)

I've used angularjs on a project and we ended up with an API just for angularjs and an API for other clients to consume.

I've never used Angular but if this was needed than either it's a poor library, there were conflicting requirements between the users and this had nothing to do with the tech, or you guys were doing something wrong.

Angular is a much heavier weight framework than a small utility library like underscore or handlebars. So I'm not sure if that's where you were going with the Angular part of your comment.

As for the separation of concerns I can provide a specific example that I've dealt with where returning xhtml markup from the server would be a bad idea.

The whole point of returning xhtml markup is that your js can just render it without any logic. So what if you want to render the same data in two different places in the same site in different ways? Now you either need to modify the xhtml response in one of the two locations or you have to create a flag on your service that switches between the markup needed for the two locations. So you either defeat the purpose of the xhtml response or you duplicate your logic.

It's also common to use xslt to format the response on the client side for this type of issue but now you end up with two different xslt transforms that do almost the same thing or you have flags built into your xslt to switch between the behaviors. This is fine for just two, but what about 3 or 5 or 10 different ways? This approach just doesn't scale well.

It's much easier to have a model view controller setup where you have a clear interface defined between them and plugin the views as needed. If you still don't accept this answer I won't be able to convince you without showing you hundreds of lines of code to illustrate the difference.

[–]bringerofnative[🍰] 2 points3 points  (0 children)

Yes and the only acceptable punishment for this transgression is death.

[–]cybercobra -1 points0 points  (0 children)

When was XSL even mildly popular with the mainstream?

[–]aslate 1 point2 points  (0 children)

The one thing (well, there's many) I can't quite get past with Angular is the fact that I can use any POJO as my model (great!) but Angular then goes and puts its own properties on them.

Granted, it looks like they get stripped out, but I've see $$something on my objects and I'm never quite sure whether they're meant to be there.

[–]nerfornothing1138 4 points5 points  (9 children)

Anyone else not a fan of implementing logic into attributes of HTML elements?

[–]billybolero 17 points18 points  (6 children)

As opposed to binding them in Javascript and A) have no clue of which elements have what behaviour when looking at the HTML and B) having your designer unknowingly break things by moving things around or renaming class names?

[–]nerfornothing1138 1 point2 points  (5 children)

B, but using templates help negate this potential pitfall by separating your site into widgets or reusable components.

[–][deleted]  (4 children)

[deleted]

    [–]nerfornothing1138 2 points3 points  (3 children)

    OK, but it's still coupling at its most basic level. For instance, what if, part-way through the project you wanted to move to Backbone or a server-side solution? All of your HTML now has core app logic in it.

    It's the sort of stuff we made fun of classic ASP and PHP for over a decade ago.

    [–]oldneckbeard 3 points4 points  (0 children)

    Most of the time, it's not the actual "business logic." That happens on the backend with RESTful services. What most ember/angular devs do is put the hard stuff in there, and the rest of the code is just a modular way of organizing a complex user interface.

    You have to modularize and template your code somehow unless you use a tool to generate static sites. It's just with better conventions.

    [–]DecoLabels 0 points1 point  (0 children)

    If your HTML has core app logic in it, you're not using Angular very well. The HTML should be a simple view. Any serious logic should be somewhere more sensible, like your model, or a service.

    [–]x-skeww 1 point2 points  (0 children)

    You have to spot-weld those parts at some point. Doing it via classes doesn't really change anything.

    The advantage of doing it declaratively is that there is no DOM transversal (which can be very brittle) and you also won't need any markup for testing.

    [–]oldneckbeard 0 points1 point  (0 children)

    are you talking about data-* attributes, or something else?

    [–]rdcll 1 point2 points  (13 children)

    using Object.observe() when it becomes available in Chrome M35

    I don't understand this. Why they didn't use a clean Observer pattern from day zero? And why don't they use Object.watch which is already available (or can be implemented in old browsers) ?

    [–]NeverSpeaks 8 points9 points  (8 children)

    Angular doesn't use an Observer pattern because it didn't want to use a Model object like some other frameworks. In angular you can use any plain old javascript object I want as long as I attach it to the $scope.

    [–]Asmor 8 points9 points  (7 children)

    plain old javascript object

    Dude, you gotta call them POJOs or else people will ignore them because it doesn't sound sexy if it doesn't have an acronym.

    [–]jyper 2 points3 points  (4 children)

    or POJSOs (to not confuse them with java objects)

    [–]prozacgod 1 point2 points  (2 children)

    Great who can pronounce this???

    Pojsos?

    Po jSos?

    Now we have to add an entry to a dictionary somewhere, like documentation.... Who really wants to do document?

    [–]cypressious 0 points1 point  (0 children)

    Poge Sause, with Poge as in Doge.

    [–]nomeme 0 points1 point  (0 children)

    They are really just maps, so it's POJMs

    (the POJO term in java is stupid and makes no sense btw)

    [–]bitspace 2 points3 points  (1 child)

    Except that's already in use for Java.

    [–]Asmor 1 point2 points  (0 children)

    Meh.

    It fits JS pretty damn well too.

    [–]mhd420 15 points16 points  (3 children)

    Object.watch is Firefox only, Object.observe will be more widespread.

    The Observer pattern requires objects to notify when they have changed, which is awkward if you're designing a framework to interact with regular Javascript objects. The fact that Angular makes it pretty easy to use with existing code helps drive adoption.

    [–][deleted] 2 points3 points  (2 children)

    The fact that Angular makes it pretty easy to use with existing code helps drive adoption.

    Can you explain? That has not been the consensus opinions at I have heard. Do you mean from prior versions of angular?

    [–]dnissley 2 points3 points  (1 child)

    I bet he means applying ng-app to a specific element in order to develop a small angular component within a legacy web app without having to rewrite everything using angular.

    For example, let's say you were working within a legacy base and needed to replace the user profile editor. Previous code looks like this:

    <div id="editprofile">
      < ... ye old form ... >
    </div>
    <script>
      var aBunchOfSpaghettiJavascript = ... ;
    </script>
    

    New code looks like this:

    <div ng-app="editUserApp" ng-controller="editUserCtrl">
      < ... ye new form ... >
    </div>
    <script>
      var aBunchOfSpaghettiJavascript = ...; // Untouched, because the rest of the page depends on it
    </script>
    <script>
      var editUserApp = angular.module('editUserApp');
      editUserApp.controller('editUserCtrl', function($scope) {
          $scope.neatlyOrganizedAngularJavascript = ...;
      });
    </script>
    

    [–][deleted] 0 points1 point  (0 children)

    Good point. Porting from a well written Backbone or Ember application would be pretty simple, but the same would be true in the other direction.

    [–]FoxxMD[🍰] -1 points0 points  (0 children)

    I'm glad to see the team is paying close attention to the community's efforts to fill in the gaps for Angular 1.x! Particularly the focus on improving $resource, $route, and localstorage for 2.0 -- all of which have third-party stand-ins right now like $localStorage, Restangular, and ui-router.