<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>hexagonal on krtffl.dev</title>
    <link>https://krtffl.dev/tags/hexagonal/</link>
    <description>Recent content in hexagonal on krtffl.dev</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <copyright>© [krtffl](https://krtffl.dev)</copyright>
    <lastBuildDate>Mon, 14 Oct 2024 00:00:00 +0000</lastBuildDate><atom:link href="https://krtffl.dev/tags/hexagonal/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>hexagonal architecture in go without the ceremony</title>
      <link>https://krtffl.dev/posts/hexagonal-architecture-in-go/</link>
      <pubDate>Mon, 14 Oct 2024 00:00:00 +0000</pubDate>
      
      <guid>https://krtffl.dev/posts/hexagonal-architecture-in-go/</guid>
      <description>&lt;p&gt;every go web app i wrote before this one had The Struct. you know the one. it starts life innocent — three fields, a name, an id — and then someone needs to persist it, so it grows a &lt;code&gt;gorm:&amp;quot;primaryKey&amp;quot;&lt;/code&gt; tag. then it needs to go over the wire, so it grows a &lt;code&gt;json:&amp;quot;id&amp;quot;&lt;/code&gt; tag. then a &lt;code&gt;binding:&amp;quot;required&amp;quot;&lt;/code&gt; for the request validation, because why not. six months later that struct imports your orm, your web framework, and your validation library, and it has a method called &lt;code&gt;BeforeSave&lt;/code&gt; that quietly does business logic inside a database hook.&lt;/p&gt;
&lt;p&gt;that struct knows too much. it can&amp;rsquo;t be tested without a database. it can&amp;rsquo;t be reasoned about without opening four dependencies. and every time you change your database, your json api changes too, because they&amp;rsquo;re the same forty lines of code wearing three different hats.&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>
