<?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: Mateusz Nowak</title>
    <description>The latest articles on DEV Community by Mateusz Nowak (@mateusznowak).</description>
    <link>https://dev.to/mateusznowak</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F262306%2F2fa87204-3a3c-4eb2-a6ac-5d21c5b3eed0.jpeg</url>
      <title>DEV Community: Mateusz Nowak</title>
      <link>https://dev.to/mateusznowak</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mateusznowak"/>
    <language>en</language>
    <item>
      <title>Heroes of DDD: Software Developer == business partner?</title>
      <dc:creator>Mateusz Nowak</dc:creator>
      <pubDate>Mon, 01 Jul 2024 13:14:14 +0000</pubDate>
      <link>https://dev.to/mateusznowak/heroes-of-ddd-software-developer-business-partner-22kn</link>
      <guid>https://dev.to/mateusznowak/heroes-of-ddd-software-developer-business-partner-22kn</guid>
      <description>Cover sources: Heroes of Might and Magic III (Ubisoft) and Heroes III Board Game (Archon Studio).


&lt;h2&gt;
  
  
  💸 Autonomous models and products
&lt;/h2&gt;

&lt;p&gt;A fundamental principle I first heard about in high school, but didn't realize its power: divide and conquer! Why is this so important? When you don't know what it's about, it's about money. And that's exactly why we generally build our software — to make money.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Your model either enables quickly evaluating new ideas with proof of concepts, or it doesn't.&lt;br&gt;
Your model either offers the possibility of emergent new products from existing or composed modules, or it doesn't.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Brutal, but true. There is nothing in between. Can a given module of your software work on its own and be useful? Can you create a Proof of Concept for testing a new product idea without breaking everything else? If the software doesn't have clear boundaries between its parts, the standard answer is: hmmm... not exactly. But where is the money? Looking at the following examples may help your business to earn more.&lt;/p&gt;

&lt;h4&gt;
  
  
  🚗 Module = Product #1: Uber
&lt;/h4&gt;

&lt;p&gt;Such solutions are also used by the biggest players in the market. In the case of Uber, the core services were initially created as specific functionalities for drivers and passengers. When the company began expanding its product catalog to industries beyond transportation (such as Uber Eats), business capabilities were separated, which are now utilized by multiple products. These capabilities include: user accounts, route planning, payments, and matching passengers with drivers etc. Therefore, we have a level of products that we can compose of lower-level components—the capabilities provided by our system.&lt;/p&gt;

&lt;p&gt;If Uber hadn't separated route planning and ride services from the actual transportation of people, it wouldn't have been able to easily introduce package delivery through its app. In this case, the app's architecture is, referring back to Heroes, a true goldmine. By composing capabilities (such as route planning and a fleet of cars), a new product could be created based on existing solutions without changing other parts of the system, like passenger transport. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You can think of it this way: if your business capability is transporting things with cars, you can leverage this potential for different products: a taxi-like service, food delivery, package delivery, or even moving services. While designing your autonomous modules, think about Software Architecture in the same way, to drive the development of the products in the direction of new business possibilities.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So it didn't surprise me when Uber once offered me the option to transport a package within a city instead of transporting myself. Imagine what would happen if the ride was strictly tied to the passenger? It would likely result in the same situation as our hero in the tavern: creating a "passenger ride without a passenger" model with unnecessary nulls.&lt;br&gt;
You can read more about Uber's architecture in the article &lt;a href="https://www.uber.com/en-PL/blog/microservice-architecture/"&gt;Introducing Domain-Oriented Microservice Architecture&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  🎲 Module = Product #2: Heroes III Board Game
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7rjio57kpprnzgh8g16.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7rjio57kpprnzgh8g16.png" alt="Heroes III Board Game Expansion" width="800" height="308"&gt;&lt;/a&gt;&lt;/p&gt;
Heroes III Board Game — Battlefield expansion. Additional product which allows you alternative battle system.



&lt;p&gt;&lt;br&gt;
The Heroes III board game offers two ways to conduct battles:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A simpler one, using cards, included in the basic game.&lt;/li&gt;
&lt;li&gt;A more complex version, played on a special board with 3D creature figures, more faithfully replicating the mechanics of the computer game. Available as an extension to buy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thanks to proper modularization and separating the battle mechanics from the rest of the game parts, as well as flexible rules (domain processes in the game), it became possible to offer additional products to new and existing customers. Heroes V also introduced &lt;a href="https://www.youtube.com/watch?v=bLIvfkcC-Hk&amp;amp;list=PLiV_3ayn6zwSAichemcFKKSwVp_Tn6ijH"&gt;combats between heroes&lt;/a&gt;, not only in scenario mode. This was possible because the battle mechanics were modularized and could be easily used independent of other processes. Similar practices can be applied not only in computer games. Do you see something like that in your domain?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvd9posg6muvteqcsuxs3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvd9posg6muvteqcsuxs3.png" alt="Heroes 3 Capabilities" width="800" height="546"&gt;&lt;/a&gt;&lt;/p&gt;
Thanks to separating the battle module from other modules, it was possible to create an additional game mode using the same mechanics as the scenarios and campaign.




&lt;h4&gt;
  
  
  👨‍💻 Developer == Business Partner?
&lt;/h4&gt;

&lt;p&gt;As a software engineer, you can be more than just a coder, who may soon be replaced by AI, but a real business partner, opening up new possibilities. A software architect is paid to ensure that introducing new functionalities and potential requirements' changes aren't too expensive.&lt;/p&gt;

