arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~

BRHC:基于后端驱动的反应式超媒体控件与静态类型Kotlin DSL

BRHC: Backend-driven Reactive Hypermedia Controls with a Statically Typed Kotlin DSL

Fernando Miguel Carvalho, Paulo Carvalho, Leonel Correia, Ricardo Gomes, Juho Vepsäläinen

arXiv 2607.29338首次发表:更新:

AI 中文总结

本研究针对AI辅助编码生成Web应用的复杂性问题,提出基于Kotlin静态类型HTML DSL的后端驱动反应式Web应用方法,可减少JS需求并提升类型安全性。

AI 中文摘要

AI辅助编码工具(如Copilot、Cursor、Claude)日益普及,可快速生成Web应用,但引发了关于生成系统的复杂性、生命周期及长期可维护性的担忧。复杂性的一个关键来源是后端与前端编程模型的异质性,单个应用中结合多种语言和范式,常导致逻辑重复和状态管理碎片化。为解决该问题,近期方法(如HTMX、Turbo Hotwire、Datastar等)遵循超媒体驱动应用(HDA)模型,将HTML作为客户端与服务器间的主要通信媒介。与以单页应用(SPA)为中心的架构不同,HDA系统将应用状态和交互逻辑转移至服务器,后端驱动的反应式信号与客户端用户界面同步。然而,这些方法仍因自定义属性引入复杂性,且未完全消除JavaScript,尤其是在计算表达式中。本研究提出一种基于Kotlin的静态类型HTML领域特定语言(DSL)方法,用于后端驱动的反应式Web应用。我们通过静态类型构建器,在HtmlFlow Kotlin DSL中扩展类型化自定义HTML属性(即Datastar data-*属性)和基于信号的绑定。我们通过反应式交互模式目录和Petclinic Spring MVC案例研究演示该方法。结果表明,所提方法几乎可消除对JavaScript的需求,同时提高类型安全性,并在后端驱动、以信号为中心的架构桥接下,保持前端与后端间的同构编程模型。

英文摘要

AI-assisted coding tools (e.g., Copilot, Cursor, Claude) are increasingly ubiquitous and enable rapid generation of web applications. However, this raises concerns regarding complexity, longevity and the long-term maintainability of generated systems. A key source of complexity is the heterogeneity between backend and frontend programming models, where multiple languages and paradigms are combined within a single application, often leading to duplicated logic and fragmented state management. To address this issue, recent approaches (e.g., HTMX, Turbo Hotwire, Datastar, etc.) follow the Hypermedia-Driven Application (HDA) model, positioning HTML as the primary communication medium between client and server. Unlike SPA-centric architectures, HDA systems shift the application state and interaction logic to the server, where backend-driven reactive signals synchronize with the client user interface. However, these approaches still introduce complexity through custom attributes and do not fully eliminate JavaScript, particularly in computed expressions. In this work, we propose a statically typed approach using a Kotlin-based HTML DSL (Domain-Specific Language) for backend-driven reactive web applications. We extend the HtmlFlow Kotlin DSL with typed custom HTML attributes (i.e., Datastar data-* attributes) and signal-based bindings using statically typed builders. We demonstrate the approach through a catalog of reactive interaction patterns and a Petclinic Spring MVC case study. The results indicate that the proposed approach can nearly eliminate the need for JavaScript while improving type safety and preserving a homogeneous programming model across frontend and backend, bridged through a backend-driven reactive, signal-centric architecture.

CommentsSubmitted to Software: Practice and Experience (Wiley)

论文原文

arXiv 摘要页 · PDF 原文 · HTML 原文

↑