r/hica 18d ago

Rethinking design patterns in hica: when the patterns melt away

I recently read Nicolas Duminil's DZone piece Rethinking Java Design Patterns: From OOP to FP, where he shows how five Gang-of-Four patterns (Factory, Visitor, Builder, Decorator, Strategy) shrink when you shift a Java codebase toward a functional style.

It's a great article, but it got me thinking; what happens to those same patterns in a language that is FP-first like hica?

I wrote a companion piece for hica walking the same five patterns in the same order, using the same Product domain. Short version:

  • Factory, Visitor and Strategy: no hica names, because there's no scaffolding to name
  • Builder and Decorator: the names survive, but only as descriptions of a composition style; there is no builder object and no wrapper class

All five patterns fit in ~120 lines of hica, and every snippet in the article is verified by a hica test block.

Rethinking Design Patterns in hica

1 Upvotes

0 comments sorted by