<?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: André</title>
    <description>The latest articles on DEV Community by André (@andremw).</description>
    <link>https://dev.to/andremw</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%2F149964%2Fa3a50042-3397-47a5-a8d0-8adf281305ed.jpeg</url>
      <title>DEV Community: André</title>
      <link>https://dev.to/andremw</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/andremw"/>
    <language>en</language>
    <item>
      <title>Using F# and DDD to create an online card game [On hold]</title>
      <dc:creator>André</dc:creator>
      <pubDate>Tue, 30 Jun 2020 02:43:40 +0000</pubDate>
      <link>https://dev.to/andremw/using-f-and-ddd-to-create-an-online-card-game-on-hold-e2j</link>
      <guid>https://dev.to/andremw/using-f-and-ddd-to-create-an-online-card-game-on-hold-e2j</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tQ0_J02e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2Ah_3nd87IIKRd8Naz" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tQ0_J02e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2Ah_3nd87IIKRd8Naz" alt="Books"&gt;&lt;/a&gt;Photo by &lt;a href="https://unsplash.com/@kaimantha?utm_source=medium&amp;amp;utm_medium=referral"&gt;Claudia Wolff&lt;/a&gt; on &lt;a href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This would be the third post of a series of posts about domain-driven design and functional programming with F#. Last week was crazy and I didn't post anything and it was difficult to study DDD too.&lt;/p&gt;

&lt;p&gt;Even though the third post was almost done, I decided to put this series of posts on hold for some days. The reason is that I noticed that, since it's my first time studying DDD, I still need to re-read some parts of &lt;a href="https://www.amazon.com/Domain-Modeling-Made-Functional-Domain-Driven/dp/1680502549"&gt;the book&lt;/a&gt; to understand them better before continuing with the implementation otherwise I will get confused (and also confuse others) by forcefully writing something.&lt;/p&gt;

