How to build a large Angular.js application
gocardless.com
gocardless.com
Not to downplay the Ermahgerd Translator! http://ermahgerd.jmillerdesign.com/#!/translate
Disclaimer: I worked with them implementing that.
I'd be willing to bet that AngularJS will be hugely successful, and will gain a significant share of the Single-Page-App market.
I'm not saying Angular/Flex is the same beast. I'm saying that one of market segments that is going to find it most useful is the same people who were looking at Flex to solve problems back in 2006/07. Naturally, technology has progressed quite a bit since Flex came out. For a JS library, Angular hits a pretty good sweet spot for those same large dev teams looking to build native browser-based apps.
By contrast, AngularJs is not being sold into the enterprise by anyone (yet?), and is, IMO, better at solving those problems.
Hence my prediction: unlike Flex, AngularJS will gain market share in single-page-apps outside the firewall, as well as inside the firewall.
I don't think 9K is "large" for an application. At all.
Because there is so little boiler-plate code that is being written, the utility-density of such a codebase can be extraordinarily high. 9,000 lines of PHP could amount to very little utility but when well-architected, there is a crazy amount that can be done with even 2,000 lines of a framework such as Angular or Rails.
[EDIT]
The point I'm making is that a good developer working in harmony with a framework can do in 4 very readable lines what a less experienced developer might easily expand to 60 lines. As such dismissing a 15k codebase as "small" is somewhat naive. A 15k Angular app can do a vast amount.
My experience with Rails (and my limited experience with Angular suggests it's similar) is that working harmoniously with the framework gives you massive amounts of utility with very, very few lines of code. I've personally refactored 100 line controllers from junior developers down to 12 lines. It might feel macho to compare codebase sizes but there's no strong coupling to utility (arguably perhaps the reverse).
You can certainly write 60k apps in Rails, Angular or Django but dismissing a 15k app as "small" doesn't do justice to the utility that even such a "small" codebase can deliver.
...sorry this comment was so long I didn't have time to write a short one ;)
It could probably be rewritten down to about 10-20K lines (maybe less) if I had a spare month or two.
Assuming one uses all the features of a framework, the total complexity of my 24K line framework application (counting only code I've written) could be compared to that of a 321K line non-framework application (counting all the code in my project).
Thankfully I only have to write/maintain 8% of the codebase, as the remaining 92% is kept up-to-date by typing `composer update` on a weekly basis.
There is a lot of code in there that is really "framework" but it's completely baked into everything else so not really separable. There's probably at least 2 different and distinct attempts at creating a framework, and you can tell the age of the code by which it uses.
The main reason it hasn't been significantly refactored is that it is astonishingly reliable considering how bad the code is.
- Django - 215,000 LOC (.py)
- Ruby - 232,000 LOC (.rb)
- CakePHP - 240,000 LOC (.php)
$ find . -name '*.rb' | xargs wc -l | tail -1
232424 total
Maybe I should have said LOCC (lines of commented code)?
Interesting claim. Do you have references?
(An account with a couple of hundreds of Karma making extreme claims? Please surprise me by not being a troll. :-) )
The problem is, it's not always obvious what "the Angular way" is, but on the plus side, I've just thought of a title for a series of blog posts...
However, right now it works quite well since I'm using "editor folds" to separate each controller.
For a C++ or Java code that 9K would probably make it into the "small" category.
Of course, if we are treating size as absolute, and basing it on lines of code, then 9k is pretty small. I mean linux has like 15m lines! It will take a while to catch up.
For comparison, I work on a Backbone.js app that has the following distribution.
--------------------------------------------------------------------------------
Language files blank comment code
--------------------------------------------------------------------------------
Javascript 282 4348 7356 27860
CoffeeScript 336 4953 1687 17939
Obviously Backbone.js has much less "batteries" included.The tips in the article were good and well thought out. I appreciate the effort the author made.
Here's the few downsides of Angular IMO :
- I'm particularly unhappy with the router, it does a good job but as soon as you start to have nested routes and complex layout, it you want to avoid copy-pasting the same bits of code everywhere it becomes a nightmare. We mitigated most of these issues by using a lot of directives but it doesn't solve the problem entirely. We looked at ui-router at some point but weren't totally satisfied by the way it worked. Maybe we should take another look.
- errors are sometimes very obscure, it can be hard to debug, even if at some point you start to recognize some errors and know where to look first
- docs could be better
There are some other glitches here and there but most of the time Angular is a real pleasure to use, it's by far the best front-end framework I've worked with.
http://jmdobry.github.io/talks/2013/building-large-apps-with...
I agree. The learning curve can be steep, but I've really enjoyed using Angular.
For example, http://Clara.io, our 3D design as a service offering, is already 52K LOC in just our core and that excludes the 30K LOC of external libraries.
Unfortunately we couldn't do it before because we're using rails assets pipeline, but it should happen soon now.
Ember are improving this however, with the ember-testing package: https://github.com/emberjs/ember.js/tree/master/packages/emb... Backbone has countless tutorials on how to test, but it's not built into the framework.
http://toranbillups.com/blog/archive/2013/07/21/Integration-...
http://www.yearofmoo.com/2013/01/full-spectrum-testing-with-...
> Angular.js is built from the ground up with testing in mind. In our opinion this makes Angular different from all other frameworks out there. It is the reason we chose it.
For dev / early testing I've just been using yeoman + grunt-connect-proxy with grunt spitting the final build files into the rails public directory to make it easy to push up to heroku. In final production you'd probably want to send your static assets to a cdn but that is easy enough.