

Angular Restmod – Rails-inspired REST ORM - blackjid
https://github.com/platanus/angular-restmod

======
jnbiche
Have people had much success using Angular in production for largish client-
side apps? The only large Angular client-side apps I've seen don't seem
particularly well organized, which is ironic given Angular emphasis on
modularization.

I'm about to start work the largest client-side app I've ever done. I had
resolved to use Backbone with React, since I've used Backbone a lot in the
past and it excels as an organizational tool.

But looking at what's now available in the Angular ecosystem makes me wonder
if I could save a lot of time by using Angular and some of its many 3rd-party
modules.

I've only used Angular for a couple of small projects. I liked it but it seems
a bit overengineered and very Java-like. But this could just be my Java
prejudices coming in to play.

Anyone know of a large AngularJS (say 5000+ LOC) app as an example?

~~~
randall
We use it for two separate apps that are both largish, and one baby app we
expect to continue to grow in size. Code organization gets simpler if you use
a fractal approach where each module follows a convention which you fractal
down as much as needed. That typically mirrors the angular style much more
efficiently than a rails style approach, for example.

~~~
justysebitcoin
I'd like to learn more about what you mean by fractal approach --- would you
expand on it? thanks

~~~
lintaho
take a look at this style guide:
[https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDz...](https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/pub)

the code is organized by component, which can be further divide as much as you
see fit

------
Oculus
The README didn't do a good job (at least for me) of explaining what it offers
over RESTangular. It just said some hand wavy things about ActiveRecord. What
are the real benefits of Restmod over RESTangular?

------
api_or_ipa
Finally. A decent ORM for angular.

------
bmelton
My first thought when I saw this was to wonder how it might stack up to
RESTangular, which I've toyed around with, but never really committed to
because it didn't offer a ton of value over the in-built services and, really,
just manipulating $http directly.

This, however, looks really solid, and excels in its very natural syntax. The
way in which an object is called, manipulated and saved back is exactly how I
expect an 'ORM' to work... at least until I get down to the "belongsTo" stuff,
which is very Railsy -- that's fine, and the intro professes its attempt to
mimic ActiveRecord, so it's even expected, just a little rough for me, as I
left Rails for Django mostly because I preferred Django's ORM to Rails'
ActiveRecord.

Regardless, I'll give it a shot.

In my skimming, I didn't see what versions of Angular it supports. I know that
1.2x has issues with PATCH operations (easily solved), and this didn't have
any caveats for $.save() -- is it intended for 1.3+, or could I expect it to
work on a 1.2x project?

~~~
aikah
Django's ORM still implements the active record pattern,just like this module.

I really think it is an anti-pattern especially in domain driven design. Since
it basically couples domain models to a persistence library. The repository
/model manager pattern is a better alternative as it doesn't care where
objects come from and how they are created (used in Hibernate,EF,Doctrine,...
) ,and keeps the persistence layer and domain models totally decoupled.

Granted that it is way harder to implement it in javascript+async environment,
since async operations are not implicit in JS,which breaks any possible
encapsulation to begin with, but it's not impossible.

~~~
goblin89
Thanks for pointing out that active record is a generic pattern. I didn't know
that (and judging by angular-restmod's README its author may not know it too).

You say active record is anti-pattern, but can't it be combined with managers?
For example, in Django, model's save() method eventually delegates to the
manager and anything concerning actual DB happens down the line.

Angular-restmod doesn't do that, though. I checked its code and it just uses
$http directly.

