HN
Today

Biff.core: system composition for Clojure web apps

A new library, biff.core, emerges from a major refactor of the Biff web framework, aiming to simplify system composition for Clojure web apps. It introduces 'init functions' to reduce boilerplate when combining modules into an application's system map. This release is crucial for Clojure developers seeking a cleaner, more modular approach to managing application structure and hot-reloading.

11
Score
3
Comments
#7
Highest Rank
3h
on Front Page
First Seen
Jun 9, 4:00 PM
Last Seen
Jun 9, 6:00 PM
Rank Over Time
7710

The Lowdown

The author introduces biff.core, the inaugural release from a significant overhaul of the Biff web framework. Positioned as the foundational "glue" for Biff 2.x, this library focuses on streamlining how web applications are composed from various modules and components.

  • Simplifying System Composition: The primary goal of biff.core is to reduce the boilerplate previously required to combine application modules into a singular "system" map. This structure now enables libraries to integrate more seamlessly by simply adding a module without extensive manual configuration.
  • Introducing Init Functions: The core innovation is "init functions." These functions accept a collection of modules and return a map ready to be merged directly into the application's system map, simplifying the overall project structure.
  • Addressing Hot-Reloading Challenges: A significant design challenge was maintaining the late-binding benefits essential for hot-reloading in development. The solution involves init functions taking a var of the modules vector, and critical system map keys becoming functions that dereference this var and utilize memoization for efficient updates without server restarts.
  • Philosophy on Component Management: The author intentionally avoids implementing a complex dependency management system for components, arguing that manual ordering is clearer and sufficient for most projects, maintaining simplicity and ease of understanding.

Ultimately, biff.core offers Clojure developers a more elegant and less verbose way to structure web applications, providing practical solutions for module integration and hot-reloading while adhering to a pragmatic design philosophy.

Biff.core: system composition for Clojure web apps - HN Today