&lt;p&gt;Often in product teams, decisions are made: "instead of endless discussions, let's do a Proof of Concept." Yet, no one do that, because the system's state does not allow it. The problem isn't the mythical "technical debt" (&lt;a href="https://www.youtube.com/watch?v=d2Ddo8OV7ig"&gt;Technical debt isn't technical - be sure to watch this presentation!&lt;/a&gt;) understood as using outdated technology, but rather the tangled model, without proper boundaries.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq6xh8otynjd53xqrk5kk.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq6xh8otynjd53xqrk5kk.gif" alt="Unicorn" width="347" height="471"&gt;&lt;/a&gt;&lt;/p&gt;
Will your company be the next unicorn? Not just because of your work, but hopefully not despite it.



&lt;p&gt;&lt;br&gt;
Dividing and modularizing the system isn't just a programmer's inadequate desire: it must be paired with a deep understanding of the business domain. &lt;strong&gt;When you model, keep the primary goal in mind: autonomous modules. How you implement them and which technologies are used is not so important.&lt;/strong&gt; So, how to divide to conquer?&lt;/p&gt;

&lt;p&gt;We'll talk about that in future articles. &lt;br&gt;
In the next episodes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Planning out the software, using EventStorming and Event Modeling&lt;/li&gt;
&lt;li&gt;Turning plans into code&lt;/li&gt;
&lt;li&gt;Making sure it's good quality before writing any code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to read the next parts, sign up for my mailing list &lt;a href="https://subscribepage.io/mateusznowak"&gt;HERE&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>domaindrivendesign</category>
      <category>eventstorming</category>
      <category>product</category>
      <category>eventmodeling</category>
    </item>
    <item>
      <title>Heroes of DDD: BEHAVING perspective. What do I do?</title>
      <dc:creator>Mateusz Nowak</dc:creator>
      <pubDate>Tue, 18 Jun 2024 07:00:00 +0000</pubDate>
      <link>https://dev.to/mateusznowak/heroes-of-ddd-behaving-perspective-what-do-i-do-1o1b</link>
      <guid>https://dev.to/mateusznowak/heroes-of-ddd-behaving-perspective-what-do-i-do-1o1b</guid>
      <description>&lt;p&gt;Listen to a few statements from Heroes III players:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I won't capture that mine because it's guarded by a horde of creatures.&lt;/li&gt;
&lt;li&gt;I need to build that dwelling, because it allows to upgrade my level 7 creature.&lt;/li&gt;
&lt;li&gt;For now, I won't attack with this creature, I'll just wait.&lt;/li&gt;
&lt;li&gt;The recruitment cost of this creature is too high; I don't have enough resources in my kingdom.&lt;/li&gt;
&lt;li&gt;Oh no! Plague week, and I haven't recruited the entire creatures population.&lt;/li&gt;
&lt;li&gt;I can't move because this creature has been blinded.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When you model behaviors rather than data structures, you can ask many more questions that bring you closer to understanding the essential elements of the analyzed process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Does capturing a mine always involve a battle?&lt;/li&gt;
&lt;li&gt;What else needs to happen besides building the dwelling for me to upgrade a creature? Can I only upgrade in dwellings I
have built?&lt;/li&gt;
&lt;li&gt;Can you attack and wait? What other options are there?&lt;/li&gt;
&lt;li&gt;Where do resources in the kingdom come from? How is the creature cost calculated?&lt;/li&gt;
&lt;li&gt;Plague week? What is that? How often does it occur? Are there any other "special weeks"?&lt;/li&gt;
&lt;li&gt;Is "blinding" the only condition that prevents a creature from moving?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There is no bulletproof method or a process that always works 100% for gaining domain knowledge. &lt;strong&gt;Experience and intuition are needed here. That's why we should practice modeling wherever possible, even while playing games. Because this is the essence of our work; coding is just a formality.&lt;/strong&gt; However, you can help yourself by using patterns that others have already invented. Let's employ strategic DDD techniques, such as the Big Picture phase of EventStorming.&lt;/p&gt;

&lt;h3&gt;
  
  
  🚁 EventStorming Big Picture, a helicopter view
&lt;/h3&gt;

&lt;p&gt;Now, take a look below at the events we identified during such an EventStorming session in the Heroes III domain. We will now focus on the section where domain experts mentioned creatures.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoa0v7qls1g13oysualp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqoa0v7qls1g13oysualp.png" alt="Event Storming - Creatures"&gt;&lt;/a&gt;&lt;/p&gt;
Event Storming allows us to see the different contexts in which domain experts operate.



&lt;p&gt;&lt;br&gt;
The presented sticky notes symbolize events at different levels of abstraction and refer to various contexts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Some experts focused on the details of combat, even noting specific spell effects, like blinding (Creature Blinded).&lt;/li&gt;
&lt;li&gt;Others described recruitment (Available Creatures Changed / Creature Recruited) or possible operations in towns (Creature: Growth Changed / Upgraded / Deposited in Garrison).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's recall our entire "model" of a creature based on nouns from the previous article.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Angel"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"level"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"faction"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"castle"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"growth"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"upgrades"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"Archangels"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"cost"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"gold"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"crystal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"wood"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ore"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"sulfur"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"mercury"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"gems"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"attack"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"defense"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"damage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"low"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"high"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"health"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"speed"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"shots"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"size"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"spells"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"abilities"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"HATE"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"creatures"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"Devil"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"ArchDevil"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ConstRaisesMorale"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Do we need all the shown attributes of a creature in every case to know if some operation is allowed? Does a possible upgrade depend, for example, on the creature's size during a battle? No. Does the creature's cost depend on hit points? Of course not.&lt;/p&gt;

&lt;p&gt;In that case, we shouldn't mix these things in one model. This sounds obviously, but that's typically how legacy systems were built, which someone has to maintain till now (hopefully not you)...&lt;/p&gt;

&lt;h3&gt;
  
  
  💸 Money running away
&lt;/h3&gt;

&lt;p&gt;An analogous example was given by Udi Dahan during the "Learn Advanced Distributed Systems Design" training:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Do I need to know the room's name to know if I can book it in a hotel? Can you imagine an invariant: "if the room's name starts with the letter A, bookings are only possible on Fridays"?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sounds like an absurd, right? So let's not combine the bookings list into one object with the room's name, even through ORM and database relations. Group only the data that changes together into objects, and whose immediate consistency is necessary to meet business rules — meaning, it determines whether an operation is possible and whether the resulting event can occur. This way, you get more, but smaller and specialized models with lower complexity. Thanks to that you will avoid situations caused by optimistic locking where, for example, changing the room name is conflicting with updating a new booking... thereby causing your business to lose money!&lt;/p&gt;

&lt;h3&gt;
  
  
  🦄 Bounded Context appeared!
&lt;/h3&gt;

&lt;p&gt;Assuming a model combines data and rules, do we need the same creature model in all contexts (such as Recruitment, Combat, Upgrading)? By now, you know the answer is NO. Each of these contexts will have different rules and sets of data needed to verify them. Only the ID will remain the same. &lt;/p&gt;

&lt;p&gt;This means, at the solution level, we will have different Creature classes on which different operations can be performed. To decide if a given operation can be executed, we don't need to know every property for a given noun. Just as a domain expert doesn't need to know everything about the entire business but only needs to know everything about their department and a bit about those they need to collaborate with directly. Don't define classes based on names or nouns. Look for consistency rules — what changes together and what doesn't.&lt;/p&gt;

&lt;p&gt;This will also give you low coupling and high cohesion (as Uncle Bob wrote in Clean Code). &lt;strong&gt;Remember, of course, that these are not goals in themselves. We structure code to make it easy to understand. When we understand it, we can quickly make changes and avoid bugs. At the end of the day, this is what a programmer's job boils down to.&lt;/strong&gt; If you're not sure what the word cohesion means, now is a good time to refresh your memory. But if you remember, that's great for you and your coworkers!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsl8u7cvodisr9hwh1h2w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsl8u7cvodisr9hwh1h2w.png" alt="Creature - Angel Bounded Context"&gt;&lt;/a&gt;&lt;/p&gt;
To preserve invariants in a given context, we don't need all possible data about a specific noun.



&lt;p&gt;&lt;br&gt;
Above, you see a possible division of the creature model, divided by context. An analogous diagram (for ecommerce product) in the book &lt;a href="https://amzn.to/2Y0Bre8" rel="noopener noreferrer"&gt;Patterns, Principles, and Practices of Domain-Driven Design&lt;/a&gt; changed my programming life forever.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fppexxcp5e8x20ambme2m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fppexxcp5e8x20ambme2m.png" alt="Product model"&gt;&lt;/a&gt;&lt;/p&gt;
The product, an implementation of the god object antipattern. I hope the authors won't mind me including it here. 



&lt;p&gt;&lt;br&gt;
What we'd like to emphasize in creature's model for different contexts?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Combat: active spells, luck, morale, hit points.&lt;/li&gt;
&lt;li&gt;Recruitment: cost, availability, growth rate (depends on town buildings and, for example, the week symbol).&lt;/li&gt;
&lt;li&gt;Similarly, when encountering an enemy creature on the map, is it important which player it belongs to or whether it can be upgraded? Of course not.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If we use the creature model from the map (maybe a generic "shared" model) for every other context, it will be too simple and won't meet the requirements. On the other hand, using one, huge and complex model with all properties will result in longer code, filled with unnecessary if-statements, making it harder to understand and modify.&lt;/p&gt;

&lt;p&gt;But how do we know which attributes should be grouped together? Where did this division come from? How do we manage to split so many fields at once? The answer is: don't try to split it all at once. Instead, it's better to go the other way around and let the necessary attributes emerge from the desired behaviors of the system. How to do that? In the next chapters :)&lt;/p&gt;

&lt;h3&gt;
  
  
  🤖 (Data ∪ Behaviors) ⊂ Model
&lt;/h3&gt;

&lt;p&gt;Looking at the system only from the BEING (data) perspective while ignoring BEHAVING will make our solution flawed. This is especially true when dealing with complex business logic, rather than just a database browser like CRUD. A dominant BEING perspective results in a tangled mess of if-statements in huge god objects, that's hard to untangle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unfortunately, even software engineers with many years of experience, when asked to "design the architecture," often draw rectangles, connect them with arrows, and consider the planning done. However, only when we overlay behaviors and business processes (events and commands — more on this soon!) on such a diagram does the implicit tangle of interconnections and dependencies become explicit.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fls7opsm9r33fz8cee6ni.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fls7opsm9r33fz8cee6ni.png" alt="Heroes od Domain-Driven Design"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br&gt;
If you don't want to miss the upcoming parts, let's sign up for my mailing list &lt;a href="https://subscribepage.io/mateusznowak" rel="noopener noreferrer"&gt;HERE&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ddd</category>
      <category>domaindrivendesign</category>
      <category>boundedcontext</category>
      <category>eventstorming</category>
    </item>
    <item>
      <title>Heroes of DDD: BEING perspective. What am I?</title>
      <dc:creator>Mateusz Nowak</dc:creator>
      <pubDate>Sun, 16 Jun 2024 23:27:43 +0000</pubDate>
      <link>https://dev.to/mateusznowak/heroes-of-ddd-being-perspective-what-am-i-3jgc</link>
      <guid>https://dev.to/mateusznowak/heroes-of-ddd-being-perspective-what-am-i-3jgc</guid>
      <description>Cover sources: Heroes of Might and Magic III (Ubisoft) and Heroes III Board Game (Archon Studio).



&lt;h2&gt;
  
  
  🫣 BEING perspective: what am I?
&lt;/h2&gt;

&lt;p&gt;Creatures in Heroes III have their own names and specific levels. &lt;br&gt;
Each belongs to a different faction, but there are also neutral creatures. Some creatures can be upgraded. Each creature has a defined recruitment cost and a base growth rate (how many can be recruited each week). Creatures have specific stats (like attack, defense, hit points etc.), which are especially important during combats.&lt;/p&gt;
&lt;h3&gt;
  
  
  📜 Playing a board game? Start with the instructions!
&lt;/h3&gt;

