Tuesday, August 23, 2016

Thinking About How to Build Dynamic Forms with Angular

There are many times when we need to use forms to collect user data. Make no mistake, this is not where the app begins or ends, but only a small part of an app. There are several platforms, frameworks, etc that we have to create forms. The "classical" approach is to present a form which handles CRUD operations on a database, updating the tables directly. In some cases this may be an adequate approach, but in time it falls short of an optimal solution in many applications. There are several reasons for the shortcomings and some inelegant solutions have been used to make up for them.


Often the form requirements can change over time. In the classical style, a developer makes some changes to the form and the database schema - sometimes altering existing data in the process by dropping or changing columns. The new Form is deployed and going forward we have our new data. But what about the historical data? Perhaps an archive is used, perhaps an additional database and app version. Three versions later, a monolithic app can get messy fast when supporting multiple versions. This is inelegant solution #1.


Sometimes it is beneficial to have dynamic forms, several CMS solutions exist for such things. Not being overly familiar with the current CMS landscape, I'm certain my proposed Angular solution will be fitting of the CMS domain, however I will continue regardless since I believe we can one-up a CMS solution by enabling the user to add fields at their own discretion rather than admin only. Potential inelegant solution #2 - locking part of the solution into a specific platform.


Pre-emptive rebuttal to using Angular platform and locking into that: I propose a more robust solution with no specific template engine, Angular is a fitting engine at the moment since the dynamic nature of JavaScript lends itself to generating arbitrary forms. Plus the benefits of a document database backing will be clear once more details are presented. But enough about solutioning for now...lets continue defining the problem next post...I'm outta time ATM.

No comments:

Post a Comment