What You Missed At ng-conf, The Annual AngularJS Lovefest

Building for large applications

Jen Bourney’s presentation on building platforms with Angular was salient to the work that I’m doing with Odecee. There are a few things I can apply to my current project:

  • Optimising the lazy-load process to load modules with temporary routes initially, until such time as the actual module is loaded and loads its own routes (and then cleans up the temporary route). This is much better than the main routing module having to know up-front all of the routes of the lazily-loaded modules.
  • Allowing components to look up their configuration at run-time (we’re kind-of doing that already, but it’s affirming).
  • Using pre-commit hooks to run tests and ensure code has been linted before it gets into the repository.

Angular and React

I felt compelled to update this article with a brief discussion on Angular and React. Matthias G prompted me to recheck the Angular + React video by Dave Smith, as it now has an additional 2 minutes of Dave explaining how the demo at the conference wasn’t entirely fair to React. He then creates a fairer comparison between Angular 2 and React with the result being that they are almost as fast as each other, in this instance.
But this got me thinking — what do I really care about as a developer? I’m not an Angular fan-boi. I have used many libraries (like JQuery, jqMobile) and custom frameworks before to create web applications and sites. But I currently use AngularJS because:

  • It is easily testable, which is very important to the financial companies that I work for.
  • It allows the application to be layered (models, views, view-models, services, commands, data access objects).
  • It allows me to write HTML in HTML files.
  • The above three points mean that Angular code is maintainable, which is also very important to my clients.
  • My clients are quite happy with Angular’s current performance for the use-cases they have.
  • There is a lot of support for it in terms of people, tools, and components.
  • It offers a path to ES6/HTML.next Google Goodness today.
  • The community is supportive and helpful.
  • It keeps getting better (faster / more features / simpler to use).
  • It does not prevent me from using other technologies if I want, such as React or jQuery.

I don’t use Angular because:

  • it produces the fastest code in every situation
  • it is the hottest, shiniest thing on the market
  • it looks good on my résumé

I would use another technology (such as React) if:

  • the global market decides that React is a better platform for web development, and clients start demanding we build systems using that technology
  • it has a good ecosystem of tools and components that allow me to write maintainable code
  • I can still write my view separate from my code (JSX, I’m looking at you)

Dave’s talk was actually about how you can use Angular and React together, and the times when you would and wouldn’t do that. So in that spirit, I would say this: when I come across a business problem that requires a solution that involves a lot of DOM manipulation, and an Angular implementation is not fast enough, I would explore using React.

FireBase, BackAnd, Wakenda, Falcor

All of these companies are offering ways to make it easier to talk to data stores and set up applications faster — which is great! My only concern is that the demos we see keep doing things like this:

function MyController($firebaseService/* or other db IMPLEMENTATION */) {
  this.users = $firebaseService.get('/users');

  this.edit = function (user) {
    user.$save();
  };
}

This violates an architectural principle (which John Papa also subscribes to) in which controllers should not know about how data is fetched or stored. This is an implementation detail and does not belong next to view logic, but belongs in a data-access layer (implemented as a service, in Angular).
So I’m hoping that these demos that we’ve seen are understood by the community to be demos, not how-tos for using these data services. If not, every new version of Firebase/Wakenda/BackAnd that is released will force you to touch your view-logic code instead of your data-access code.

Be sure to read the next Events article: Facebook to Bring F8 Meetups Worldwide

 

Comments (0)