&lt;p&gt;When you focus on nouns, data structures and database tables for creatures, what clarifying questions can you ask based on this description to create a better "model"? And what answers are you likely to get?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Question&lt;/em&gt;: What does a creatures have? &lt;em&gt;Answer&lt;/em&gt;: A name...&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Question&lt;/em&gt;: How many characters can a creature's name have? &lt;em&gt;Answer&lt;/em&gt;: It varies... probably up to 50 to keep the UI from
breaking.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Question&lt;/em&gt;: How do we define the level? &lt;em&gt;Answer&lt;/em&gt;: A number from 1 to 7.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Question&lt;/em&gt;: How many upgrades can a creature have? &lt;em&gt;Answer&lt;/em&gt;: From 0 to 1.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Since we did so well with defining "what a creature has," we could continue and draw out the entire database, but see what King Julien has to say about that:&lt;br&gt;
&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/wqRnt1uwEjY"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Only advantage of this approach is that I didn't waste much time on it. ChatGPT did the work quickly and beautifully laid out the tables. Such programmers will likely be replaced by AI soon. But you want to stay in the industry, right? So keep reading.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhqw9egzlu5nrozcdqkt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhqw9egzlu5nrozcdqkt.png" alt="Heroes3_DatabaseModel" width="800" height="660"&gt;&lt;/a&gt;&lt;/p&gt;
One huge database model for the entire Heroes III created by ChatGPT. But what's the point?
In college, I would probably get an A grade for this, but in practice, it deserves no more than a D.



&lt;p&gt;&lt;br&gt;
&lt;strong&gt;Starting a project with a database schema is like opening a board game (by the way, a Heroes III version in this form was recently released), looking at the contents: "OK, I have 50 cards, and I have a board"... and trying to play without reading the instructions.&lt;/strong&gt; It's no surprise that with a similar approach to programming (without understanding the domain and its processes), we'll apply a solution suitable for CRUD everywhere — most board games also typically have cards and a board...&lt;/p&gt;

&lt;p&gt;From the database tables diagram, do you already know what you need to do first? Or where you can parallelize the work of developers? Can separate teams work on it? Or what dependencies or user interface designs are still missing? And finally: does it bring you closer to understanding the business processes? Do you know why creatures have levels, or what is the point of upgrading them? First, let's focus on understanding the essence of the problem. We'll deal with the rest, like database details, later.&lt;/p&gt;
&lt;h3&gt;
  
  
  😌 Relax, relax... I do OOP and have classes, not tables!
&lt;/h3&gt;

&lt;p&gt;So how do we model an "object-oriented" creature? Below, you can see the implementation in Kotlin and the object parsed into JSON (with example values).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;data class&lt;/span&gt; &lt;span class="nc"&gt;Creature&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;level&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;faction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Faction&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;growth&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;upgrades&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Creature&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;cost&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Resources&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;attack&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;defense&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;damage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Range&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;health&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;speed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;shots&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Int&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Int&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;spells&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Spell&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;abilities&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;SpecialAbility&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Angel"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"level"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"faction"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"castle"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"growth"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"upgrades"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"Archangels"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"cost"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"gold"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"crystal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"wood"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ore"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"sulfur"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"mercury"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"gems"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"attack"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"defense"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"damage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"low"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"high"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"health"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"speed"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"shots"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"size"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"spells"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"abilities"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"HATE"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"creatures"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"Devil"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"ArchDevil"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ConstRaisesMorale"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h3&gt;
  
  
  🔴 Accidental complexity and all tests red
&lt;/h3&gt;

&lt;p&gt;Are the variables below well-named? Yes. &lt;br&gt;
Do all these attributes belong to the creature or are they related to it? Yes.&lt;br&gt;
So, is there anything wrong with this solution?&lt;/p&gt;

&lt;p&gt;Before we answer that question, let's listen to two dialogues between a programmer and domain experts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Expert #1: "A hero ALWAYS belongs to a player."&lt;/li&gt;
&lt;li&gt;Programmer: "Are you sure? Could there ever be a case where a hero doesn't belong to a player?"&lt;/li&gt;
&lt;li&gt;Expert #1: "No, no... a hero on the map is always under some player's flag. That will NEVER change."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Satisfied, you create the perfect model that meets business requirements, in collaboration with experts, feeling that this is truly Clean Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;data class&lt;/span&gt; &lt;span class="nc"&gt;Hero&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;HeroId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;player&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;PlayerId&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After some time, you talk to another expert:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Expert #2: "In the Tavern, we buy a hero who doesn't belong to any player." 🤯&lt;/li&gt;
&lt;li&gt;Programmer: "What? But Expert #1 said that a hero ALWAYS belongs to a player."&lt;/li&gt;
&lt;li&gt;Expert #2: "He must be wrong... I've been working here longer and I know better."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What happens to your code in such case?&lt;br&gt;
You introduce a modification because the code must reflect the business logic.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;data class&lt;/span&gt; &lt;span class="nc"&gt;Hero&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;HeroId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;player&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;PlayerId&lt;/span&gt;&lt;span class="p"&gt;?,&lt;/span&gt; &lt;span class="c1"&gt;// null only in tavern&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;cost&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Resources&lt;/span&gt; &lt;span class="c1"&gt;// cost of hiring a hero&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, it's finally a small change — just adding the possibility of &lt;code&gt;null&lt;/code&gt; in the &lt;code&gt;player&lt;/code&gt; field. Is that the end of the work? Not at all! Now, all the tests that created a Hero instance are failing and need to be updated (which means they no longer protect you from regression). Additionally, everywhere you reference &lt;code&gt;hero.player&lt;/code&gt;, you have to introduce an &lt;code&gt;if&lt;/code&gt; statement to check against null.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo0upov55p6hpv80wm5y9.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo0upov55p6hpv80wm5y9.gif" alt="EyesGif" width="580" height="422"&gt;&lt;/a&gt;&lt;/p&gt;
How do such changes hit your project?



&lt;p&gt;&lt;br&gt;
It's still manageable if you're using Kotlin (or another language with sophisticated &lt;a href="https://kotlinlang.org/docs/null%20safety.html"&gt;Null Safety&lt;/a&gt;) and the compiler alerts you, rather than causing abug in production. &lt;strong&gt;Even if you manage to handle this, you now want to merge the changes and... bam (as my 1-year-old son says)! It turns out another developer has already overwritten your changes, and we have a marge conflict! Your morale and work efficiency drop like a hero's army in Heroes III when you mix different factions. Wouldn't it be simpler, instead of modifying, to apply the Open-Closed Principle at the architecture level and have two separate models? Models that even separate teams of developers can work on without any issues.&lt;/strong&gt; Let's see an example below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F439pwl1apb8prvpyttks.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F439pwl1apb8prvpyttks.png" alt="Heroes3 Hero Bounded Context" width="520" height="565"&gt;&lt;/a&gt;&lt;/p&gt;
Actually, splitting the model increases the number of classes, but ultimately creates more models with less complexity.





&lt;h3&gt;
  
  
  🐉 Bad habits — here be dragons!
&lt;/h3&gt;

&lt;p&gt;Different attributes describing a Hero are needed in the context of the tavern compared to when exploring the adventure map. Simply add another namespace/module, or whatever it's called in your environment, and create two separate classes. Nothing is limiting you here. Unless, of course, you're still thinking in terms of the &lt;code&gt;Hero&lt;/code&gt; table and adding a nullable column, or the relationships between tables. This is how we were taught from the beginning, and fighting bad habits is the hardest.  Those habits are like dangerous dragons, but if you defeat them — you and your project will receive greater rewards than after beating a Dragon Utopia.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0hqe1zth8j3ginjl9x0q.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0hqe1zth8j3ginjl9x0q.gif" alt="DragonUtopiaHeroes 3" width="196" height="137"&gt;&lt;/a&gt;&lt;/p&gt;
Dragon Utopia — In Heroes III, if you want to acquire rare artifacts, you must defeat the dragons guarding them.



&lt;p&gt;&lt;br&gt;
&lt;strong&gt;When you hear conflicting information from experts about the same noun, trying to reconcile them in a single model introduces what's known as accidental complexity.&lt;/strong&gt; Now, every programmer, even one who knows almost the entire system (but not the tavern and hero hiring), will ask you: "Dude, why do I have to check for null here?" And that's the least dangerous form of this problem... both of you will just waste some time.&lt;/p&gt;

&lt;p&gt;As a result, such problem exists only in the code and make the domain itself harder to understand than it really is.  Is one of the experts lying to you or incompetent? Not at all! In the tavern, you can buy a hero, but you can't buy any of the heroes moving on the map because they belong to you or another player.&lt;/p&gt;

&lt;p&gt;Such inconsistencies in "business" statements are a clear sign that we should now talk about behaviors rather than move forward with nouns. The noun "hero" is the same, but the behaviors - operations that can be performed on the object - are completely different, depends on the context.&lt;/p&gt;




