0

I have decided to do a complete rewrite of the large scale application that I am working on since it is in AngularJS 1.4. I transferred over most of my HTML and CSS files and am now ready to create the TypeScript files.

Do I need to create a TypeScript file for every JavaScript file that is in the 1.4 version, or will there be fewer TypeScript files? At first, I assumed I would need the same amount of TypeScript files as there are JavaScript. But after researching it I find a lot of places that say "Make each page of your application one component". So this makes me think if I have 5 total pages on my application then I will only need 5 total TypeScript files. The original contains ~80 JavaScript files.

georgeawg
  • 48,608
  • 13
  • 72
  • 95
CluckHeads
  • 37
  • 6
  • 2
    What advantage would you gain from rewriting your senior project? It sounds like a lot of unecessary pain to me. My advice would be to finish the project and then learn Angular 9 from scratch. But that's just one person's opinion. – Kurt Hamilton Feb 24 '20 at 19:49
  • The project is currently fully written in AngularJS 1.4. For my senior project, I am tasked with migrating it to Angular 9. The entire application is made, I just need to rewrite it in Angular 9. Sorry for the confusion. – CluckHeads Feb 24 '20 at 20:01
  • 2
    Ah, I didn't realise it was part of the task. You're not going to get much traction here with an open-ended question like this. There are probably about 100 blogs titled "What I learned from migrating from AngularJS to Angular x". They would be a good starting point. And I hope you're using version control... – Kurt Hamilton Feb 24 '20 at 20:07

2 Answers2

2

Your plan is called the "big bang rewrite", it's very common, and it's a bad idea.

In most cases, it’s the Big Bang approach that wins the argument.

But by making it a Big Bang release, you’ve maximized the chances that you’ll be behind schedule when you get to the end, and you’ve therefore maximized the chances that you won’t spend enough time preparing. This results in a bad time for both you and your customers.

Unfortunately, perhaps due to something intrinsic in human nature, this scenario is a cliche for Big Rewrite projects.

Chad Fowler: The Big Bang

One of the keys to a successful upgrade is to do it incrementally, by running the two frameworks side by side in the same application, and porting AngularJS components to Angular one by one. This makes it possible to upgrade even large and complex applications without disrupting other business, because the work can be done collaboratively and spread over a period of time. The upgrade module in Angular has been designed to make incremental upgrading seamless.

For more information, see

Community
  • 1
  • 1
georgeawg
  • 48,608
  • 13
  • 72
  • 95
  • As of right now, the application is not released, therefore during the migration, we are not worried about downtime. I have heard that if you go with the hybrid approach then part of the application will still be stuck within the AngularJS framework. What would your recommendation be? Migrate to 1.5 and then use ng upgrade throughout until it is upgraded? – CluckHeads Feb 24 '20 at 20:17
0

The goal of making every page a component is to make it easy the use of routers.

It really depends of your application, if you have a portion that is used multiple times in the same page, you can make a component with inputs and ouputs and then you can mutualise your code.

So before you create a new component you have to ask yourself two questions

  1. Will i reuse this component in other pages ?

  2. Does this component need to be in a specific URL?

isherwood
  • 58,414
  • 16
  • 114
  • 157
BELLIL
  • 739
  • 10
  • 23