Skip to content

Instantly share code, notes, and snippets.

@johndenverscar
johndenverscar / gist:84175cf9bd485eb4325f3f7805cd92c2
Created July 29, 2025 22:01
Clean Architecture Example - Python User Service
# ==========================================
# ENTITIES LAYER - Enterprise Business Rules
# ==========================================
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Optional, List
import re
@dataclass
;; Abstractions with multimethods, protocols, records
;; multimethods
;; useful for overloading based on dispatching
;; vnice
(ns ware-creatures)
(defmulti full-moon-behavior (fn [were-creature] (:were-type were-creature)))
;; Typical multimethods look like so...
(defmethod full-moon-behavior :wolf ;; dispatching value is a keyword