Skip to content

Supporting a huge number of similar applications; Supporting software production lines (SPLs) #21352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Nefcanto opened this issue Jan 6, 2018 · 16 comments
Labels
area: core Issues related to the framework runtime

Comments

@Nefcanto
Copy link

Nefcanto commented Jan 6, 2018

I'm submitting a...

[x] Feature request

Current behavior

When you want to create one web app using Angular, everything is superb and excellent. But as soon as you start to use it to the benefit of a company that has a software production line (SPL), things get a little ugly.
For example, in AngularJS, the old school of web meant referencing JavaScript files directly in HTML head section, and lazy loading each HTML fragment (roughly equivalent to Angular Component) and its relevant JavaScript file. This could be reused and automated in a bigger context, with AngularJS truly serving a good role in the bigger picture and providing true business-value for the company.
Based on three reasons we decided to move to Angular:

  • Fear of AngularJS being deprecated and discontinued (proactive approach towards technology change)
  • Simpler component definition (the concept of Scope in Angular JS is so tricky and not mature)
  • Market trend to recruit new developers (local issue of course, yet applicable)

However, we suffered tremendously to harness Angular's power for our own benefits. Because as soon as you start deviating from Angular's opinionated everything, you literally encounter tons of problems.
Here are some examples:

  • When we want to create 10 applications per month, and they are all in a similar business context, the very deeper concept of IoC in the field of configuration and preparation creates business value. Instead of each developer and each project controlling its configuration and preparation, we tend to configure them and prepare them all from a bigger context (SPL). For example, in AngularJS we would only ask a developer to create a simple folder, and then create HTML and JS files for features of that application immediately based on our OWN convention and without any extra step. Yet here in Angular as soon as we create a new project tens of configuration and preparation files are created (package.json, package-lock.json, tsconfig.json, tslint.json, karma.conf.js, polyfill.ts, ....) and they can easily deviate from the same files across projects, which is so expensive in the sense of an SPL.
    For example we need to have one project.json file, that is somehow inherited across 500+ projects. One polyfill.ts file that is not even repeated across projects and developers won't see it.

  • We need to use our own file-system architecture, which is different from Angular's architecture. Folder naming, folder nesting, component naming and similar other things

  • We don't want to load an entire Module, rather we need to load each component separately. That is if you navigate to another route, we need to load that route's component on the fly and lazily. We don't want to create a module per component to load modules lazily

  • We don't want to use TypeScript as our first-citizen scripting language. It's bloated with boilerplate code (specially those imports at the top and all those decorators and exports at the end of each file and ...). We want to write the minimal JavaScript truly related to that component's logic very briefly.

  • We don't want to use Webpack. We want to load Angular from one CDN, load Material from another CDN, our shared components from yet another CDN to increase speed of loading, not a bloated huge big file created via Webpack that packs them all together per app.

Expected behavior

Angular being more flexible to the old school of web and old standards of writing web applications, and introducing new features only as additions, not replacements.

Minimal reproduction of the problem with instructions

Try to think about creating 500+ similar applications using Angular, with as lesser budget and dollars spent as you can imagine, so that you can reduce the end cost for customers through productivity. That means lesser configuration, lesser boilerplate code, lesser technologies involved, using old familiar tools and technologies, etc.

What is the motivation / use case for changing the behavior?

Business value is the one of the most important drives in the industry. Angular is so great when it comes to create ONE SINGLE ad-hoc application. TBH, I think it's the best for that scenario.
Yet its power can't be harnessed (or maybe we don't know how) to support frequency of production.

Angular version: 5

Thank you so much. If the given context is not clear, I would be glad to provide more details through examples and comparisons.

@mlc-mlapis
Copy link
Contributor

mlc-mlapis commented Jan 6, 2018

@Nefcanto ... some thoughts on the base of your ideas:

  • you probably need your own custom project's template ... I think that Angular DevKit (Schematics) would be useful for you to set-up exactly what you need https://github.com/angular/devkit and probably it would be interesting also to look around Nwrl Nx Workspace (monorepo concept) ... https://nrwl.io/nx
  • ... the same from the file-system architecture point of view
  • actually you can't load just a component separately ... but because the definition of a module with one component inside is just 8 lines of code more (and it could be a single one file) ... it is probably not relevant at all
  • using TypeScript is a must ... you can't use JS if you want to work effectively ... no other chance and if you follow other people reactions around the world it is just a reality ... it would be hard to find a person who wants to torture himself to use JS ... it is just a non-sense
  • you don't need to use Angular CLI or Webpack at all ... there are many other options like Rollup, Closure Compiler, SystemJS Builder, ... to mention only the most-named ones
  • you can even use some custom logic which leads to separating Angular libs code out of apps and use them as external libs from external CDNs or your own servers and more effectively use proxy caches, browser caches, ... even cross many apps and share the same libs without duplication, ...
  • probably the best could be to create your own extracted and custom shared Angular lib which would contain only those parts of standard Angular libs which are necessary only for your set of apps ... which would be an equivalent of tree-shaking process on a standalone app's level (this is what would be probably used in Angular Elements ... because it is the same case)

