GUI Dynamics
The first relevant perspective to consider is whether the expected user interface is static or dynamic.
Static GUI refers to a web interface that does not change due to user interaction or external factors. In this context, the page loaded for the end-user remains unchanged during their usage of that page. A common interaction that still falls under the static GUI category is when a user's action redirects them to another page, such as clicking on a navigation bar or submitting a form via an action button or link.
It’s important not to confuse static or dynamic GUI with static or dynamic web applications. A dynamic web application generates different content based on various factors. For example, a blog where each post has unique content sourced from a database would be considered dynamic. However, from the GUI perspective, the post page itself is largely static, as the interface remains unchanged during the user's interaction with a specific article. Exceptions might include interactive elements like search and navigation buttons, which are dynamic.
Dynamic GUI, on the other hand, refers to interfaces where multiple small portions or larger sections (partials) of the page change based on user interactions. For example, in an invoicing application, the user might fill in customer details, select an invoice type, set a payment due date, or add and remove invoice items. Each of these actions triggers dynamic behavior in the interface, such as recalculating totals, applying taxes, and validating rules for invoice creation. For instance, adding or removing invoice items updates the total amount, while selecting a different currency adjusts the exchange rates accordingly. In this scenario, nearly every interaction on the invoice page causes one or more elements of the interface to update dynamically.
Choices:
- For mainly static GUI pages, HTML (server-side rendering) is the most reasonable choice. The system operates such that every user interaction prompts the web server to respond with a new page to be presented.
- For GUI pages that are dynamic in the sense that significant but independent parts change (e.g., a "wall" on social networks), a reasonable approach is dynamic partial rendering. One option covered in this article is Hotwire.
- For dynamic GUI pages where user interactions primarily affect multiple elements across the interface, single-page application (SPA) frameworks are a more suitable choice. One option discussed in this article is React.