Live data from Hacker News

How to build a large Angular.js application

gocardless.com

31–40 of 53 posts

Re: How to build a large Angular.js application

#31
post #27

Earlier quoted context omitted.

I'm not sure I agree. All the frameworks just mentioned do more or less the same thing and have comparable lines of code counts. - Django - 215,000 LOC (.py) - Ruby - 232,000 LOC (.rb) - CakePHP - 240,000 LOC (.php)

Rails is about 110,000 LOC, last I checked right before the 4.0.0 release, where'd you get that number?

$ git clone https://github.com/rails/rails.git && cd rails

$ find . -name '*.rb' | xargs wc -l | tail -1

232424 total

Maybe I should have said LOCC (lines of commented code)?

Re: How to build a large Angular.js application

#32

Would be interesting to hear if you discovered any downsides to Angular. I've been working with it a lot lately, but it seems to be a really good solution and the only issues with it is it can be hard to set up to be compatible with googlebot and the slightly tough learning curve

Problems Angular doesn't solve for you:

http://jmdobry.github.io/talks/2013/building-large-apps-with...

Re: How to build a large Angular.js application

#33
post #8

Earlier quoted context omitted.

Example: I'm working on a "large" CakePHP application (similar to Rails) with 24,000 lines of our own code, 57,000 lines of code from community plugins, and 240,000 lines of core framework code.

I am the sole maintainer of a framework free PHP codebase with ~100K lines. Who's jealous? It could probably be rewritten down to about 10-20K lines (maybe less) if I had a spare month or two.

If you are saying the size of your application could be reduced by rewriting it to using a framework (an existing one or one of your own creation), I think this is the point we are all trying to make here.

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.

Re: How to build a large Angular.js application

#34

Would be interesting to hear if you discovered any downsides to Angular. I've been working with it a lot lately, but it seems to be a really good solution and the only issues with it is it can be hard to set up to be compatible with googlebot and the slightly tough learning curve

I made http://www.BromBone.com to help with the googlebot problem.

I agree. The learning curve can be steep, but I've really enjoyed using Angular.

Re: How to build a large Angular.js application

#35

Can anyone comment from experience on the testability of Angular.js, that is mentioned in the article? Was it a reason to chose Angular.js over some other framework (if so, which framework)?

We specifically looked at CanJS, Backbone and EmberJS. None of which have testability as a core feature. CanJS and Backbone barely mention how to do it, EmberJS has one tiny page on integration testing. Which practically means there isn't a established right way to do testing. And you as a developer need to figure it all out. Ember are improving this however, with the ember-testing package: https://github.com/emberjs…

Angular's dependency on the DOM for rendering will always make testing it very difficult. This will continue their move towards feature based testing. Feature tests have their use, but they do not scale and provide the least useful insight into why something is failing. They are also notoriously slow, so once you have a large test suite, it can easily take 20 minutes or more for feedback. I have worked with feature based test suites that take 2 hours to run. It wasn't fun.

Re: How to build a large Angular.js application

#36
post #2

> The core app is 9K lines of code. I don't think 9K is "large" for an application. At all.

It is for JS. At least if you consider all the other "built with Angular-js" examples so far (except for Double-Click maybe).

For a C++ or Java code that 9K would probably make it into the "small" category.

Re: How to build a large Angular.js application

#37
post #2

> The core app is 9K lines of code. I don't think 9K is "large" for an application. At all.

Currently our AngularJS application is 20k lines (between controllers, directives, services, and templates) and it certainly feels like a large application -- not when working on it, but when using it. AngularJS makes it very easy to build quite "large" (in the complexity/richness sense) applications with much less code than most other approaches, in my experiences.

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.

Re: How to build a large Angular.js application

#38
post #33

Earlier quoted context omitted.

I am the sole maintainer of a framework free PHP codebase with ~100K lines. Who's jealous? It could probably be rewritten down to about 10-20K lines (maybe less) if I had a spare month or two.

If you are saying the size of your application could be reduced by rewriting it to using a framework (an existing one or one of your own creation), I think this is the point we are all trying to make here. 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 (cou…

In this case, simply refactoring to remove duplication would probably work. For example there are at least 3 different ways to send email.

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.

Re: How to build a large Angular.js application

#40
post #23

not as good as ng-boilerplate http://joshdmiller.github.io/ng-boilerplate/#/home with its modular cut and paste directory structure.

Thanks a lot for mentioning this - I was about to have to dive into setting up a build for an Angular app I'm working on (which I need to learn eventually, just not right now) so that project really helps.

actually I think that structure is a bit overwhelming for learning angular, but when you scale up your talents I think that's the best I have seen.
Post reply on HN