<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: gelinard</title>
    <description>The latest articles on DEV Community by gelinard (@gelinard).</description>
    <link>https://dev.to/gelinard</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F85283%2Fb72e0726-af7d-4aed-bab4-6426c66c1cef.png</url>
      <title>DEV Community: gelinard</title>
      <link>https://dev.to/gelinard</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gelinard"/>
    <language>en</language>
    <item>
      <title>Remodel, don't rewrite: how to renovate a legacy .NET app while you still live in it</title>
      <dc:creator>gelinard</dc:creator>
      <pubDate>Wed, 25 Nov 2026 04:12:22 +0000</pubDate>
      <link>https://dev.to/gelinard/remodel-dont-rewrite-how-to-renovate-a-legacy-net-app-while-you-still-live-in-it-27ng</link>
      <guid>https://dev.to/gelinard/remodel-dont-rewrite-how-to-renovate-a-legacy-net-app-while-you-still-live-in-it-27ng</guid>
      <description>&lt;p&gt;Every company has one.&lt;/p&gt;

&lt;p&gt;The database that's older than some of the interns. The one with 412 stored procedures, a table called &lt;code&gt;tbl_Rental&lt;/code&gt;, and a procedure named &lt;code&gt;sp_DoStuff_FINAL_v2&lt;/code&gt; that nobody dares to open. The website reads from it. The reports read from it. A nightly job writes to it at 2 AM. And somewhere in finance, there's an Excel macro that stops working if you rename a single column.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqg0lztxcckbjq8okhqlv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqg0lztxcckbjq8okhqlv.png" alt="A legacy database with everything hanging on to it" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You just want to add one column. Everybody else wants you to &lt;em&gt;not touch anything&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The big rewrite fantasy
&lt;/h2&gt;

&lt;p&gt;Sooner or later, someone in a meeting says the magic words: &lt;em&gt;"Let's just rewrite it."&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Month 1:&lt;/strong&gt; "This will be quick."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Month 9:&lt;/strong&gt; "We're almost there."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Month 18:&lt;/strong&gt; You now have two systems. The old one is still running the business. The new one is 80% done, and has been 80% done for six months.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzt3d1p8vcgqp89u9oqdo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzt3d1p8vcgqp89u9oqdo.png" alt="The big rewrite versus remodeling one room at a time" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nobody bulldozes their house because the kitchen is ugly. You &lt;strong&gt;remodel&lt;/strong&gt;. One room at a time, while you still live there. The foundation stays where it is.&lt;/p&gt;

&lt;h2&gt;
  
  
  The idea
&lt;/h2&gt;

&lt;p&gt;That's the whole idea behind &lt;strong&gt;Remodel Architecture for .NET&lt;/strong&gt;, a small open source template I built for exactly this situation:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pick one room&lt;/strong&gt;, a business area with clear edges, and turn it into a clean module.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The module says what data it needs&lt;/strong&gt;, without caring where that data comes from.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plug in adapters&lt;/strong&gt; that talk to the database you already have.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When the room is ready, plug in a new database.&lt;/strong&gt; Old and new rooms live side by side.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;No big bang. Every step ships on its own.&lt;/p&gt;

&lt;h2&gt;
  
  
  Plugs and sockets
&lt;/h2&gt;

&lt;p&gt;Here's the trick that makes it work. The module never talks to the database. It only offers a &lt;strong&gt;socket&lt;/strong&gt;: a small interface that describes what it needs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// The module only says what it needs...
interface IFooReader
    GetFoo(id)

// ...and doesn't care who answers.
DapperFooReader : IFooReader     // asks the old stored procedure
EfCoreFooReader : IFooReader     // asks the old tables with LINQ
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F05pxthbsouk3q0omp77p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F05pxthbsouk3q0omp77p.png" alt="Ports and adapters explained as plugs and sockets" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Architects call this &lt;em&gt;Ports and Adapters&lt;/em&gt;, or hexagonal architecture. I call it plugs and sockets, because that's what it is. You switch plugs with one setting, and the module never notices. Today, the old stored procedures. Next year, a shiny new database. Same socket.&lt;/p&gt;

&lt;h2&gt;
  
  
  Same exam, every adapter
&lt;/h2&gt;

&lt;p&gt;Plugs are great, until two plugs behave differently.&lt;/p&gt;

&lt;p&gt;Stored procedures are like grandma's recipes: there's always a secret ingredient nobody wrote down. In the sample app, the procedure quietly hides deleted rentals with a &lt;code&gt;WHERE DelFlag = 'N'&lt;/code&gt;. It isn't documented anywhere. It's just... there.&lt;/p&gt;

&lt;p&gt;Now imagine writing a new plug with LINQ. You look at the tables, you write a lovely clean query, and you forget grandma's secret ingredient. Deleted rentals start showing up in the app. Nobody notices until a customer does.&lt;/p&gt;

&lt;p&gt;So every socket gets &lt;strong&gt;one exam&lt;/strong&gt;, and every plug has to pass it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exam "deleted rentals stay hidden":
    given a car with one normal rental and one deleted rental
    when  we ask the plug for the car's history
    then  we get exactly one rental back