&lt;p&gt;If you want to actively participate in modeling the solution or just don't miss the upcoming parts, let's sign up for my mailing list &lt;a href="https://subscribepage.io/mateusznowak"&gt;HERE&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ddd</category>
      <category>oop</category>
      <category>complexity</category>
      <category>kotlin</category>
    </item>
    <item>
      <title>Heroes of DDD: Is a "good" domain model the Holy Grail?</title>
      <dc:creator>Mateusz Nowak</dc:creator>
      <pubDate>Sun, 16 Jun 2024 23:08:05 +0000</pubDate>
      <link>https://dev.to/mateusznowak/heroes-of-domain-driven-design-looking-for-the-holy-grail-and-the-good-model-42a2</link>
      <guid>https://dev.to/mateusznowak/heroes-of-domain-driven-design-looking-for-the-holy-grail-and-the-good-model-42a2</guid>
      <description>Cover: https://www.youtube.com/watch?v=DzWUt2GSZ6g

&lt;h2&gt;
  
  
  🗿 Model - what is it?
&lt;/h2&gt;

&lt;p&gt;A model is not a copy of the real world, but a representation made for a specific purpose: to solve a particular problem and answer specific questions. As programmers, we constantly create abstractions in order to understand and implement project domain and requirements.&lt;/p&gt;

&lt;p&gt;However, you use various models (or abstractions) every day, perhaps without even realizing it. When you drive a car, the lines forming the road on the navigation system are not the actual street you are driving on, but they answer the question: "How do I get to my destination as quickly as possible."&lt;/p&gt;

&lt;h3&gt;
  
  
  🪑 It depends on the point of view
&lt;/h3&gt;

&lt;p&gt;So, what makes a "good model"? It depends on who is asking. When I ordered a custom kitchen, I received two models: one technical drawing (on the left) and another in 3D (on the right). If I want to see how the colors match and imagine if the arrangement of the appliances will be ergonomic — the 3D model is suitable. However, for the person who has to cut and assemble the furniture, it will be useless because it does not provide the exact measurements. This is an example of two different representations of the same reality — both useful, but in different contexts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg6nkinzkulje4fmb4cj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg6nkinzkulje4fmb4cj.png" alt="Kitchen model" width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;
 The model is applicable only in defined context and useful for certain purpose.



&lt;h4&gt;
  
  
  🗡️ Heroes III — Who attacks first?
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Do we already know what a "good model" is?&lt;br&gt;
We can still repeat the standard consultant's answer like a mantra: "it depends."&lt;br&gt;
But it's important to know — what does it depend on? It depends on what the question is.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You don't have to look far for an accurate example, as the following screenshot from Heroes III provides it,&lt;br&gt;
where we can see two representations of the same "reality": the battle between armies of creatures.&lt;/p&gt;

&lt;p&gt;Of course, the word "reality" is not entirely appropriate in the context of a game, but Domain-Driven Design methods can be applied here as well.&lt;br&gt;
Nowadays, it is natural — various businesses (e.g., job listing portals, online stores, banks, etc.) are so closely tied to software&lt;br&gt;
that it would be misleading to say that as programmers, we only model something "real" that exists outside of computers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frdgxct0d71cac17v5b8i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frdgxct0d71cac17v5b8i.png" alt="Heroes3 Battle Queue" width="800" height="640"&gt;&lt;/a&gt;&lt;/p&gt;
A given model is specialized to answer specific questions.



&lt;p&gt;&lt;br&gt;
The presented screen shows two different models of the same battle situation, but answering different questions.&lt;/p&gt;

&lt;h5&gt;
  
  
  ⬢ Model #1: Battlefield
&lt;/h5&gt;

&lt;p&gt;Composed of hexagons (similar to squares in chess) on which creatures move.&lt;br&gt;
A glance at this model can answer questions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the Angel's movement range? The currently dimmed hexagons indicate where the highlighted Angel can fly or attack a creature standing on them — in this case, only the Dragon.&lt;/li&gt;
&lt;li&gt;How many creatures has the player lost? In the bottom-right corner, you can see that one group of Angels has already fallen.&lt;/li&gt;
&lt;li&gt;Where is the best spot to attack with the Dragon (as it can attack 2 adjacent creatures)?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  ⏹ Model #2: Battle Queue
&lt;/h5&gt;

&lt;p&gt;Visible at the bottom, depicting the upcoming moves of creatures and the battle rounds.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi13cqywmxy3bgxgwqw8r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi13cqywmxy3bgxgwqw8r.png" alt="Heroes3 Queue Only" width="600" height="54"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here we have a very specialized model, serving practically to answer one question:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In what order will the creatures move?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks to this representation, we have a clear answer, which we could extract from the previous model, but with much more effort.&lt;br&gt;
It would require us to analyze the stats of each creature (their speed), which still wouldn't be enough because factors like artifacts owned by the hero or cast spells also influence the move order.&lt;br&gt;
Additionally, a creature can wait each turn, placing it at the end of that round — without a visible queue, each player would have to remember this.&lt;/p&gt;

