DEV Community

Cover image for How Angular Works, and Why You Should Be Using It.

How Angular Works, and Why You Should Be Using It.

Chadwin Deysel on April 27, 2022

Angular. The JavaScript framework that strikes fear into the heart in many aspiring frontend developers. With a complex structure and steeper learn...
Collapse
 
crisarji profile image
crisarji

Nice post!

What I hate the most of Angular is the exhausting boiler before even reach the declaration of your component!, prettier does a very good job arranging everything for you, but some times you have 50 lines before the Component decorator.

What I love the most, is the use of TypeScript; I have worked with Ng, Vue and React, and the use of TS is amazing!; classes, interfaces, enums, types, it is remarkable all the unblocked features present in Ng Framework.

Collapse
 
chadwinjdeysel profile image
Chadwin Deysel

Hi Crisarji, thanks for reading!

I admit, the boilerplate code can drive a person nuts at times, but using the Angular CLI effectively is a great way of side stepping this. One can run a simple command such as ng g component component-name and all the boiler plate for the code is taken care of. One thing that gets to me though is the crazy amounts of imports you end up with in a complex component.

Collapse
 
leob profile image
leob

Ng framework, what is that, is it an acronym for Angular? Of course React works just fine with Typescript as well (as does Vue) ...

Collapse
 
leob profile image
leob

The elephant in the room is of course React - why use Angular when React is so totally dominant nowadays, in which scenarios is Angular a better choice?

Collapse
 
chadwinjdeysel profile image
Chadwin Deysel

Hi Leob. Thanks for mentioning React. Answering your question could be a separate post entirely (and there are many "Angular vs React" posts out there). To me however, the short answer comes down to personal preference and what you want to build.

In my opinion, while you can use React for larger scale applications, it's better suited for smaller applications or websites that needs to get the most out of SEO because of the GatsbyJS and NextJS libraries. Angular is just much better suited for larger scale applications because of the way it structures it's code and all the things it includes the moment you create a new application (routing, reactive forms, RxJS etc).

Collapse
 
frangiskos profile image
Frangiskos

Angular is a better choice for large-scale projects with many developers working on the same project. Not all developers have the same expertise or code in the same way. Angular is an opinionated framework that guides everyone to write in the same way.

Collapse
 
leob profile image
leob

Yep that's what I gathered ... on the other hand, if the devs on a project already know React (and not Angular) then the story obviously becomes different already - and you could argue that React has also become somewhat more "opinionated" over the years - everybody seems to have converged on using Hooks now, to name an example, and things like routing and so on have effectively become part of the "core" tool.

Thread Thread
 
edarioq profile image
Edgar Quintero • Edited

It's also a hiring question. React being so dominant (because it's simpler) makes building and keeping a team a lot easier. There is no question that Angular can run laps around React when it comes to software quality, utiliy, scalability, maintainability. But if it's easier to pick up, code with, and get something written faster, then companies will prefer it always... Never the engineers that know better. :)

Thread Thread
 
leob profile image
leob

That's what I also think, React has become so dominant, everything else (Vue, Angular) is pretty niche ... it also means that the React ecosystem is a lot bigger, and so on. Yeah well to be honest I think this race is over ...

Thread Thread
 
ashleyjsheridan profile image
Ashley Sheridan

It's a bit simplistic to ignore any framework/library just because it's not popular. If that were a good argument, there would be no need for MacOS or Linux on the desktop, because Windows is more popular, there would be no need for iOS because Android is more popular, etc.

It all comes down to what is the best tool for the job, and that itself is answered through further questions:

  • What is the scale of the project?
  • What is the team already familiar with?
  • What would the initial cost? (in terms of time, etc) be to learn a new tool/library/framework?
  • What would be the ongoing cost? (in terms of ease of maintenance for future work, etc)

I've been using Angular for about 6 years now, and the scale of the largest project I'm working on with it I don't think would be as simple or as clean were I to do in React. That codebase is almost 40,000 lines of code (although a little over half of that is unit/acceptance test code).

Thread Thread
 
leob profile image
leob

Totally agree, just seems that React is getting ever more dominant, not saying that that's a good thing per se but it seems to be the case ...

Collapse
 
edarioq profile image
Edgar Quintero • Edited

No dedicated section for rxjs? But very good content ty!

Collapse
 
chadwinjdeysel profile image
Chadwin Deysel

Hi Edgar, thanks for reading! Now that I look at it, I should've mentioned RxJS, something to consider for my future content.