run the exam on: the Dapper plug, the EF Core plug, (your next plug)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj7zmrpkj7wvlonfj9cmq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj7zmrpkj7wvlonfj9cmq.png" alt="The same contract test for every adapter" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The exam runs against a &lt;strong&gt;real SQL Server in Docker&lt;/strong&gt;, not a mock. To check that it really protects anything, I removed the secret ingredient from the EF Core plug on purpose. Exactly one test failed, for EF Core only.&lt;/p&gt;

&lt;p&gt;That's the safety net that turns "move this module to a new database" from a leap of faith into a normal step. In the docs, these are called &lt;em&gt;contract tests&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bouncer
&lt;/h2&gt;

&lt;p&gt;Good intentions are nice. A build that fails is better.&lt;/p&gt;

&lt;p&gt;The core of each module is a VIP room, and there's a list at the door:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No database libraries in the core.&lt;/li&gt;
&lt;li&gt;Read operations never use the parts that write data.&lt;/li&gt;
&lt;li&gt;No giant "do everything" repository classes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgk25xv30caom5gkarvkq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgk25xv30caom5gkarvkq.png" alt="Architecture tests as a bouncer at the door" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The bouncer is a set of &lt;em&gt;architecture tests&lt;/em&gt; that run on every build. Break a rule and the build goes red, no wiki page required.&lt;/p&gt;

&lt;p&gt;My favorite detail: modules are found by convention. When I added a second module to the sample, the bouncer started checking it on its own. I didn't write a single new test.&lt;/p&gt;

&lt;h2&gt;
  
  
  Old and new, side by side
&lt;/h2&gt;

&lt;p&gt;The sample is a tiny car rental business with two houses on the same street:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsn4sr94i9j7roo4x2u3w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsn4sr94i9j7roo4x2u3w.png" alt="The legacy module and the new module side by side" width="800" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fleet&lt;/strong&gt; is the old house. Its business rules live in stored procedures, and its SQL Server database can't change. It has two plugs: Dapper and EF Core.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bookings&lt;/strong&gt; is the new house. It owns a fresh PostgreSQL database, and its rules live in plain C#.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both run in the same app. That's the &lt;em&gt;Strangler Fig&lt;/em&gt; pattern: the new part grows around the old part until, one day, the old part is small enough to retire. Quietly. With cake.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it costs
&lt;/h2&gt;

&lt;p&gt;No architecture is free. Here's the honest bill:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;More projects.&lt;/strong&gt; Every module has a core, plus one project per plug. Central package management keeps the project files tiny.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A bit of duplication.&lt;/strong&gt; Both plugs translate the same legacy error codes. The exam keeps the two copies honest.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exams test behavior, not SQL.&lt;/strong&gt; A plug can pass by luck, for example when the database already returns rows in the right order. (Ask me how I know.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;My own tiny mediator.&lt;/strong&gt; I skipped MediatR because of its licensing for companies. It's about 150 lines, but now they're &lt;em&gt;my&lt;/em&gt; 150 lines.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When not to bother
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A brand-new app with a database you fully own?&lt;/strong&gt; Keep it simpler.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A rich domain with tricky business rules?&lt;/strong&gt; Add a domain model inside a module, or pick a DDD template.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Microservices from day one?&lt;/strong&gt; This is a modular monolith. Extract modules later, if you ever need to.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;It's open source (MIT) and comes with a working sample, tests, and short notes explaining every design decision.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://github.com/gelinard/remodel-architecture" rel="noopener noreferrer"&gt;github.com/gelinard/remodel-architecture&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Clone it, run &lt;code&gt;dotnet test&lt;/code&gt; (you'll need Docker), then break a rule on purpose. Watching the bouncer catch you is weirdly satisfying.&lt;/p&gt;

&lt;p&gt;And I'd love to hear your legacy war stories: &lt;strong&gt;what's the strangest stored procedure you've ever found?&lt;/strong&gt; 👇&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>architecture</category>
      <category>legacycode</category>
      <category>testing</category>
    </item>
    <item>
      <title>Programmer-Being, being a programmer</title>
      <dc:creator>gelinard</dc:creator>
      <pubDate>Wed, 03 Jan 2024 14:07:54 +0000</pubDate>
      <link>https://dev.to/gelinard/programmer-being-being-a-programmer-gl6</link>
      <guid>https://dev.to/gelinard/programmer-being-being-a-programmer-gl6</guid>
      <description>&lt;p&gt;Being a developer, or a programmer (if it's whats suits you), is for me a very cool job (or life). What computing world, bytes and all those technical stuffs can offer, we must be the one person to understand it and present it to the naive world. Moreover, we must do so with grace and confidence, turning rigid electric universe into flow and art, that others can appreciate.&lt;/p&gt;

&lt;p&gt;But keep in dear mind, we are all just humans, in a sense that some of us have jobs (or projects), friends (or enemies), families and of course our self, which we need to look at care for.&lt;/p&gt;

&lt;p&gt;As we wander into reality of life, we find ourselves conflicted yet excited, wanting more but contented, and challenged but happy. We knew all the intricate details but are used see the big picture. We try to be humble and relaxed in a way that others may understand us and that we may understand them.&lt;/p&gt;

&lt;p&gt;Being great ang having these cool 'specifications' give us edge that we can use to help others and ultimately help the world. We began a simple 'Hello, world' but how will it end will be up to us. So keep on learning, keep on wanting more and just do it. Never give up, never lose hope, keep the faith and do good. After all, developers are all humans.&lt;/p&gt;

&lt;p&gt;Peace\n&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
