Readit News logoReadit News
markusschlegel commented on Website as a Function from URL to HTML [video]   youtube.com/watch?v=iU5RN... · Posted by u/markusschlegel
markusschlegel · 3 months ago
Building websites seems straightforward. You pick a static site generator and start writing content. However, these websites quickly grow into full-blown software projects. Suddenly, your SSG – its rigid template system, scattered configuration and ad-hoc Markdown – is holding you back for its lack of proper abstraction mechanisms.

In this talk, we start fresh. Our design approach is driven by one simple insight: Static websites are just functions mapping URLs to HTML. This marks the beginning of our journey in developing our own SSG. In the end we arrive at a bespoke domain-specific language in OCaml.

While this exploration may sound theoretical – or even playful – it has substantial practical implications. By treating our website as a function, we can embrace robust engineering practices: clearly separating domain logic from presentation, following the single-responsibility principle, reducing coupling, and ensuring cohesion.

markusschlegel commented on The Testability of Pure Functions   funktionale-programmierun... · Posted by u/markusschlegel
markusschlegel · 5 months ago
As an argument in favor of pure functions, functional programmers often cite better testability: pure functions require no complicated test setup or mocks, are deterministic, parallelizable, etc. In tendency, this is certainly correct. Pure functions are often better suited for testing than their impure counterparts. However, this connection is not a neccessary implication in either direction: There are pure functions that are hard to test, and there are impure functions that are easy to test. Thus purity itself cannot be the substance that ensures a piece of program is properly testable. But then what is this substance?

u/markusschlegel

KarmaCake day21September 24, 2017View Original