Parent-child relationships are the heart of most enterprise apps – enabling them to enumerate the hierarchical relationships present in most business processes. Every web framework needs to support parent-child relationships, however the key to a platform’s flexibility and usability is the amount of overhead involved in the implementation.
While single-level parent-child relationships are a staple of most systems, N-depth, or arbitrarily deep grandparent-parent-child forms can be complicated to program. Breadcrumbs, the links allowing hierarchical backtracking, are a necessity for any such system to help the user navigate up through the levels. Foreign key verification is necessary, especially during update and delete operations to make sure that orphaned children are not left in the database. And a variety of display paradigms need to be implemented, including form-based parents with grid-based children, pop-up/modal systems, and dual-grids with record-locking and validation.
The Rails or Django model-based frameworks make this task relatively easy. Both Rails and Django are built from the ground-up to simplify parent-child form development, featuring automatic breadcrumbs, input validation, AJAX support, and auto-generation of the relevant SQL statements. The main problem is Rails is its lack of foreign keys in database schemas, requiring developers to work around the built-in models for most serious systems. Django can support foreign keys, however it may often have problems with more advanced constructs such as auto-updating triggers.
Both PHP and native ASP.NET require full coding of all parent-child relationship components. Although this can be challenging the first time, future relationships are often a matter of copy-and-paste. Repetitive pieces of code can be standardized into classes, often yielding a similar, stripped down version of Django or Ruby. ASP.NET also features an MVC development component with the Entity Framework that helps simplify development of many of these applications. Although some components such as breadcrumbs are not supported out-of-the-box, add-ons are available to help replicate that functionality.
One of the frontiers of current web frameworks is the implementation of grid-based parent-child relationships on the same screen. Some packages such as Ext.js are making progress in this regard, however problems surface in ensuring that all child rows validate before transferring focus back to the parent. With each browser yielding subtle nuances in event triggers and focus, it can be a challenging task to lock row-based edit focus, yet at the same time prevent changes to any other form field until the errors have been fixed.
In the next article in this series, we will review lazy-loaded data grids, one of the useful features of many desktop applications that is slowly making its way onto the web.
Written by Andrew Palczewski
About the Author
Andrew Palczewski is CEO of apHarmony, a Chicago software development company. He holds a Master's degree in Computer Engineering from the University of Illinois at Urbana-Champaign and has over ten years' experience in managing development of software projects.