Use The Framework

Recently started to reimplement a Reactive Form in an Angular project. The previous implementation looked overly complicated and some major features of the Reactive Form API have not been used properly.

In this reimplementation I am carefully mapping the requirements of the form to the features that come with the framework. So far I have the feeling that it will map quite nicely and will end up in an elegant solution.

Over the years working with different frameworks in different languages I have come to the conclusion that it always makes sense to invest time into learning how the framework wants to be used.

A framework is practically it’s own language sitting on top of a programming language. It is a point of view, a perspective. It makes your life easier when you are able to take that point of view.

I have seen many times how developers hastily try to learn a thing because deadlines and such but then end up with a big spaghetti mess because they are mixing their point of view and their opinions with the ones of the framework.

If you chose a framework or you’re stuck with it for some reason, take the time to learn it and really use the framework.

Angular Reactive Forms have a really powerful API which lets you handle all your form logic in TypeScript. All the different states of the different form fields are constantly held in a nested JavaScript object which is constantly updated on the fly when the user interacts with the form.

This creates the effect of data “flowing through” the form so to speak and the UI of the form can dynamically be changed in order to represent the underlying data model. This is pretty powerful.

Here are some good introductory articles on the subject: