4.2 KiB

layout, title, date, author, categories, tags
layout title date author categories tags
post A Tour of myPrayerJournal v3: Conclusion 2021-12-04 14:17:00 Daniel
Databases
LiteDB
Programming
.NET
F#
Programming
htmx
Projects
Giraffe.Htmx
Projects
myPrayerJournal
Series
A Tour of myPrayerJournal v3
angular
aurelia
bootstrap
elm
ember
f#
giraffe
html
htmx
javascript
migration
nuget
post-redirect-get
pug
react
single page application
spa
view engine
vue

NOTE: This is the final post in a series; see the introduction for information on requirements and links to other posts in the series.

We've gone in depth on several different aspects of this application and the technologies it uses. Now, let's zoom out and look at some big-picture lessons learned.

Simplification Via htmx

One of the key concepts in a Representational State Transfer (REST) API is that of Hypermedia As the Engine of Application State (HATEOAS). In short, this means that the state of an application is held within the hypermedia that is exchanged between client and server; and, in practice, the server is responsible for altering that state. This is slightly different from the concept of sessions, and completely different from the JSON API / JavaScript framework model.

(This is a near over-simplification; the paper that initially proposed these concepts earned its author a doctoral degree.)

The simplicity of this model is great; and, when I say "simplicity," I am speaking of a lack of complexity, not a naivete of approach. The amount of complexity and synchronization I was able to remove between myPrayerJournal v2 and v3 was quite large. State management used to be the most complex part of the application; now, it's the rendering of HTML. Since that HTML is what controls the state, this makes sense. However, I have 25 years of experience writing HTML, and the language itself is not terribly complex, even at its most complex.

htmx Support in .NET

I mentioned the project I developed as a part of this effort, and that I had become aware of htmx on an episode of .NET Rocks!. Giraffe.Htmx is very F#-centric, using features of that language that are not exposed in C# or VB.NET. However, there are two packages that work with the standard ASP.NET Core method of development. Htmx provides server-side support for the htmx request and response headers, similar to Giraffe.Htmx, and Htmx.TagHelpers contains tag helpers for use in Razor, similar to Giraffe.ViewEngine.Htmx. Both are written by Khalid Abuhakmeh, a developer advocate at JetBrains (which generously licensed their tools to this project, and developed the best developer font ever).

While I did not use these projects, I did look at the source, and they look good. Besides, the best way to improve an open-source library is to use it, and provide good feedback.