&lt;p&gt;The model is much simpler compared to the battlefield and contains less information (e.g., we don't need to know the creatures' attack strength because it doesn't affect the move order), but it better serves its purpose.&lt;br&gt;
In Event Sourcing terminology, one could say that the Battle Queue model is a projection of events such as &lt;code&gt;CreatureMoved&lt;/code&gt;, &lt;code&gt;CreatureAttacked&lt;/code&gt;, &lt;code&gt;CreatureWaited&lt;/code&gt;, &lt;code&gt;SpellCasted&lt;/code&gt;, etc.&lt;/p&gt;

&lt;h5&gt;
  
  
  🤖 Experience -&amp;gt; Automation
&lt;/h5&gt;

&lt;p&gt;In the original version of the game, only the battlefield view was available (without the initiative bar). However, subsequent expansions/mods added this feature based on player experiences. This is an example of automating a process that was previously done in the players' heads, taking away a lot of time and enjoyment from the game.&lt;/p&gt;

&lt;p&gt;Maybe in your company, there are Excel sheets that waste a lot of time and money until someone (like you) automates them?&lt;br&gt;
If you have the opportunity, it's worth spending a day outside the IT department to listen in on what people complain about whose work you're supposed to simplify with your software.&lt;br&gt;
You might find HotSpots faster than by sticking notes during EventStorming!&lt;/p&gt;

&lt;h4&gt;
  
  
  🕳️ Have we found the Holy Grail?
&lt;/h4&gt;

&lt;p&gt;Is it possible to illustrate all contexts with a single model? This is often what tutorials or documentation for a given framework show you (it's impossible to summarize all the books on best practices in such a place). Unfortunately, even developers with many years of experience still try to do this in applications with complex business processes. And it works, until you eventually start getting lost in the jungle of if-statements. They then excuse themselves with a misunderstood "pragmatism" and say, "we'll fix it later" — but you know that "later" never comes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;That's why you should invest time now to expand your toolkit and choose the right solutions for the specific class of a problem. And be sure to apply them in practice — only then you will grasp their full potential!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0gbbhlml58cytj3g60y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0gbbhlml58cytj3g60y.png" alt="Heroes3 Holy Grail" width="126" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br&gt;
The methods I will present are not a Holy Grail that save every project for sure. However, the most important thing is to be aware of alternative approaches to those you usually use and to be able to choose the right one in a given context in order to solve a specific problem using the most appropriate available tool. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you don't know that a power drill exists, you'll screw everything in with a screwdriver until someone tells you about its existence.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  🗄️ Categorizing models
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;In your dresser in the bedroom, the most important thing is to know what you will find in each drawer. Once you know that, you can apply the appropriate strategy for each one: you neatly fold your trousers, but you likely toss your socks in loosely.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Anyone (or the programmers who came to maintain that software later) who has ever tried to create one huge model consisting of hundreds of tables (or a dresser with one giant drawer) that is supposed to be "one-size-fits-all" has sooner or later failed. Let's focus on dividing into logical business subdomains rather than technical layers or microservices. This way, each of these problems can be solved in a simpler (and probably cheaper) manner, and developers can avoid cognitive overload.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm7llijpc1ys14czrviaf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm7llijpc1ys14czrviaf.png" alt="Drawer_BoundedContexts" width="480" height="371"&gt;&lt;/a&gt;&lt;/p&gt;
At least you know where to search.



&lt;p&gt;&lt;br&gt;
A model can't exist without boundaries (just like drawers set boundaries in a dresser), because then it would just reflect the real world. All models are wrong, but some are useful in a specific context (like the mentioned kitchen designs). &lt;strong&gt;To find the right model for certain context, we need to look at the problem from different perspectives.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;If you want to actively participate in modeling the solution or just don't miss the upcoming parts, let's sign up for my mailing list &lt;a href="https://subscribepage.io/mateusznowak"&gt;HERE&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>domaindrivendesign</category>
      <category>ddd</category>
      <category>model</category>
      <category>boundedcontext</category>
    </item>
    <item>
      <title>Heroes of DDD: Prologue &amp; knowledge crunching</title>
      <dc:creator>Mateusz Nowak</dc:creator>
      <pubDate>Sun, 16 Jun 2024 22:52:11 +0000</pubDate>
      <link>https://dev.to/mateusznowak/heroes-of-domain-driven-design-prologue-f37</link>
      <guid>https://dev.to/mateusznowak/heroes-of-domain-driven-design-prologue-f37</guid>
      <description>Cover photo source: Heroes of Might and Magic III, Ubisoft



&lt;h2&gt;
  
  
  🧠💪 In this series we will:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Discover how modularization influences business development and opens up opportunities for new products.&lt;/li&gt;
&lt;li&gt;Translate sticky notes from EventStorming and Event Modeling directly into working code.&lt;/li&gt;
&lt;li&gt;Explore daily and rapid enhancement of your business process modeling skills.&lt;/li&gt;
&lt;li&gt;Improve project quality using methods better than code review.&lt;/li&gt;
&lt;li&gt;Consider diverse stakeholder perspectives such as UX/UI, frontend, backend, and analytics when modeling processes by mean of Event Modeling.&lt;/li&gt;
&lt;li&gt;Generate unit tests from the appropriate model notation with the help of ChatGPT.&lt;/li&gt;
&lt;li&gt;Keep code complexity aligned with the business process being modeled.&lt;/li&gt;
&lt;li&gt;Implement the Decider pattern to express business logic in a functional style.&lt;/li&gt;
&lt;li&gt;Familiarize yourself with various modeling practices that will inspire your further growth.&lt;/li&gt;
&lt;li&gt;Revolutionize your programming experience forever.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Could I describe all of this using examples like a cinema or a shopping cart? Sure! But why keep repeat examples on the same domain again and again (others done it well in books and during conferences)...? It's time to enter the world of heroes, magic, elves, and other fantastic creatures.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11ih4rsf51ikv95mfs5k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11ih4rsf51ikv95mfs5k.png" alt="Event Modeling of the recruitment process in Heroes domain" width="800" height="540"&gt;&lt;/a&gt;&lt;/p&gt;

Event Modeling allows us to tell a story like frames in the movie and connect on a single diagram different layers of the system: user actions, interface designs, REST APIs, data storage, etc.
This ensures that there are no gaps in the requirements and everyone involved in the project are on the same page. 
Illustrated dependencies show where work can proceed in parallel. 
The result is a project that we translate directly into code, eliminating misunderstanding and time-consuming discussions during code reviews.




&lt;p&gt;&lt;br&gt;
Above, you can see a piece of Event Modeling of the autonomous recruitment model in Heroes III. But how did we get to this point!? And what does "model" mean, especially "autonomous"!? After all, no one recruits Angels at the very beginning of the game... Similarly, no one knows right away what a given business process looks like and what abstractions to use to express it.&lt;/p&gt;

&lt;p&gt;Exhausted Hero! It's time to leave the tavern and dive into the world of might (proven patterns and heuristics) and magic (also known as intuition) of modeling in the spirit of Domain-Driven Design. 🧙‍♂️&lt;/p&gt;




&lt;p&gt;Recently, after a few years' break, I launched Heroes III and immediately began to analyze how I would program something similar, based on my experience from commercial projects (disclaimer: I don't develop games, but I automate business processes such as publishing job advertisements, working in a call center, and in a bank, etc.).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu4vm137bgybt1whtk2h4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu4vm137bgybt1whtk2h4.png" alt="AstrologesProclaimed" width="479" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br&gt;
Flashbacks from my first commercial projects and the mistakes I made also returned, as I used to start implementation without the proper process of learning and planning. Although it is just a game (but the best I've ever played!), you can find many analogies to real business processes in it, which I will explore together with you (starting with this post) and translate into code.&lt;/p&gt;

&lt;h2&gt;
  
  
  👁 The curse of knowledge
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A hero's stats affect their troops (creatures) in combat, and the combat results affects the hero's army (because of lost creatures).&lt;br&gt;
You can hire a hero in the tavern, which can be built in the town. You recruit the creatures in unit dwellings, which may or may not be in the town. The tavern works the same way. Creatures availability renews every week, unless the astrologers proclaimed a week of plague. Of course, you also need resources to buy them, which are collected on the map... Oh, and don't forget to develop your hero!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is just a snippet of the requirements you would get if you asked a "domain expert" about the processes in the world of Heroes III.&lt;/p&gt;

&lt;p&gt;Imagine how confused my wife was when I wanted her to play with me for the first time and I tried to explain such complicated game rules as an "expert". She gave up after a while... And that was just the beginning. It's very similar when the so-called business tries to explain its project requirements to us...&lt;br&gt;
&lt;strong&gt;That's why our task (and responsible duty as a Software Engineer) is to carry out the process of knowledge crunching, which means extracting domain knowledge from those who have it. We need to learn to ask the right questions at the right time to avoid being overwhelmed by the experts' knowledge.&lt;/strong&gt; Fortunately, there are proven methods for this, developed by the Domain-Driven Design community. I will use some of them, and you can find more on &lt;a href="https://github.com/ddd-crew"&gt;GitHub DDD Crew&lt;/a&gt;. This post is the first in a series. In the following posts, we will level up in the Mage Guild and dive deeper into the mentioned techniques.&lt;/p&gt;

&lt;h2&gt;
  
  
  ♞ Why Heroes III?
&lt;/h2&gt;

&lt;p&gt;I want to show you my current state of knowledge, how I execute projects, and my way of thinking, as well as my engineering practices workshop. I will dive into the specifics of the methods used in separate posts.&lt;/p&gt;

&lt;p&gt;For educational purposes, even though the domain is literally fantastical, it is much closer to real-world projects than the examples you often see at many conferences, such as "cinema" or the repeating again and again "ecommerce" example, seen in many books about DDD and Event Sourcing. Every cinema and shopping cart operates differently, so when we invent business requirements, we shape not only the model but also the reality. Here, the reality is already defined by the rules of the game, and we must discover and properly model it—just like in a real project.&lt;/p&gt;

&lt;p&gt;Although, of course, many great books and presentations by extremely competent people have been created based on the mentioned standard examples, from which I also learned a lot. It's worth checking out examples by Oskar Dudycz (a leading expert on Event Sourcing), where he models a shopping cart in many different ways: &lt;a href="https://github.com/oskardudycz/EventSourcing.NetCore"&gt;.NET&lt;/a&gt;, &lt;a href="https://github.com/oskardudycz/EventSourcing.NodeJS"&gt;NodeJS&lt;/a&gt;, &lt;a href="https://github.com/oskardudycz/EventSourcing.JVM"&gt;Java&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  🏋️ Training the intuition
&lt;/h2&gt;

&lt;p&gt;I invite you to join this campaign, where we will model the world of Heroes III together, based on practices such as DDD and Event Modeling. Does such "fun" really make sense? The quotation below answers this perfectly:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Often in the modeling process, an unexpected flash of intuition appears, and someone nearby may feel like you're pulling a rabbit out of a hat. This still-unexplained puzzle of intuition is most likely unconscious knowledge derived from experience. We must openly admit that intuition favors those who have had the chance to be exposed to various cases. So, the more cases you see, the better you model. ~ Jakub Pilimon &amp;amp; Sławomir Sobótka, translated from Polish (DomainDrivers.pl)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I want to build an intuition with you, so that when you encounter an analogous case in a real project, your brain immediately knows how to react. If you want to actively participate and don't miss the upcoming parts, let's sign up for my mailing list &lt;a href="https://subscribepage.io/mateusznowak"&gt;HERE&lt;/a&gt;. Or if your speak Polish - sign up &lt;a href="https://nakodach.pl/lista-mailingowa/"&gt;HERE&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>eventmodeling</category>
      <category>modularization</category>
      <category>ddd</category>
      <category>eventstorming</category>
    </item>
    <item>
      <title>Bulbasaur, Squirtle, or Charmander? Or rather Java, C#, or perhaps Ruby? What should I choose in 2024.</title>
      <dc:creator>Mateusz Nowak</dc:creator>
      <pubDate>Fri, 05 Apr 2024 13:29:30 +0000</pubDate>
      <link>https://dev.to/mateusznowak/bulbasaur-squirtle-or-charmander-or-rather-java-c-or-perhaps-ruby-what-should-i-choose-in-2024-3eog</link>
      <guid>https://dev.to/mateusznowak/bulbasaur-squirtle-or-charmander-or-rather-java-c-or-perhaps-ruby-what-should-i-choose-in-2024-3eog</guid>
      <description>&lt;p&gt;"Mateusz, I want to become a programmer! But... which language should I choose to start? Everyone I ask tells me something different." - I often have people come to me with this dilemma. Do you also want to start your programmer training? Then the answer to this question is just a Pokéball throw away!&lt;br&gt;
You can get in the right mood by listening to &lt;a href="https://www.youtube.com/watch?v=fCkeLBGSINs&amp;amp;t=1s" rel="noopener noreferrer"&gt;Original Pokemon Theme Singer Jason Paige In Studio Full Pokemon Theme Song&lt;/a&gt; and... let's get started!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ll7baj0oo1qtud5k7u1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ll7baj0oo1qtud5k7u1.gif" alt="PokeBall Throw"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Remember how Ash Ketchum, the main character of the Pokémon series, wondered which Pokémon to choose: Charmander, Squirtle, or Bulbasaur?&lt;br&gt;
Every Trainer starting their adventure faced this tough nut to crack.&lt;br&gt;
Ultimately, to his and all the young viewers' surprise, his most loyal companion throughout all his adventures became the well-known Pikachu — an electric mouse.&lt;br&gt;
However, Ash also caught other Pokémon along the way, as Pikachu was not effective against every opponent he encountered.&lt;br&gt;
To fulfill his dream and become a Pokémon World Champion, the young boy had to select the right types of his Pokémon to beat the creatures of the trainers he had to battle against.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Programming Language is Like... a Pokémon!
&lt;/h2&gt;

&lt;p&gt;Just like you, if you dream of becoming a programmer... It's true, right!? Then you must decide which programming language to choose in order to start the adventure!&lt;br&gt;
Depending on their type, Pokémon were more or less effective in certain situations, and the same goes for technologies.&lt;br&gt;
If in Pokémon games you need to cross to distant islands, you'll definitely need a water-type Pokémon to swim with (unfortunately, Pikachu probably won't manage to do that) — similarly, when choosing a language for mobile applications, you wouldn't pick one that's used for programming refrigerator controllers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foqqzsmm0rnxt9t10931h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foqqzsmm0rnxt9t10931h.png" alt="Pokemon Shadows Not Effective"&gt;&lt;/a&gt;&lt;br&gt;
On the screen, you can see that Pokémon of fire types are not very effective against water types.&lt;/p&gt;

&lt;p&gt;If you're just setting off into the fascinating world of software development or looking to expand your skills, I'll tell you a bit about the applications of programming languages I've ever worked with during my professional career.&lt;/p&gt;




&lt;h2&gt;
  
  
  I wanna be the very best…
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;…like no one ever was!&lt;/strong&gt; This line from the opening song of the mentioned Anime accompanied me in my childhood. With this text in mind, I now give you a task for the next paragraphs of this post: Look for something that fascinates you! Do you already have an idea for an app? Or would you like to be able to code something like the next Facebook, or a computer game? As you go through different programming languages, "catch 'em all" won't necessarily be the best advice.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Choose one language to start with, from which you indeed wanna be "the very best"! Focus on that one, which will be your priceless companion in the way to creating your dream application. Then, the future job as a programmer and the associated benefits (If you know what I mean 💵💵💵) will come on their own. As Mark Twain said: "Find a job you enjoy doing, and you will never have to work a day in your life".&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let me be like Professor Oak to Pokémon trainers for you. I'll introduce you to this world, showing sample applications and discussing employment opportunities. Everything will be based on my professional experience and mentoring other programmers.&lt;/p&gt;




&lt;h3&gt;
  
  
  English
&lt;/h3&gt;

&lt;p&gt;In the Pokémon world, there are "Legendary" creatures, encountering one can be quite surprising. English in this lineup might evoke similar emotions. After all, we were supposed to talk about programming! And that's exactly what we're doing... starting with the most important language for a programmer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb8qgp8a377uin4l1j29i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb8qgp8a377uin4l1j29i.png" alt="Reshiram - legendary Pokemon"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You don't necessarily have to be a British scholar. In most cases (if you won't work with English-native people) you don't even have to speak it so often. However, when writing code, you will certainly use it. So the most important are writing and reading skills. I assume you have them, because you understand this article :) Congratulations! 🎉 First step passed ✅.&lt;/p&gt;

&lt;h3&gt;
  
  
  Java
&lt;/h3&gt;

&lt;p&gt;This is the programming language that got me my first job, so I'll start with it here. Java is primarily used for the backend, which is the server-side part of an application.&lt;/p&gt;

&lt;p&gt;The frontend is the part you see—the tip of the iceberg, while the backend is everything else. For example, Google's search "on the front" includes screens for entering a search phrase and displaying results—seemingly nothing complicated. However, it's on the backend where all the "magic" happens with indexing pages, databases, and suggesting the right results to you.&lt;/p&gt;

&lt;p&gt;To grasp the basics of the language, I found the following book very helpful: &lt;a href="https://amzn.to/4aNCGxX" rel="noopener noreferrer"&gt;Java: The Complete Reference&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqpq4mfq50mzxzmnwecco.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqpq4mfq50mzxzmnwecco.jpeg" alt="Programming IceBerg Backend/Frontend"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you've built a solid foundation, the next step might be to familiarize yourself with &lt;a href="https://spring.io/" rel="noopener noreferrer"&gt;Spring Boot&lt;/a&gt; framework — a tool that simplifies the creation of the mentioned backend.&lt;br&gt;
Java has another important appliance — you can use it to develop Android mobile apps, but more on that shortly.&lt;br&gt;
The language has also been continuously evolving for some time. For years, the latest version was 8 (until 2017), but as I write this article, the latest version is 21, and the language is still being regularly improved.&lt;br&gt;
Given the great number of job offers, it's a very good choice for start in the IT industry.&lt;/p&gt;

&lt;h3&gt;
  
  
  Kotlin
&lt;/h3&gt;

&lt;p&gt;If it weren't Kotlin, Java would have faded into oblivion for me a long time ago. Kotlin is my favorite language, which I use for both backend and mobile applications. The principle is simple: with Kotlin, you can do everything you can in Java and more! Mostly recognized in pair with Android, because Google chose Kotlin as the official language for developing applications on this platform (previously, it was Java). It's worth knowing the basics of Java to understand "what's happening under-the-hood", as Kotlin can be seen as an evolution of Java (they are based on the same technology and are executed using the JVM - Java Virtual Machine).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fejw73tvgcmc003nqxc5w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fejw73tvgcmc003nqxc5w.png" alt="KotlinJavaEvolution"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Creating mobile apps gave me a great motivation for programming, because I was finally making "something even my mom could see" instead of just displaying text on the screen.&lt;br&gt;
Maybe it will be the same for you?&lt;/p&gt;

&lt;p&gt;If so, it's worth checking out the Udacity platform.&lt;br&gt;
You'll find many high-quality free courses (prepared, among others, by Google) on entry-level like this:&lt;br&gt;
&lt;a href="https://www.udacity.com/course/developing-android-apps-with-kotlin--ud9012" rel="noopener noreferrer"&gt;Developing Android Apps with Kotlin&lt;/a&gt;.&lt;br&gt;
Even if you choose a different programming language, it's still worth exploring this e-learning platform.&lt;/p&gt;

&lt;p&gt;Once you understand what's possible with a given programming language, think about what kind of app you could make for yourself, and just look for materials that will help you achieve the goal.&lt;br&gt;
When I was learning Android, along with a group of friends, we often played a well-known party game - &lt;a href="https://en.wikipedia.org/wiki/Mafia_(party_game)" rel="noopener noreferrer"&gt;Mafia&lt;/a&gt;.&lt;br&gt;
So, I decided to make an app that simplified leading the game by game master and understanding of its complex rules.&lt;br&gt;
Find anything that brings you joy; it doesn't have to be the next Instagram right away.&lt;/p&gt;

&lt;p&gt;In terms of job offers, as of writing this article, Java still leads compared to Kotlin.&lt;br&gt;
However, if you want to be an Android developer, it's certainly the right path, but not the only one...&lt;/p&gt;

&lt;h3&gt;
  
  
  Dart (Flutter)
&lt;/h3&gt;

&lt;p&gt;So, we're smoothly moving on to Flutter, another technology from Google. With this tool, using the Dart language, you'll be able to write applications that run on both Android and iOS. It's also possible to write applications for web browsers and computers. This is a very good choice for companies that don't have the money for two teams of developers but want to have apps in both the AppStore and Google Play. However, from the perspective of a beginner programmer, it's hard to find employment. Usually, if someone already knows how to write native apps for Android or iOS, only then do they expand their knowledge and getting familiar with Flutter. Flutter also has its limitations, and sometimes you may need to write a piece of code in Kotlin (Android) or Swift (iOS). You can find many good tutorials on the official &lt;a href="//Flutter.dev"&gt;Flutter.dev&lt;/a&gt; website.&lt;/p&gt;

&lt;h3&gt;
  
  
  C++
&lt;/h3&gt;

&lt;p&gt;Did you have C++ or Pascal in school? I'm sorry to disappoint you... but it had little to do with professional programming. Certainly, this is not an argument to continue learning in these languages. I only encountered this language in high school and at university, so I won't elaborate much. C++ might be a good choice, for example, if you want to make computer games using Unreal Engine. However, to do this professionally, you really need to be an expert. You will hardly find offers for a Junior C++ Developer.&lt;/p&gt;

&lt;p&gt;I recently mentored someone looking for employment in C++. When they came to me, they had already spent several months on unsuccessful job hunting. Eventually, I suggested switching to C#, which turned out to be a bullseye in terms of getting their first job.&lt;/p&gt;

&lt;h3&gt;
  
  
  C# (.NET)
&lt;/h3&gt;

&lt;p&gt;The previously mentioned C# is a very good language for entering the industry.&lt;br&gt;
Especially if we're talking about the backend of web applications, where we can use the .NET Core framework.&lt;br&gt;
Indeed, you can also create the frontend (the visual part) using Blazor technology, but I've never seen it applied in real production applications.&lt;br&gt;
The C# great advantage is the consistency of the technologies and approaches used. Most are from Microsoft, so you don't have to scout half of the internet, before deciding how to accomplish a given task.&lt;br&gt;
Some programmers also used to make mobile applications with the Xamarin platform, but I haven't known anyone who programs in it for a long time.&lt;br&gt;
Nowadays, the new approach for phones and tablets from Microsoft is &lt;a href="https://dotnet.microsoft.com/en-us/apps/maui" rel="noopener noreferrer"&gt;.NET MAUI&lt;/a&gt;, although here too, we won't find many job offers.&lt;/p&gt;

&lt;p&gt;There are a lot of job offers for .NET developers, almost as many as for Java.&lt;br&gt;
In the index of the most popular programming languages, which you can find &lt;a href="https://www.tiobe.com/tiobe-index/" rel="noopener noreferrer"&gt;HERE&lt;/a&gt;, it was C# that saw the biggest growth in 2023. I also programming in this language over a year, because company which I joined, have been already using it before.&lt;/p&gt;

&lt;h3&gt;
  
  
  JavaScript (+ HTML/CSS)
&lt;/h3&gt;

&lt;p&gt;Do you want even your mom to understand what you do at work? Then stepping into the world of frontend development is an excellent choice! You'll be responsible for what users see in applications. It's important to have an aesthetic sense and distinguish more colors than just red, green, and blue.&lt;/p&gt;

&lt;p&gt;Here, the choice is obvious — you must master JavaScript as well as HTML and CSS (as a curiosity: these last two do not meet the definition of a “programming language”). HTML describes the structure of the page — where everything is located. CSS is used for styling, and JavaScript adds interactivity (e.g., what should happen after clicking a button).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ferfpghr6e05mkm1miksa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ferfpghr6e05mkm1miksa.png" alt="CSS HTML Containers"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can start learning with free courses on &lt;a href="https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/#basic-javascript" rel="noopener noreferrer"&gt;freeCodeCamp.org&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once you're familiar with the basics of JavaScript, mastering one of the frameworks will be necessary in order to develop larger web applications.&lt;br&gt;
This is a must to become a Junior Frontend Developer.&lt;br&gt;
Currently, the most popular is React. I've learned the basics from this course: &lt;a href="https://www.udemy.com/course/react-the-complete-guide-incl-redux/" rel="noopener noreferrer"&gt;React - The Complete Guide 2024 (incl. React Router &amp;amp; Redux)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It's also good to know the basics of UI/UX Design and a design interface program like Figma.&lt;br&gt;
You will have to work with UI/UX Designers - specialists in this field.&lt;br&gt;
One person I mentored even discovered a stronger pull towards design than coding and became a Designer instead of a Frontend Developer, which I'm very happy about that she found her way to the industry.&lt;br&gt;
This is what individual mentoring offers — the opportunity to find what is inside you and turn it into a job you'll love.&lt;/p&gt;

&lt;p&gt;JavaScript can be useful in a variety kinds of applications.&lt;br&gt;
You can certainly also use it for Backend — then you would apply Node.js.&lt;br&gt;
A mobile application? With something like React Native, it's also possible. Let's use Electron - and you will make a desktop application!&lt;br&gt;
Having JavaScript in your toolkit is almost like having a Pokemon of every type in your team.&lt;br&gt;
Unlike C#, it's hard to find any standards here. You will find a multitude of different solutions for everything.&lt;br&gt;
Recalling a famous saying in the programming world: "by the time you read this article, surely some new JavaScript framework has been released".&lt;/p&gt;

&lt;p&gt;Since we're on the subject of Pokemon, I'll show you two applications created by developers after about 2 months of intensive learning with a mentor. You can see them here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://lukaszdutka.github.io/CodersCamp2020.Project.TypeScript.pokemonfight/" rel="noopener noreferrer"&gt;Pokemon Fight&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://lukaszdutka.github.io/CodersCamp2020.Project.JavaScript.pokemonquiz/" rel="noopener noreferrer"&gt;Pokemon Quiz&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They were made by participants of CodersCamp — the largest web programming course in Poland, which I was organizing.&lt;br&gt;
This will give you an idea of what's possible and what to expect from yourself at the beginning.&lt;/p&gt;

&lt;p&gt;There are definitely the most offers in JavaScript from all programming languages, but you need to read carefully to know exactly whether it's about backend/frontend, or maybe both at once (programmers who can handle them are termed Full-Stack Developers).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftriasnozl4bs4xni3721.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftriasnozl4bs4xni3721.png" alt="JavaScriptHamHamster"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Python
&lt;/h3&gt;

&lt;p&gt;I haven't had much to do with Python and I am not a huge fan of this language. If you want to create web applications, then in my opinion, the ones discussed above are a better choice, and you will find more job offers in them. However… if you want to engage in Machine Learning or enter the world of Artificial Intelligence, Python will be the best choice.&lt;/p&gt;

&lt;p&gt;Is mathematics needed in programming? Usually, my answer is: NO, beyond the complete basics. However, I can't imagine going into AI if you'r not strong in math — of course, everything can be learned :) It's a huge difference between developing AI solutions by yourself and using already prepared libraries (such as TensorFlow) or integrating with ChatGPT — here most of the work is done for you, and you can achieve this in most of the mentioned languages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ruby
&lt;/h3&gt;

