A comparison between Angular and React and their core languages

A comparison between Angular and React and their core languages

A comparison between Angular and React and their core languages

When it comes to Angular, at first glance, we can clearly see that Angular has 6 times more issues than React (not good). However, we must not forget that Angular is a much larger framework, and also has fewer developers using it (currently) because it was released in 2016.

Angular and React — Github popularity

What companies are using

React was initially developed at Facebook for Facebook to optimize and ease the development of components. An article written by Chris Cordle points out that React has a higher usage at Facebook than Angular has at Google.

So who uses which technology?

# React

  • Facebook
  • AirBnb
  • Uber
  • Netflix
  • Instagram
  • Whatsapp
  • Dropbox

# Angular

  • Eat24
  • CVS shop
  • onefootball
  • Google Express
  • NBA
  • Delta

TypeScript and JavaScript (ES6+)

As I mentioned, it can be misleading to only compare Angular and React without focusing on the core language each one has to offer.

TypeScript and JavaScript (ES6+)

In terms of user base, JavaScript has by far the larger one. But TypeScript is gradually increasing, so who knows what 10–15 years will bring. Maybe a couple of dozen new frameworks (sarcasm).

Google trends — TypeScript and JavaScript

TypeScript was initially developed by Microsoft to make JavaScript easier (in other words, to make ES5 easier). It was released in October 2012. And it is simply a transpiler that compiles TypeScript to JavaScript code, which also means you can write ES5 code in a TypeScript file.

In general, TypeScript provides a smooth transition for programmers with an Object Oriented Programming (OOP) background. It is important to notice that TypeScript was released in the period of ES5, and during that time, ES5 was not a class-based OOP language.

In short, the closest you could come to classes and objects back then was through prototype inheritance. And as we know, this was a difficult transition for most developers with an OOP background. So the ideal decision was of course choosing something you felt comfortable and familiar with, which was likely TypeScript.

However, in the past years, JavaScript has evolved and implemented lots of great changes such as modules, classes, spread operators, arrow functions, template literals and so on. Overall, it allows developers to write declarative code, while supporting the characteristics of a true OOP language (that is, including class-based structure).

Static typed property

Static typed property comparison between JavaScript and TypeScript

Static typed argument

I’ve learned that lots of people believe that a statically typed language means reliable code, and is most often used as a winning argument over dynamically typed languages. And frankly, it is quite difficult to disprove this statement because it fundamentally relies on the development environment, the programmers experience and of course the project requirements.

Luckily, research (tl;dr video) has taken this seriously, and put this myth to test with 49 subjects.

The observations from the research are:

  • Statically typed language require more time due to fixing typo errors
  • Dynamically typed language is readable and easier to write (declarative code)

The observations from the research are:

Figure 5 shows that, on average, developers reduce their development time by a factor of two when writing a dynamically typed language.

If you want to dig deeper into this topic, I suggest reading this article by Eric Elliott which states that you may not need TypeScript (or statically typed languages).

What to choose

So the question is not only about what Angular or React offers, but also about what core language you should invest time on. And it does not really matter to be honest.

But if we had to select, then it seems that the reasons TypeScript stands by in contrast to JavaScript are not that many. And I don’t really see why people would neglect JavaScript (ES6+). Anyway, if you are not a fan of types, then there is nothing standing in your way of writing ES6 code in .ts file. It’s just that if you need it, then it is there.

IMO

Statically typed feels structured, secure, readable, and easy to collaborate with others (prevents people from passing unexpected values). However, when working with dynamically typed, I have the flexibility and creativity to focus more on creating than thinking to much about types, interfaces and generics and so forth.

And from the past web-apps I’ve built, I haven’t really had any large issues with not having static typed. It does not mean I don’t like it — I just that I don’t need it, but maybe I do in the future.

Takeaway notes

  • React handles memory-management efficiently (virtual DOM)
  • React uses JavaScript (ES6), a recognized web-language since 1995
  • Angular uses TypeScript, released in 2012
  • Statically typed languages are great, but you can do fine with without it
  • Dynamically typed languages require less time to write and more flexibility to use your creativity (fewer typos)
  • Learning a statically-typed language may be a challenge, especially if you’ve only been working with dynamically typed languages
  • ES6 has implemented lots of great features such as modules, classes, spread operator, arrow functions, template literals that allows you to write less, cleaner and more structured code (syntactic sugar)
  • TS is simply ES6+ with typos and more

Conclusion

The framework/component-library you choose may influence how much time you spend programming and your budget. If you have a team with C#, Java or C++ developers, then I would probably go for Angular, since TypeScript shares many similarities with these languages.

The best recommendation I can offer is to setup a basic application both in Angular and React, and then evaluate the language and work flow before you make a decision.

Leave a Reply

Your email address will not be published. Required fields are marked *