<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dawid Dominiak on Medium]]></title>
        <description><![CDATA[Stories by Dawid Dominiak on Medium]]></description>
        <link>https://medium.com/@dawiddominiak?source=rss-a89eef4289f2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cYEGYA3eI5FlWkotlEmEPw.jpeg</url>
            <title>Stories by Dawid Dominiak on Medium</title>
            <link>https://medium.com/@dawiddominiak?source=rss-a89eef4289f2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 01:11:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dawiddominiak/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Engine of Learning: How a Father’s “Quick Fix” Became Train Game]]></title>
            <link>https://medium.com/@dawiddominiak/the-engine-of-learning-how-a-fathers-quick-fix-became-train-game-63afb7799002?source=rss-a89eef4289f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/63afb7799002</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[gamedev]]></category>
            <category><![CDATA[edtech]]></category>
            <category><![CDATA[kids]]></category>
            <category><![CDATA[education-technology]]></category>
            <dc:creator><![CDATA[Dawid Dominiak]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 21:44:58 GMT</pubDate>
            <atom:updated>2026-03-27T10:53:27.536Z</atom:updated>
            <content:encoded><![CDATA[<p>It started with a 9-year-old, a kitchen table, and the stubborn wall of the multiplication tables. Like many parents, I watched my son struggle with the “boring stuff.” Rote memorization wasn’t working, and the frustration was mutual.</p><p>I decided to stop pushing and start building. Leveraging emerging AI technology to prototype at a speed that would have been impossible just a few years ago, I built a simple game. No more flat flashcards — instead, there were scores, win-states, and immediate feedback. Most importantly there was a train there as well turning left and right. The results were instant: he wasn’t just learning; he was <em>playing</em>.</p><h3>The “Strategy” of Success</h3><p>As the multiplication tables were mastered, new challenges appeared: Spanish, English, and Literature. From a technical standpoint, I realized I had a powerful engine on my hands. I implemented the <strong>Strategy Pattern</strong> — a programming architecture that allowed me to keep a consistent interface (the game experience) while swapping out the “strategy” (the subject matter) instantly. I was able to programmatically unable new challenges using new materials.</p><p>With my wife’s professional insight as an elementary school teacher, the vision shifted. This wasn’t just a tool for my son; it was a solution for every parent and teacher who wanted to turn their own materials into a rewarding 3D world. People just need simpler interface than Visual Studio Code. That’s when the final idea of Train Game was forged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g5uemSte4-e4isPi4I5J_A.png" /><figcaption>Rapid iterations in the early stages. They are a far cry from the product we see today.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2SQLjI2umxXQp0ZQTofJ9Q.png" /><figcaption>Modern 3D gameplay.</figcaption></figure><h3>Warsaw Digital Ventures: A Brand Built on Trust</h3><p>As the project grew, I realized <em>Train Game</em> was the first step in a much larger journey. I founded <a href="https://warsawdigital.ventures/"><strong>Warsaw Digital Ventures</strong></a> to serve as the umbrella for this and all future projects. The goal of the brand is simple: to create digital products that balance cutting-edge technology with human-centric values.</p><p>Commercializing a product under the Warsaw Digital Ventures banner meant moving beyond simple code. I spent weeks in <strong>Blender</strong>, teaching myself 3D modeling to create an inspiring environment. I integrated complex physics — because nothing says “you got it right” quite like a rewarding display of machinery and fireworks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x3BQTicjQsCrWHoLKaJzCg.png" /><figcaption>Blender 3D modelling</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M3eyQvraRVfWUILvRjfx1w.png" /><figcaption>I needed the brand to give credibility to the publishing house. I wanted it to be connected to the place where I’ve dedicated my life.</figcaption></figure><h3>The Fortress of Safety</h3><p>As I looked at the social aspect of the app — the ability for parents to share games with their communities — I hit a reality check. The digital world can be a dangerous place for children. I made a choice that defines the Warsaw Digital Ventures philosophy: <strong>safety is not a “feature” — it is the foundation.</strong> Today, over <strong>60% of the Train Game codebase</strong> is dedicated to AI-driven administration, proactively hunting for NSFW content and PII (Personally Identifiable Information). We aren’t just building games; we are building secure sanctuaries for young learners.</p><h3>The Cost of the Grind and the Florida Sun</h3><p>By early 2026, the project had become a second full-time job. I was working 16-hour days, seven days a week, balancing my regular career with the birth of this SaaS. I was exhausted, and my family was feeling the weight of my absence.</p><p>A long-planned vacation to the U.S. East Coast in January became my turning point. From the humid silence of the Everglades and the sun of Key West to surviving a “winter of the decade” in New York City, that trip gave me the perspective I needed. It reminded me that I was building this <em>for</em> my family, not just <em>instead</em> of being with them. I returned with the clarity and strength needed to cross the finish line, officially submitting the final product for App Store and Google Play review in early <strong>March 2026</strong>.</p><h3>The Track Ahead</h3><p>The future of AI in education is a complex conversation. There are costs, screen-time debates, and technical hurdles. But I believe in a future where AI makes learning deeply personal and long-term — where a tool doesn’t just “test” a child, but adapts to their specific goals.</p><p><strong>Train Game</strong> is our first contribution to that future. It’s a labor of love, a fortress of safety, and — of course — a tribute to the simple joy of keeping the train on the tracks.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FFB6Mi_PmgCQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFB6Mi_PmgCQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FFB6Mi_PmgCQ%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/66f387e6d97977feaab9856cc2f24a56/href">https://medium.com/media/66f387e6d97977feaab9856cc2f24a56/href</a></iframe><h3>Ready to get on board?</h3><p>The wait is over for Android users, and the journey is just beginning for everyone else. Whether you’re a parent tackling multiplication or a teacher building a custom language module, <strong>Train Game</strong> is ready for you.</p><ul><li>iOS &amp; Android &amp; Desktop Users:<strong> </strong><a href="https://traingame.onelink.me/QTrj?utm_source=medium&amp;utm_medium=blog-post&amp;utm_campaign=initial"><strong>Get it now</strong></a></li><li><strong>Stay in the Loop:</strong> Follow <strong>Warsaw Digital Ventures</strong> on <a href="https://www.linkedin.com/company/warsaw-digital-ventures"><strong>LinkedIn</strong></a><strong> / </strong><a href="https://x.com/WDVentures"><strong>X</strong></a><strong> </strong>for updates on our official iOS launch and future AI-powered learning tools.</li></ul><blockquote>“Stop the homework battles. Start the fireworks.”<em> 🚂</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63afb7799002" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stackdriver Debugger: A Story About Time Travel]]></title>
            <link>https://medium.com/swinginc/stackdiver-debugger-a-story-about-time-travel-ba954650f7f6?source=rss-a89eef4289f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba954650f7f6</guid>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Dawid Dominiak]]></dc:creator>
            <pubDate>Fri, 29 Nov 2019 12:43:25 GMT</pubDate>
            <atom:updated>2019-11-29T12:56:21.004Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s3g-sEPKf4TOMyghPRXneg.png" /><figcaption>Illustration: <a href="https://dribbble.com/adrianna_pisarska">Adrianna Pisarska</a></figcaption></figure><p><strong>This whole article intended to be a short story. I tried a tool that helped in my programmers’ work and wanted to encourage you to join it to your stacks and give it a try.</strong></p><p>Then I started to read more and more, and the story grew.</p><p>It’s a story about debugging.</p><p><em>“Horse is as everyone can see”</em> was a definition of a horse in the first polish language encyclopedia (New Athens, Benedykt Joachim Chmielowski). There was a time when defining a horse was useless because everyone knew what a horse was. It is, more or less, like debuggers for programmers. <strong>Debugging is a natural part of our work.</strong> We are traveling back in time trying to inquire what happened. Debuggers have been with us since we were born, so we can say they have been with us forever.</p><p>Debuggers survived unchanged for a long time (at least it seems to be like that), but do you know the real story behind debuggers? The story, like every debugging story, starts with a breakpoint.</p><p>ENIAC was officially the first computer ever built. It was a big machine at the University of Pennsylvania helping in ballistic calculations, nuclear weapon creation, cosmic ray research, and even weather forecasting. ENIAC was initially programmable by switching wires and plugging cables from one unit to another to set program flow. <strong>To make the program stop at a certain point, the programmer would eliminate the wire.</strong> Then the current state could be read, and such a state was called a breakpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jMBFzdNe1wg8ICh4V-VSNA.jpeg" /><figcaption>ENIAC</figcaption></figure><p>Time passed, and computers rapidly changed. Some of you should be familiar with built-in console debuggers. C, FORTRAN introduced such tools, and it was a significant change compared to looking into the state of wires or memory.</p><p>IDE’s as all-in-one tools with built-in debuggers were the last significant change in debugger architecture.</p><p><strong>Nothing seems to have changed for 30 years. </strong>We still have debuggers with a similar set of possibilities. Let’s come back one more time to the real purpose of the debugger. With a debugger, we’re traveling back in time trying to inquire what happened. Only a few debuggers really can do such a fundamental thing.</p><p>I found a great master thesis — <em>“</em><a href="https://pdfs.semanticscholar.org/cc0d/848feb5f39be5047619884d632e727f3b699.pdf"><em>Combining reverse debugging and live programming towards visual thinking in computer programming</em></a><em>”</em> by Abraham Liebrecht Coetzee presented in partial fulfillment of the requirements for the degree of Master of Science in Computer Science at Stellenbosch University (Matieland, South Africa). The author indicates that <em>“forward debugging”</em> is about manually going through the entire <strong>stop-rerun-navigate cycle to simulate a single backward step</strong>, which as we already know is an essential task of the debugger.</p><p>Solutions exist on the market that allow us to do it more naturally. We can divide such a solution into two groups.</p><p>The first one is omniscient debuggers. Such debuggers store the whole testing session record, and we can debug the recorded session later. The first invention in this area was the <strong>EXDAMS system (1969)</strong>. Nowadays it’s a quite common technique. GDB in Linux or IntelliTrace in the Windows family is a usage example. The second group of debuggers is <strong>real reverse execution</strong>. I haven’t seen many implementations of such a technique available among others in GDB or commercial UndoDB. The system forks the new instance of the application with a specific state, calculates the snapshot between two processes, and store it. Despite its obviousness known pattern it’s still not common to see the “back” button in modern debuggers.</p><blockquote>With a debugger, we’re traveling back in time trying to inquire what happened. Only a few debuggers really can do such a fundamental thing.</blockquote><p>I’m a loyal node.js developer, and although I have moments of weakness, where I need to have an affair on the side, <strong>I miss the Microsoft time travel debugger </strong>when coming back from my mistress, .NET. I close my eyes and dream about a tester testing my application and describing a bug with a recorded test session.</p><p>One day I thought my dreams came true. I found the<strong> </strong><a href="https://cloud.google.com/debugger/"><strong>Google Stackdriver Debugger</strong></a>, and I decided to redefine my real requirements, draw essences of essences. Google Stackdriver debugger is not ideal. There is just a snapshot, no back button, no session recording, no reverse execution. It must be enough for me, and it is — it helps a lot when debugging bugs in real code.</p><p>Let’s check the real example. Bootstrap is very simple, especially for Google Cloud users, but <a href="https://cloud.google.com/debugger/"><strong>Stackdriver Debug</strong> </a>can be used independently on your provider. In such a case, we should install Google Cloud Debug Agent and set up all needed permissions. The whole process looks a little bit different depending on the technology used and is not a part of this article. Excellent “zero to hero” documentation can be found <a href="https://cloud.google.com/debugger/docs">here</a>.</p><p>Once installed, Stackdriver Debug allows us to add a snapshot point, being an equivalent of a breakpoint. The interface is very intuitive and somehow familiar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F2BiwixcmIU7GtY6imXPTA.png" /><figcaption>The main window of the Stackdriver Debug interface.</figcaption></figure><p>The snapshot will be taken when the real application will perform the stage defined by the code, so we need to ensure that this line was “executed on production”. In our case, we need to just do the GET request to /.</p><p>Once taken, the snapshot point can be viewed on the bar on the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*XWQ6hRJHIR6Bn1VXecyNiQ.png" /><figcaption>Taken snapshot visible on the bar on the right. There is also the call stack visible below.</figcaption></figure><p>There are variables and a call stack available. We can also type a condition to snapshot point or expression to be executed during runtime. Such a possibility is limited by the application agent, so we need to turn it on. The snippet in node.js can be found below.</p><pre>const agent = require(&quot;@google-cloud/debug-agent&quot;);</pre><pre>agent.start({</pre><pre>  allowExpressions: true</pre><pre>});</pre><p>Stackdriver Debugger is not an ideal solution, because<strong> it is limited to just a single point in time.</strong> I treat it rather as the first, important step, I’ve been waiting for. I will for sure test it in my own production applications, waiting excitedly for future improvements. I expect to add a session record possibility in the future. Is it possible? The future of time travel looks exciting.</p><p>From the point of view of the entire history of debuggers, this is just a small footprint. <strong>I think it is important considering the stagnation of the last 30 years. </strong>What is your opinion? Are you going to give the Stackdriver Debugger a chance?</p><p><em>If this article has been interesting and useful to you, leave👏. Thank you! You can also check out another interesting story from my colleague — </em><a href="https://medium.com/swinginc/first-touch-to-flutter-native-development-within-a-cross-platform-framework-is-it-real-da0fd79a056f"><strong><em>First Touch to Flutter</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba954650f7f6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swinginc/stackdiver-debugger-a-story-about-time-travel-ba954650f7f6">Stackdriver Debugger: A Story About Time Travel</a> was originally published in <a href="https://medium.com/swinginc">SwingDev Insights</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What's up in Vietnam]]></title>
            <link>https://medium.com/swinginc/whats-up-in-vietnam-9ab4e9d8d681?source=rss-a89eef4289f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ab4e9d8d681</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Dawid Dominiak]]></dc:creator>
            <pubDate>Thu, 07 Jun 2018 14:48:03 GMT</pubDate>
            <atom:updated>2018-06-07T14:48:03.775Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>What’s up in Vietnam</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Upvp52PbYomUs5oRd1FUg.png" /></figure><h3><strong>Introduction</strong></h3><p>Is there a more sophisticated parallel to a particular part of computer science than the situation in Vietnam? The first brave soul was Ted Neward with his article “The Vietnam of Computer Science” comparing Object Relational Mapping to one of the most disgraceful conflicts in the history of United States. It was written in 2006. 12 years have passed, and a lot has changed in the approach to ORM.</p><h3><strong>What the Object Relational Mapping stands for?</strong></h3><p>Following the definition on Wikipedia <em>it’s a technique for converting data between incompatible type systems using object-oriented programming languages.</em> To be more precise it’s converting relational data to the object-oriented domain model (OODM) and OODM to relational data. Conversions like that can be done in several ways, but the most common approach is to use a tool called ORM library or ORM framework.</p><h3><strong>Why is it problematic?</strong></h3><p>“Incompatible type systems” are mentioned already in the definition, and all incompatibilities are potential problems. First question that popped into my head after getting into the subject was: „Why the hell are we using incompatible systems? Why is it the first (and often the only one known) solution to solve the problem with persisting data?”</p><blockquote>If your project really does not need any relational data features, then ORM will work perfectly for you, but then you have a different problem: you’re using the wrong data store. […] On the other hand, if your data is relational, then your object mapping will eventually break down.</blockquote><blockquote><em>Laurie Voss</em></blockquote><h4><strong>Let’s characterize these two worlds</strong></h4><blockquote>Object systems are typically characterized by four basic components: identity, state, behavior and encapsulation.</blockquote><blockquote><em>Ted Neward</em></blockquote><p>Elaborating on the above we can say though, that every object is described by its identity independent of its state. Every object has a collection of operations that can be invoked to manipulate the state of itself or connected objects, and (most importantly) has encapsulated access to itself and effectively, ability to inherit and polymorph.</p><blockquote>The representation of your object in memory depends [sic] what you intend to do with it, and context-sensitive representation is not a feature of OO design.</blockquote><blockquote><em>Laurie Voss</em></blockquote><p>On the other hand, relational systems describe the set of truths related to each other. Although thanks to the 4th generation language — DML — we can easily retrieve the facts hidden behind relations, it’s not the most efficient way to store the state of a collection of objects.</p><h3><strong>How is it working under the hood?</strong></h3><p>There are two patterns that ORM frameworks use: <strong>Active Records</strong> and <strong>Data Mapper</strong>.</p><p>With Active Records, each model object inherits merely from a base Active Record object.</p><p>Example:</p><pre>kate = new User(“Kate”)<br>kate.save()</pre><p>Base Active Record objects contain an implementation of all methods connected with persistence. It can be clearly seen that Single Responsibility Principle is broken entirely here, but there are even more problems with this approach. Such objects make tests harder and less intuitive. They spoil the common language. Kate is not able to save itself or delete itself in the real world. Objects stopped being models of reality and became data containers. It’s much harder to achieve real encapsulation using this type of containers.</p><p>Data Mapper, despite its lower popularity, seems to be a better choice. As you can guess the Data Mapper does not clutter our OODM. Instead, a separated service called EntityManager is mapping the state of our domain objects to a DML and back.</p><p>For example:</p><pre>kate = new User(“Kate”)</pre><pre>EntityManager::perist(kate)</pre><p>Thanks to that we can achieve a more tidy domain model and hide all the dirt behind repositories — at least in theory. The way it’s being done seems like magic to most developers. For example, there is a huge document about working with different fetching types in JPA on <a href="https://docs.jboss.org/hibernate/orm/3.6/reference/en-US/html/performance.html#performance-fetching-lazy">this page</a>. If you are using Hibernate, those fetching types can be overridden by Hibernate specific types if JPA type is EAGER (more <a href="https://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#fetching-fetch-annotation">in the documentation</a>). As a result we are fetching from repositories’ proxies (not real domain models) in some situations and domain models in other cases. Default settings are different in different ORM frameworks and different technologies. But it’s a fact that sometimes we get proxies behind „the repository gate” and we need to remember about it and deal with it on a higher level of abstraction like services or even controllers.</p><p>As you can see, the use of ORM almost always affects the entire application design. It already sounds awful that the whole app should depend on one tool. However, the real hell is waiting behind „the repository gate”.</p><h3><strong>Real life case</strong></h3><p>Let’s imagine that we received a request from a client to create „an application to support a set of smart devices that can be connected”. Every device has a common controller so the best model of reality would be to create an abstract class <em>SmartDevice</em> and let other devices inherit from this one. We can additionally categorize similar devices to not implement same methods twice, so we’ll create groups such as <em>LightManagementDevice</em>, <em>HeatingDevice</em>, <em>SecurityDevice</em> with common methods such as <em>callThePolice</em>. In the end, we create devices such as <em>SmartLamp</em>, <em>SmartRobot</em>, <em>SmartCamera</em>, etc. The number of types of devices we need to handle is around 120. Every instance of a device has a new unique ID and should be easily searchable by this ID.</p><p>Let’s try to solve this challenge.</p><h4><strong>Table-per-class approach</strong></h4><p>This is the normalized way to achieve mapping. Every single child class maps to a separate table with properties. Such tables are linked to a table representing a parent class. The <em>smart_devices</em> table is in the 1:n relation with <em>light_management_devices</em>/<em>heating_devices</em>/<em>security_devices</em>/<em>etc.</em> Tables <em>light_management_devices</em>/<em>heating_devices</em>/<em>security_devices</em> are in 1:n relation with more specific classes. So what’s the disadvantage? Try to create a DML to retrieve a record by its ID manually. It’s impractical. We also have to create two artificial primary keys to determine records for more specific tables. Even if it all happens behind the scenes, it’s a very inefficient way of retrieving data.</p><h4><strong>Table-per-concrete-class approach</strong></h4><p>This approach has similar disadvantages. Every single class maps to a separate table with all object and parents properties as columns. Let’s try to retrieve ten most recently updated devices. We need to union all data in a really obscure way (creating many Null columns):</p><pre>SELECT Col1, Col2, Null as Col3 FROM light_management_devices,</pre><pre>UNION Col1, Null as Col2, Col3 FROM heating_devices.</pre><p>… and then order by production date. It’s even more impractical and inefficient.</p><h4><strong>Table-per-hierarchy approach</strong></h4><p>It’s the most denormalized approach, but almost all projects I know tend to turn towards it after performance tests. Of course, creating super-tables (we have just one) is also a bad solution. Apart from obvious problems resulting from denormalization, we need to handle the database limitations (for example the maximum number of columns for InnoDB engine of MySQL is 1017). It’s less than nine specific properties per single device in our case. Besides, our application becomes unscalable.</p><p>It seems like there is no right way to achieve it. Every approach has a lot of limitations.</p><blockquote>Essentially what you are doing is synchronizing between two quite different representations of data.</blockquote><blockquote><em>Fowler.</em></blockquote><p>Fowler is right about this. A camera is not related to a smart device in the real world. We’re bending reality so that it conforms to the relational database.</p><h3><strong>Is there any good solution to our problem?</strong></h3><p>Yes, we showed it in the first sentence of our problem’s definition. It actually isn’t even our solution. Our customer gave it to us. He wanted to create „an application to support a set of smart devices”. It means that we want to store a set of some data about a set of smart devices. And what’s the easiest way to save a set of data? Find a database that supports sets. There is a lot of them: AWS DynamoDB, InfinityDB, Redis, and others. Such data set can easily be mapped to documents too. And there are even more promising databases such as MongoDB or document store built into PostgreSQL.</p><p>There are a lot of other databases matching different requirements. For example, we have very useful graph databases such as Neo4j (excellent database), column stores, spatial databases, probabilistic databases and many others.</p><h3><strong>„OK, but I’m confident my data is relational and I need to use OO application design because of some reason.”</strong></h3><p>I will tell you a story.</p><p>Once I had a task to create quite a complex ranking. Ranking should be handled for 27 000 live active users. Every activity of a user should be reflected on a live scoreboard. My first thought was to create some simplified CQRS with a system like Apache Kafka calculating the ranking based on the stream of events.</p><p>Then my tech leader advised me: „don’t do it, use Sphinx”. I was completely lost, because Sphinx is a full-text search engine. How the hell is it supposed to create ranking? Every row should have a full-text column. What to do with it? „Just leave it empty”, he said.</p><p>In the meantime, our team went to a Neo4j conference, hosted by CD Project game development studio. They were creating a large-scale online card came — Gwent. I realized that they have to have even more problems with ranking, so I asked how they deal with it. „We’re using Sphinx” they answered. Then my tech lead asked them: „Why Sphinx? It’s a full-text search engine. How do you deal with a mandatory full-text field in a row?”. „Yeah, but it’s the simplest way to achieve it, and we just leave this mandatory field empty” they answered. I made a fool of myself.</p><p>This text is a bit naive too. I’m not forcing you to use a more difficult tool to achieve a kind of developers’ nirvana. Relational databases and ORMs are advanced tools and I’m using them often. Firstly, just think a little bit if chosen technology fits your requirements. Relational databases and ORMs are not the only right choice, it shouldn’t even be a default. It should be a careful decision.</p><h3><strong>So … what changed since Vietnam War and what are we yet to solve in ORMs?</strong></h3><p>So, 12 years have passed.</p><p>1. Some problems have evolved. Joins are much faster now thanks to solutions like ClusterixDB. There are new built-in mechanisms in relational databases. We can store documents in a PostgreSQL database. It’s still not the best idea to create DML query with dozens of joins, but modern databases are optimized for less complex queries.</p><p>2. Over time, composition started winning over inheritance in OOP. Mapping composition to RDBS is easier thanks to its relational origin.</p><p>3. Using the same database by two applications is seen as bad practice. This and other problems mentioned by Ted Neward seem a little outdated. But on the other hand, there are many distributed applications with dozens of services. Updating such a service with a database migration is not an easy task. There will be a time when one service needs to work with two versions of a database. Forcing ORM framework to work with two different versions of the database is almost impossible in a neat and easy to achieve way.</p><blockquote>As a result, as the system grows over time, there will be increasing pressure on the developers to “tie off” the object model from the database schema, such that schema changes won’t require similar object model refactorings, and vice versa.</blockquote><blockquote><em>Ted Neward</em></blockquote><p>4. HQL, DQL, and other object-based languages evolved and became more powerful, but are still less flexible than plain DML.</p><blockquote>Even if 80% of users need only 30% of the features of SQL, then 100% of users have to break your abstraction to get the job done.</blockquote><blockquote><em>Laurie Voss</em></blockquote><p>This problem applies to the whole ORM concept. By escaping the abstraction of ORM anywhere in the code, we’re also breaking the abstraction of Unit of Work, losing transactions, calling for unnecessary data and making objects inside unit of work dirty without marking them as dirty. List of side effects of breaking ORM framework abstraction by using plain SQL is long and depends on a specific framework and conditions.</p><p>5. Sometimes our objects are stored inside an existing process in some kind of a cache. Database migration mechanism is often delivered with the ORM framework. There is an entirely different situation with cache migrations systems. We need to solve each of these cases manually.</p><p>6. Usually, more powerful ORM frameworks have lazy loading mechanism. This feature is neither consistent nor obvious (traditionally implemented by proxy design pattern), and we need to be careful not to DDoS the database by an iteration that looks innocent at a first glance.</p><p>7. ORM frameworks using Active Record pattern incentivize bad practices, like mixing persistence layer with the domain layer, creating anemic domain objects and breaking the Single Responsibility Principle. Trained software architects can avoid this and retain the sharp separation between persistence and domain model in exchange for painful maintenance.</p><h3><strong>Summary</strong></h3><p>As we can see, Vietnam is slowly changing, or to be more precise: it adjusts itself to the external world. Is it enough to deal with it in its current form? It depends. I’m not against ORM frameworks in general. There are places where we’re operating on relational data which can be mapped simply to the object-oriented world. Especially in small applications with domination of composition in the domain layer. What to do in other situations? Get to know and consider all limitations an ORM framework imposes and deal with it … or find a different solution.</p><ol><li>Use a proper database to your need. Maybe it’s better to use a document storage/key-value store (like in the example with smart devices), a graph database (in many social services) or a completely different type of database.</li><li>Use CQRS, save events as known truths and visualize data in reporting stores in proper databases: relational, context-dependent data in RDBS, objects in key-value stores, graphs in graph databases etc.</li><li>Use a half-way solution shying away from ORM frameworks, but still using RDBS. It’s a recommended approach if we want to keep a clear separation between domain and persistence layer without additional maintenance of a persistence model needed for ORM framework would bring. In exchange, we can use the database with plain SQL more freely without the risk of causing side effects.</li></ol><p>But, what is most important: make careful, thought out decisions. Choice of technology cannot be an accident, trend or just your default choice — same for every problem.</p><h3>Reference</h3><ul><li><a href="http://blogs.tedneward.com/post/the-vietnam-of-computer-science/">http://blogs.tedneward.com/post/the-vietnam-of-computer-science/</a></li><li><a href="https://martinfowler.com/bliki/OrmHate.html">https://martinfowler.com/bliki/OrmHate.html</a></li><li><a href="http://seldo.com/weblog/2011/08/11/orm_is_an_antipattern">http://seldo.com/weblog/2011/08/11/orm_is_an_antipattern</a></li></ul><p><strong>Like it? Tap the </strong>👏 <strong>button! Thank you!</strong></p><p>You can find me on <a href="https://twitter.com/dawid_dominiak">Twitter</a> and <a href="https://github.com/dawiddominiak">GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ab4e9d8d681" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swinginc/whats-up-in-vietnam-9ab4e9d8d681">What&#39;s up in Vietnam</a> was originally published in <a href="https://medium.com/swinginc">SwingDev Insights</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>