@trotyl
Copy link
Contributor

trotyl commented Jan 8, 2018

actually you can't load just a component separately

Technically it's possible, I have a demo in https://trotyl.github.io/ng-component-loader-demo/ , for example https://trotyl.github.io/ng-standalone-components-demo/temperature.js is a single component and could be loaded directly.

But doing so gets little benefit as NgModule can be easily integrated by router.

@mlc-mlapis
Copy link
Contributor

@trotyl ... lol, you always surprise me. 😄

@trotyl
Copy link
Contributor

trotyl commented Jan 8, 2018

specially those imports at the top and all those decorators and exports at the end of each file and ...

@Nefcanto Those are totally JavaScript. TypeScript is a superset of JavaScript, but these are the inherited JavaScript features. There're demos without using TypeScript like: https://github.com/shuhei/babel-angular2-app/blob/master/src/app.js, you'll find little difference. But without AOT support (which is highly based on TypeScript), it not performant in runtime.

@Nefcanto
Copy link
Author

Nefcanto commented Jan 8, 2018

@tortyl, Angular has architecture, style guide, and everything a good clean codebase needs, but only for ONE project. Do you understand that?

What if there is 100 projects and I need ALL of them to have the same set of dependencies? How to control or enforce that? How to prevent deviation in many projects? How to make sure that developer 1 uses the same version of say X, and developer 2 to 100 also use the same version? How do you manage that? What if I want to remove testing from all projects, cause we can't afford testing costs? What if I don't need that AOT fanciness and I'm cool and OK with the performance issues, because I gain business-value somewhere else? What if I want the TypeScript to be configured the same across ALL projects?

You probably don't understand that, because you have not experienced it. Most developers work only on one project and can't perceive the context from the eyes of a company that has MORE than ONE simple single project.

When it comes to discipline and corporate standards, Angular becomes a true pain in the ass, because it works in one and only one way. Change it and bugs start to appear. You can't centralize things easily. Like I'll give you an example.

.NET projects are built using MSBuild and are configured via special XML files called .csproj for C# language. Now if you as a company want to serve 200 websites for 200 customers, and you want to make sure that only one Excel library is used to export data (because you've done R&D and you've spent money on that and you don't want each developer to waste time benchmarking libraries against each other), then you can easily create a special type of files called target files. Like you can create ExcelConfiguration.targets in a shared environment and ask developers to include that targets file in their build configuration. See? That's how a company works. That's way more savings than you can even imagine.

We have a SPL on .NET platform, and we manage to run more than 100 applications, only using a team of less than 9 developers. That's competition. That's business-value right there. Yet to manage 100 web-apps using Angular, we probably need at least 25 developers. Do you know why? Because each developer in .NET can manage at least 20 application based on all the improvements and infrastructure that we have made in our SPL, yet we can't get the same things in Angular.

@Nefcanto
Copy link
Author

Nefcanto commented Jan 8, 2018

@tortyl in Google I/O 2017 I heard them saying that we have more than 6 million applications both on Google Play and App Store. Can you believe that? 6 millions. That's not a joke anymore. Many companies are working in the field of creating low-cost applications in high-volumes for special type of customers. Let's think about WordPress for example. There are thousands of businesses out there which are OK if they have a website made with WordPress and they don't need to spend a huge amount of money to setup their own teams and create highly sophisticated and customized web sites.

That's our business. We create applications (web, android and iOS) for these types of companies. Yet to make them happy, we need to reduce costs. To reduce costs, we need to extract similar functionalities from many projects and control them somehow from a central place. We need to follow don't repeat yourself pattern. That's possible in Android Studio via Android Modules and gradle build system. That's possible in Visual Studio via dll files and MSBuild configuration. Yet that's somehow impossible in Angular.

If we could write angular in simple JavaScript terms in old fashion of web like including js files in head, etc, then we would benefit from it.

The main reason we're moving to angular is because of the overall market trend. That's all. Developers are switching and it's getting harder to find developers for older technologies. Customers hear about it and get into the hype and ask for Material Design. And so many more factors that push us to go towards Angular. Yet it's not good at all for creating many many more applications with single standard.