&lt;p&gt;I left this language for the end of this article.&lt;br&gt;
Though, in reality, it was the first programming language I use in my life (when I was 13), and I didn't even know it at the time!&lt;br&gt;
How is that possible? During scrolling this article you may noticed several screenshots from Pokemon games.&lt;br&gt;
However, these were not from any of the official Nintendo console productions, but my own game! The developing of the game is where I actually started my programming journey.&lt;br&gt;
That's why the question "how to start programming" will always be associated with Pokemon for me.&lt;/p&gt;

&lt;p&gt;As a small child, I dreamed of making my own Pokemon game.&lt;br&gt;
I remember my brother playing Pokemons on the GameBoy when I was in elementary school and I drew on paper what cities and trainers I would make in my own game.&lt;br&gt;
When I was in junior high school, I realized that I could actually do it!&lt;br&gt;
And so, through various forums and chatting with different people on the Internet, I entered the world of &lt;a href="https://www.rpgmakerweb.com/products/rpg-maker-xp" rel="noopener noreferrer"&gt;RPG Maker XP&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That's how I met Ruby, despite that my Pokedex knew nothing about it.&lt;br&gt;
It was hidden under the enigmatic abbreviation RGSS, which stands for Ruby Game Scripting System used in th RPG Maker.&lt;br&gt;
And I started writing scripts dedicated for RPG Maker XP (a program that simplified creating 2D RPG games).&lt;/p&gt;