&lt;p&gt;Since I'm writing this series primarily for myself, I won't bother pausing it for now. I'll continue the studies and then I'll start posting again as soon as I understand it a little bit better, maybe next Monday.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/andremw/using-f-and-ddd-to-create-an-online-game-card-547c-temp-slug-1627209"&gt;◀️ Part 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/andremw/using-f-and-ddd-to-create-an-online-card-game-part-2-27nl"&gt;◀️ Part 2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>programming</category>
      <category>domaindrivendesign</category>
      <category>functional</category>
      <category>fsharp</category>
    </item>
    <item>
      <title>Using F# and DDD to create an online card game[Part 2]</title>
      <dc:creator>André</dc:creator>
      <pubDate>Tue, 16 Jun 2020 22:04:13 +0000</pubDate>
      <link>https://dev.to/andremw/using-f-and-ddd-to-create-an-online-card-game-part-2-27nl</link>
      <guid>https://dev.to/andremw/using-f-and-ddd-to-create-an-online-card-game-part-2-27nl</guid>
      <description>&lt;p&gt;(this post was imported from &lt;a href="https://medium.com/@andremw/using-f-and-ddd-to-create-an-online-card-game-part-2-202a22c88089"&gt;Medium&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;This is the second post of a series about domain-driven design and functional programming with F#, based on the book Domain Modeling Made Functional. You can read the intro &lt;a href="https://dev.to/andremw/using-f-and-ddd-to-create-an-online-card-game-4lam"&gt;here&lt;/a&gt;. Disclaimer: This post won’t contain any code. We’ll start to see some code in the next posts.&lt;/p&gt;




&lt;p&gt;I’ll start to model the domain in a way that a non-technical person can understand. This can be done by creating a shared understanding of the domain. There are some techniques that can be used to achieve this understanding and the first one presented in the book is Event Sourcing.&lt;/p&gt;

&lt;p&gt;Ideally, it should be done in a meeting with some domain experts and the development team, but I’ll use &lt;a href="https://boardgamegeek.com/boardgame/148203/dutch-blitz"&gt;online content&lt;/a&gt; to help me create a shared understanding. There’s a nice video explaining it too.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;iframe width="710" height="399" src="https://www.youtube.com/embed/6n3VyC0ngY8"&gt;
&lt;/iframe&gt;

&lt;/h2&gt;

&lt;p&gt;I’ll start by creating the domain events that can happen (I might add more later since my understanding of the domain can still evolve):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nXMwmFRR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/77bwpbky2dh7oyuaxor8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nXMwmFRR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/77bwpbky2dh7oyuaxor8.png" alt="Event Sourcing - Events"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We might think about what makes these business events happen. An event might be triggered, for example, by a player that placed a card, or by someone trying to join the game.&lt;br&gt;
We will call these things commands. These commands might fail (for example if a game cannot be joined), but just as the book does, we won’t bother trying to think about it now. Not all events will have commands associated with them.&lt;/p&gt;

&lt;p&gt;A command always initiates a corresponding business workflow — a function with an input and an output. I will omit the workflows’ boxes to save some space in the timeline.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jcPwSpyC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uexp42szdh92j5q6v521.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jcPwSpyC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uexp42szdh92j5q6v521.png" alt="Event Sourcing - Events and commands"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So now we have created the commands that trigger the events. For example, when a player commands to “Join Game”, a “Join Game” workflow is executed and it then produces a “Player joined game” event. The “Place Card” command will always trigger the “Card Placed” event but it can also trigger two more events depending on the player’s blitz pile and overall score.&lt;/p&gt;




&lt;p&gt;After listing the events and commands, we can create the bounded contexts and the context maps. I think we could create a “Game creation context” and a “game validation context” but since I think it would be an overkill, I will skip this part and revisit it later. For now, I’ll consider we have only one bounded context.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A note: bounded contexts can be good indicators of microservices that can eventually be created.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Since I didn’t have much time to work on this game yet (the first post was two days ago), I will keep this post short. Next Monday I’ll have more interesting things to talk about.&lt;/p&gt;

&lt;p&gt;But what do you think? Have I listed all the events properly? Can I improve the events and the commands?&lt;/p&gt;

</description>
      <category>ddd</category>
      <category>functional</category>
      <category>fsharp</category>
      <category>games</category>
    </item>
    <item>
      <title>Using F# and DDD to create an online card game</title>
      <dc:creator>André</dc:creator>
      <pubDate>Tue, 16 Jun 2020 19:50:35 +0000</pubDate>
      <link>https://dev.to/andremw/using-f-and-ddd-to-create-an-online-card-game-4lam</link>
      <guid>https://dev.to/andremw/using-f-and-ddd-to-create-an-online-card-game-4lam</guid>
      <description>&lt;p&gt;(this post was imported from &lt;a href="https://medium.com/@andremw/using-f-and-ddd-to-create-an-online-game-card-f7f43b60146b"&gt;Medium&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;In the last days, I have been studying a book that sparkled the beginner's excitement in me — a feeling that was a long time gone. The book is called Domain Modeling Made Functional, written by &lt;a href="https://fsharpforfunandprofit.com/"&gt;Scott Wlaschin&lt;/a&gt;, and is about using a functional language to design software following the principles from Domain-Driven Design (DDD).&lt;/p&gt;

&lt;p&gt;DDD and F# made me realize that there's still so much that can be done to improve the quality and reliability of software that we write.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://martinfowler.com/bliki/DomainDrivenDesign.html"&gt;"Domain-Driven Design is an approach to software development that centers the development on programming a domain model that has a rich understanding of the processes and rules of a domain."&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A nice quote from Domain Modeling Made Functional about DDD:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"If you think of software development as a pipeline with an input (requirements) and an output (the final deliverable), then the "garbage in, garbage out" rule applies. If the input is bad (unclear requirements or bad design), then no amount of coding can create a good output.&lt;br&gt;
(…) we'll look at how to minimize the "garbage in" part by using a design approach focused on clear communication and shared domain knowledge: domain-driven design, or DDD.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Since I know that the best way to learn is to practice what I'm studying, I challenged myself to write an online version of a simple but very nice card game that I play with my friends.&lt;/p&gt;

&lt;p&gt;The game is called Dutch Blitz and I see it as a "multi-player solitaire". It's important to notice that this is a study project and I don't intend to make any money with this game.&lt;/p&gt;

&lt;p&gt;In order to register my progress, I decided to write a series of posts about the theme.&lt;/p&gt;




&lt;p&gt;What are the technologies that I want to learn in order to build an online version of this game?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;F# in the server&lt;/li&gt;
&lt;li&gt;Elm in the client&lt;/li&gt;
&lt;li&gt;Websockets&lt;/li&gt;
&lt;li&gt;Azure to deploy the code (because I'll use F#)&lt;/li&gt;
&lt;li&gt;Whatever else I need to build multiplayer games (I’ll edit this section as I learn what these things are)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;The initial goals for this game are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Have a pure (no side-effects) functioning engine tested with TDD. I'll use DDD to model the domain.&lt;/li&gt;
&lt;li&gt;[ ] Have a functioning real-time multi-player state handler&lt;/li&gt;
&lt;li&gt;[ ] A simple, four-player, UI&lt;/li&gt;
&lt;li&gt;[ ] other stuff that I'll write as soon as I figure more things out&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I won't spend a lot of time thinking about the architecture in the first moment. I'll think about it only after I have modeled the game domain.&lt;/p&gt;




&lt;p&gt;Since I'm a beginner, I expect to make wrong assumptions about the domain and to use DDD/F# in the wrong ways many times as I learn and make progress. But it's ok! Learning involves making mistakes.&lt;/p&gt;

&lt;p&gt;Every Monday I'll release new posts. Stay tuned :)&lt;/p&gt;

</description>
      <category>ddd</category>
      <category>functional</category>
      <category>fsharp</category>
      <category>games</category>
    </item>
  </channel>
</rss>