@trotyl
Copy link
Contributor

trotyl commented Jan 8, 2018

@Nefcanto You have severe misunderstanding between Angular and Angular CLI.

  • Angular is just a framework and has no idea how you would use it.
  • Angular CLI is a tool to help you quickly setup an Angular development environment.

Angular has architecture, style guide, and everything a good clean codebase needs, but only for ONE project.

That's what Angular CLI provides (except Style Guide which is an abstract principle), if you want a custom project structure, you're welcomed to create your own, but Angular CLI is only designed for SPA usage only.

What if there is 100 projects and I need ALL of them to have the same set of dependencies?

You could search for term "micro frontend", that's what you're looking for.

@mlc-mlapis
Copy link
Contributor

@Nefcanto ... the more I think about it, the more I am convinced that Nwrl Nx Workspace (monorepo concept) is a concept that should interested you. Your arguments are exactly those reasons why it ever came into being.

Generally the Nx Workspace concept is something what took much wider experiences from Google monorepo concepts that Google is applying internally for many years and on a lot of larger apps portfolio ... there are probably hundreds of apps, maybe thousands. They are fighting with the same types of problems but with hundreds and hundreds of developers around the world.

@Nefcanto
Copy link
Author

Nefcanto commented Jan 8, 2018

@trotyl then why angular.io starts with Angular CLI? I searched and I couldn't find a section on how to create an Angular application without Angular CLI.

I think the point you mentioned might be helpful. Can you guide me in the right direction on that? Is there examples on how to create an Angular app without Angular CLI?

@Nefcanto
Copy link
Author

Nefcanto commented Jan 8, 2018

@mlc-mlapis I'm so thankful for the link you introduced and yeah, you're right. They have the same concerns. It's just that when it comes to business, law also comes into the scene. We try to somehow do what they've done, but with multiple repos. If we can't, we definitely give it a try cause as you said they are very close in mindset to what we need.

@trotyl
Copy link
Contributor

trotyl commented Jan 8, 2018

@Nefcanto Some facts:

Angular CLI is here to save time and reducing the learning curve, but not for forbidding your creativity.

You can find non-CLI example everywhere (https://github.com/angularclass/awesome-angular), but if you only want an out-of-box well-maintenance production-ready project template, then it will certainly be hard. Of course nx is a good example.

@kara kara added area: core Issues related to the framework runtime type: RFC / discussion / question labels Jan 8, 2018
@mhevery
Copy link
Contributor

mhevery commented Jan 9, 2018

This is a general topic which we are hoping to address in the futrue, but as such it is not really actionable. I am going to close this but do continue to have discussion here.

@mhevery mhevery closed this as completed Jan 9, 2018
@Nefcanto
Copy link
Author

@tortyl, based on your guideline that Angular is not Angular CLI, we've already started R&D to create our own infrastructure for Angular. Here's what we intend to do:

  • Load UMD modules via old school head script reference
  • Create an object model for android concepts in C#. That is each application has many modules, and one and only one root module. Each module can have many components, and only the root module can have one and only one root component. Each component is loaded via a route change probably, and so on.
  • Creating boilerplate codes for module and component definitions, and also for bootstrapping the root module, via C# and injecting that code into the HTTP response
  • Creating a convention in our SPL, so that our developers would only be engaged in creating views and components and spend zero time on keeping projects in sync

Of course we know that this path might not be feasible, or even if feasible we would definitely lose some benefits and Angular like AOT compilation, or flexibility of having multiple router-outlet for deep linking and similar scenarios. Yet the business-value we gain would be much more.

@trotyl
Copy link
Contributor

trotyl commented Jan 10, 2018

based on your guideline that Angular is not Angular CLI

By saying that I mean you should raise specific actionable feature request (for specific repo) rather than abstract support request like:

The official tooling won't be able to cover everyone's advanced requirements, but can still be made use of.

Of course we know that this path might not be feasible, or even if feasible we would definitely lose some benefits and Angular like AOT compilation, or flexibility of having multiple router-outlet for deep linking and similar scenarios.

AOT and routing are feasible for individual build process (unless dropping TypeScript usage), but making custom AOT tooling support would indeed require knowledge about Angular compiler and JavaScript building tools, so it's depending on you whether it's worthy or not.

@mlc-mlapis
Copy link
Contributor

@Nefcanto ...

  • It should be certainly possible to load UMD dynamically ... when it is really necessary and not statically.

Load UMD modules via old school head script reference

  • and the best would be to create a shareable UMD which contains only necessary parts on the base of your apps' code ... then loading it in <head> section has all advantages.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime
Projects
None yet
Development

No branches or pull requests

5 participants