&lt;p&gt;If you want to make a living from programming and don't have much free time, I wouldn't recommend such "fun".&lt;br&gt;
Unless you want to do it just as a hobby or get your children interested in programming — it can be a really good start.&lt;br&gt;
Such an activity also greatly develops graphic skills or storytelling abilities. For inspiration, below are two maps from the mentioned game.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foymbitjofminjb0dae4h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foymbitjofminjb0dae4h.png" alt="The biggest City in my Pokemon Game"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm9k0oefgkbh166efc7zn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm9k0oefgkbh166efc7zn.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of course the Ruby itself is not only a language for RPG Maker, but its applications are very broad (mostly backend).&lt;br&gt;
Many well-known companies use this technology. It allows fast application development, so it's said to be great for startups, where time to market is crucial.&lt;br&gt;
I haven't used it much in the past, but now I'm faimilarize myself with RailsEventStore - the Ruby technology supporting Event Sourcing (this approach for storing data is my expertise area).&lt;br&gt;
However, finding a job in this technology can be challenging.&lt;br&gt;
As Andrzej Krzywda, the CEO of Arkency (a company specializing in Ruby) says, it's a community where jobs are primarily found through referrals instead of posting on job boards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sooo, how to choose?
&lt;/h2&gt;

&lt;p&gt;So, have you settled on your dream Bulbasaur?&lt;br&gt;
Or does it seem like an unexpected Pikachu is the choice?&lt;br&gt;
As you can see, programming languages often have similar applications.&lt;br&gt;
For Android apps, you could use Kotlin or Flutter,&lt;br&gt;
while for the Backend, you might choose Java/Kotlin/C#/JavaScript.&lt;/p&gt;

&lt;p&gt;So, how do you make this decision?&lt;br&gt;
Backend or frontend?&lt;br&gt;
Would you prefer to play around with graphics, or do you wave the white flag when the conversation turns to colors?&lt;br&gt;
Maybe you'd rather dive into algorithms/business logic and work on databases?&lt;br&gt;
Or perhaps games? Have you recently seen an app and thought: “I wish I could make something like that!”.&lt;br&gt;
Or maybe you're very good at math, algorithms and would like to use that in AI?&lt;/p&gt;

&lt;p&gt;You'll have to answer that yourself or with the help of a mentor!&lt;/p&gt;

&lt;h2&gt;
  
  
  Arm in arm, we'll win the fight
&lt;/h2&gt;

&lt;p&gt;At the beginning of your programming journey, it's worthwhile to rely on someone more exprienced in order to not wasting precious time. &lt;br&gt;
I learned by myself, so surely you can too!&lt;br&gt;
However, maybe you have a friend who is a programmer who could help you? Ash didn't travel through the world of Pokémon alone but was almost from the very start accompanied by Misty and Brock.&lt;br&gt;
Even the evil Team Rocket didn't act alone.&lt;br&gt;
Though, of course, everyone has their preferred style of learning, and maybe you'll grow better studying alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  The power that's inside
&lt;/h2&gt;

&lt;p&gt;Whether you start the journey alone or with someone, the principle of learning remains the same:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Learn the basics of the programming language (simply how to write in it, what constructions to use — to express what you want).&lt;/li&gt;
&lt;li&gt;Find a tutorial on making an application from A to Z and do exactly what the instructor does. Don't skip any part, but you can introduce your modifications, check what happens when you change something.&lt;/li&gt;
&lt;li&gt;Based on the knowledge from points 1 and 2, code an application according to your own idea (as I did, which you can find in the article) and learn what's necessary to achieve your goal.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can start with the simplest project and then gradually increase the level of difficulty while building your portfolio.&lt;br&gt;
Such a set of completed applications will be invaluable when looking for your first job! It's the most advantage in your future resume, when you don't have commercial experience.&lt;/p&gt;

&lt;p&gt;So, do you already know what application you'll make?&lt;br&gt;
You can share your ideas and dilemmas in the comments below.&lt;br&gt;
Good luck 🤞!&lt;/p&gt;




&lt;p&gt;📧 I encourage you to join my &lt;a href="//subscribepage.io/mateusznowak"&gt;mailing list&lt;/a&gt;. Here you will find more content like this and also have opportunity to learn with me :) &lt;/p&gt;

</description>
      <category>learning</category>
      <category>pokemon</category>
      <category>java</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to learn Domain-Driven Design &amp; Event Sourcing? My own Developer Journey Map and useful resources.</title>
      <dc:creator>Mateusz Nowak</dc:creator>
      <pubDate>Wed, 21 Apr 2021 14:54:28 +0000</pubDate>
      <link>https://dev.to/mateusznowak/how-to-learn-domain-driven-design-event-sourcing-my-own-developer-journey-map-and-useful-resources-308a</link>
      <guid>https://dev.to/mateusznowak/how-to-learn-domain-driven-design-event-sourcing-my-own-developer-journey-map-and-useful-resources-308a</guid>
      <description>&lt;p&gt;Have you ever heard about Domain-Driven Design or Event Sourcing and you want to get familiar with those exciting techniques? &lt;/p&gt;

&lt;h2&gt;
  
  
  TL; DR
&lt;/h2&gt;

&lt;p&gt;You can find the map of my developer journey (with DDD &amp;amp; Event Sourcing resources) below:&lt;br&gt;
&lt;a href="https://miro.com/app/board/o9J_lOPIH-Y=/?moveToWidget=3074457357614202364&amp;amp;cot=14" rel="noopener noreferrer"&gt;MIRO BOARD LINK - Developer Journey Map - DDD &amp;amp; Event Sourcing&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Every single time
&lt;/h2&gt;

&lt;p&gt;But the problem is the same as always. When your journey with programming just began you were probably asking: &lt;em&gt;Where to learn? What should I learn? What should I do at first? How long may it takes to be hired? What are best practices?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The story repeats with new things to learn. &lt;em&gt;Where to find resources? In which order should I watch them (like Star Wars movies)?&lt;/em&gt;&lt;br&gt;
Prepare own learning path is not so easy. So, I've done it for you, young Padawan!&lt;/p&gt;

&lt;h2&gt;
  
  
  3 years of exploration in one place
&lt;/h2&gt;

&lt;p&gt;I've been learning those concepts for about 3 years. Almost every day I read new posts / books etc. related to those topics. I've fallen in love with DDD and ES just when I've heard about them from the best lecturer on my university.&lt;br&gt;
I believe those techniques may prevent a lot of bad decisions and save your software projects. DDD is not only about coding patterns, the most important part (strategic patterns) are about searching solution for business problems (solution may be a piece of software, but is not required). &lt;/p&gt;

&lt;h2&gt;
  
  
  What? Your CODE is evolving!
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn2.bulbagarden.net%2Fupload%2F5%2F56%2FEvolution_FRLGE.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn2.bulbagarden.net%2Fupload%2F5%2F56%2FEvolution_FRLGE.png" alt="CodeEvolution"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But the readable code is a side effect of good design decision in the spirit of DDD. Below you can see how my coding style of domain model evolves with those techniques in mind.&lt;/p&gt;

&lt;h4&gt;
  
  
  BEFORE
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;changeMaximumRetention&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;maxRetention&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nc"&gt;DataRetention&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;isValidRetention&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;maxRetention&lt;/span&gt;&lt;span class="p"&gt;)){&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;InvalidRetentionException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;maxRetention&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;deletionIsPaused&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;DataRetention&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;maxRetentionDays&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;deletionIsPaused&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pauseReason&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;DataRetention&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;maxRetentionDays&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Paused due to maximum data retention update"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Do not stop so long on this piece of code... Let's move to the next one.&lt;/p&gt;

&lt;h4&gt;
  
  
  AFTER
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;changeMaximumRetention&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;maxRetention&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;RetentionDays&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;DomainEvent&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;maximumRetentionWasChanged&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;MaximumRetentionWasChanged&lt;/span&gt;
       &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;maxRetentionDays&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;deletionWasPaused&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DeletionWasPaused&lt;/span&gt;
       &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Paused due to maximum data retention update"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;deletionIsPaused&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;listOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;maximumRetentionWasChanged&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="nf"&gt;listOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;maximumRetentionWasChanged&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;deletionWasPaused&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reasoning about this code is so simple right now, even if you don't know the domain. I hope that you see what are the business rules here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Given data deletion is paused, when change maximum retention, then maximum retention should be changed to new value.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Given data deletion is not paused, when change maximum retention, then maximum retention should be changed to new value and data deletion should be paused.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Developer Journey Map
&lt;/h2&gt;

&lt;p&gt;I've prepared Miro Board with a mind map which will guide you. You can find where to start your own developer journey today! There is a lot of Domain-Driven Design &amp;amp; Event Sourcing resources to discover. There are also sample projects which I recommend to watch. I hope, that following my footsteps will make you a better developer day by day.&lt;/p&gt;

&lt;p&gt;Let's grab the map below!&lt;br&gt;
&lt;a href="https://miro.com/app/board/o9J_lOPIH-Y=/?moveToWidget=3074457357614202364&amp;amp;cot=14" rel="noopener noreferrer"&gt;MIRO BOARD LINK - Developer Journey Map - DDD &amp;amp; Event Sourcing&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7lptanjqa2i763mvub9f.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7lptanjqa2i763mvub9f.jpg" alt="emma-van-sant-n8V1Zht4U54-unsplash"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;I'm sure that those resources will give you a strong theoretical background and will be a compass on your way to practice and mastery. &lt;br&gt;
Let's begin your own journey and catch'em all!&lt;/p&gt;

&lt;h2&gt;
  
  
  This is the way
&lt;/h2&gt;

&lt;p&gt;Are you already on the way?&lt;br&gt;
Maybe do you recommend some other resources which I should place on the map? Or have you already learn something from them? Please let me know in the comments :) &lt;br&gt;
I will be updating the map which new discoveries, so be sure to return here from time to time.&lt;/p&gt;




&lt;p&gt;📧 I encourage you to join my &lt;a href="//subscribepage.io/mateusznowak"&gt;mailing list&lt;/a&gt;. Here you will find more content like this and also have opportunity to learn with me :) &lt;/p&gt;

</description>
      <category>ddd</category>
      <category>eventsourcing</category>
      <category>domaindrivendesign</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
