<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Piotr Korlaga on Medium]]></title>
        <description><![CDATA[Stories by Piotr Korlaga on Medium]]></description>
        <link>https://medium.com/@piotrkorlaga?source=rss-d5d41a2406c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-iSGxPZ08Cn7Hb3AZvLa6A.jpeg</url>
            <title>Stories by Piotr Korlaga on Medium</title>
            <link>https://medium.com/@piotrkorlaga?source=rss-d5d41a2406c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 01:45:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@piotrkorlaga/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to implement breadcrumb navigation in Angular and PrimeNG?]]></title>
            <link>https://medium.com/applantic/https-medium-com-applantic-how-to-implement-breadcrumb-navigation-in-angular-and-primeng-52573e49b97a?source=rss-d5d41a2406c------2</link>
            <guid isPermaLink="false">https://medium.com/p/52573e49b97a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[primeng]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Piotr Korlaga]]></dc:creator>
            <pubDate>Thu, 06 Jun 2019 01:28:12 GMT</pubDate>
            <atom:updated>2019-06-06T02:34:11.719Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*zybbqyn9hR2Rt6SK7WjdyA.jpeg" /></figure><p>Have you ever struggled with the implementation of breadcrumb in your Angular app? I just created a working example. Check out this article for code, demo, and explanations!</p><h3>Some time ago</h3><p>I was struggling with breadcrumb navigation in one of my Angular apps. I had read many articles about that but couldn’t find properly working solution. After many experiments, I created the implementation which I want to share in this article.</p><p>Our goal is to create breadcrumb which tells users where he is on the webpage. Breadcrumb should also contain links. Thanks to that links, the user can navigate back and forward through the app.</p><p>To demonstrate I created a simple app — World Explorer. [<a href="https://piotrkorlaga.github.io/demo-angular-breadcrumb"><strong>DEMO</strong></a>, <a href="https://github.com/piotrkorlaga/demo-angular-breadcrumb"><strong>CODE</strong></a>]</p><iframe src="https://www.screencast.com/users/piotrkorlaga/folders/Jing/media/76894c7d-5f41-4fee-a575-d0e632d3feae/embed" width="1608" height="468" frameborder="0" scrolling="no"><a href="https://medium.com/media/a19da41db801f3282f6006e3845445de/href">https://medium.com/media/a19da41db801f3282f6006e3845445de/href</a></iframe><p>The app is extremely simple. It contains only two sections: breadcrumb navigation and page content. On every page we have clickable links which navigate a user through the world in the following hierarchy:</p><p><strong>Home -&gt; Continent -&gt; Country -&gt; City</strong></p><iframe src="https://www.screencast.com/users/piotrkorlaga/folders/Jing/media/3c43cda9-8509-41c7-b23d-d2f83d87679d/embed" width="1692" height="1126" frameborder="0" scrolling="no"><a href="https://medium.com/media/b42c62cbce603704e7fab5bb9a2a52e8/href">https://medium.com/media/b42c62cbce603704e7fab5bb9a2a52e8/href</a></iframe><p>Simple, right?</p><p>In the following paragraphs, I will show you how to integrate Angular Router with breadcrumb navigation. I will try to cover all important issues, but at the same time, I strongly encourage you to dive in the code on GitHub and explore it on your own.</p><h3>1. Define routing</h3><p>It is good practice to split an app into a few modules. I decided to extract the home page module and a module for each continent. This is the first level of our hierarchy: continents. The code looks as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f18e8c6d9cf17d1a8e711fdebdc9cef2/href">https://medium.com/media/f18e8c6d9cf17d1a8e711fdebdc9cef2/href</a></iframe><p>When the user clicks Europe on the home screen we want to display a list of countries. User can click on any of countries and then we display a list of cities in that country. And when finally user click on any of the cities, a nice picture of that city should show up.</p><p>Note that we want to display every level of hierarchy (C<strong>ontinent -&gt; Country -&gt; City</strong>) in the same place on the webpage. So the next level should replace the previous one. To achieve that we have to create a little bit tricky routing table. As an example: let’s take a look at <strong>Europe Module </strong>routing<em>:</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5dea7b4f8039b261bb89ee104ee52fd2/href">https://medium.com/media/5dea7b4f8039b261bb89ee104ee52fd2/href</a></iframe><p>For every level of hierarchy we need to specify:</p><ol><li>Object with two properties <strong>path </strong>and<strong> children </strong>or<strong> path </strong>and<strong> component</strong></li><li>List of children should contain <strong>child with empty path</strong> and <strong>other children with paths</strong></li></ol><p>The <strong>path</strong> is the URL part to which we navigate the user. In the example above, when we navigate the user to path <strong>/europe/germany</strong> then the child component with an empty path from the children list will show up. It’s <strong>GermanyComponent</strong> and contains a list of German cities. The user can click on Berlin, then the screen with a list of cities will be replaced with component contains a picture of the city which is specified for path: ‘berlin’.</p><p>If we would like to extend our hierarchy by adding for example districts we have to change our routing as follow:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d1d49dc71c3ca065b22ce6f05bec5909/href">https://medium.com/media/d1d49dc71c3ca065b22ce6f05bec5909/href</a></iframe><p>So to add the next level to the hierarchy of components we have to replace the component property with children and place the previous component as a child with an empty path.</p><h3>2. Pass breadcrumb label in routing data</h3><p>Angular Router allows us to pass any data while navigating. To achieve that the only one thing we have to do is extending our routing table with additional property <strong>data</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c16848982ae9f7a2f3c3a174a410f1c/href">https://medium.com/media/3c16848982ae9f7a2f3c3a174a410f1c/href</a></iframe><p>In data object, we declare breadcrumb property which is a label of a breadcrumb menu item. You probably noticed that I assigned a null value to breadcrumb properties in some cases. This is because when some property is undefined it inherits the value from its parent. That’s why I had to erase this value by assigning nulls.</p><h3>3. Create breadcrumb menu</h3><p>To simplify this step I used <strong>p-breadcrumb</strong> component which comes from PrimeNG. This is a pretty cool UI library with almost every UI component which you will probably ever need in your app. Check this out!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/227ff43308d0de698654becd623aaea2/href">https://medium.com/media/227ff43308d0de698654becd623aaea2/href</a></iframe><p>To display our menu we have to pass to <strong>p-breadcrumb</strong> a list of <strong>menuItems</strong> which are basically objects contain <strong>label</strong> and <strong>url</strong> property.</p><p>The list of <strong>menuItems</strong> has to be rebuilt every time a user navigate through the app. So we have to subscribe to <strong>NavigationEnd</strong> event:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/50710702abe090b09680d29eb1f72a1d/href">https://medium.com/media/50710702abe090b09680d29eb1f72a1d/href</a></iframe><p>Let’s take a look at how we actually build the breadcrumb <strong>menuItems </strong>in method <strong>createBreadcrumbs</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e8545015d42bf7f94ad4860358d23fa/href">https://medium.com/media/5e8545015d42bf7f94ad4860358d23fa/href</a></iframe><p>In this method, we iterate over children to create <strong>MenuItem </strong>object which contains <strong>url </strong>and<strong> label</strong>. We append it to the list of <strong>menuItems</strong> which we pass as an input of <strong>p-breadcrumb</strong> component.</p><h3>And that’s it!</h3><p>We successfully integrate PrimeNG breadcrumb component with Angular Routing and have working breadcrumb!</p><p>I encourage you to go through the code on GitHub and try to modify it to your needs. I used a hierarchy of countries and cities as an example but it can be easily adapted to any app.</p><p>Hope it was helpful!</p><p><a href="https://medium.com/_/subscribe/collection/applantic"><strong>Follow to not miss new articles!</strong></a><strong> 🚀</strong></p><p>Tap the 👏 button if you found this article useful!</p><p><strong>About us</strong></p><p><strong>Applantic </strong>is a team of passionate software developers. We write our stories on Medium ✍ but you can find us on <a href="https://goo.gl/cXV2W2">Instagram</a> 📷 or <a href="https://goo.gl/4SoE8Z">Facebook</a> ✍ as well.</p><p><strong>The author of this article is Piotr. </strong>He is a software engineer — well-versed in all phases of the software development lifecycle. He strongly believes in being agile and engineering culture. You can find him on <a href="https://goo.gl/aAEQy7">LinkedIn</a> and <a href="https://goo.gl/iQ1Qxs">GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52573e49b97a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/applantic/https-medium-com-applantic-how-to-implement-breadcrumb-navigation-in-angular-and-primeng-52573e49b97a">How to implement breadcrumb navigation in Angular and PrimeNG?</a> was originally published in <a href="https://medium.com/applantic">Applantic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 reasons why you should learn Java]]></title>
            <link>https://medium.com/applantic/5-reasons-why-you-should-learn-java-572b4dab329?source=rss-d5d41a2406c------2</link>
            <guid isPermaLink="false">https://medium.com/p/572b4dab329</guid>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[learn-to-code]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Piotr Korlaga]]></dc:creator>
            <pubDate>Sun, 04 Mar 2018 14:01:00 GMT</pubDate>
            <atom:updated>2018-03-04T14:08:11.038Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sYBh90nehiinkazSuH59_w.jpeg" /><figcaption><a href="https://pixabay.com/">https://pixabay.com/</a></figcaption></figure><p>Some people who are at the beginning of a career as a software developer ask me which language should they choose for a start. I usually respond that it doesn’t really matter. Why? Because the most important things in programming are common for every language.</p><p>You probably heard that programming requires you to learn new skills every day. Technologies are changing really fast. Programmers have to know plenty of different languages, hundreds of frameworks, and thousands of libraries.</p><p>This makes beginners confused. They always wonder if the technology they are adopting is good for a start. Does developer have to know all existing languages? Which one is the best? Java, C#, Ruby, Python, JavaScript? What will happen if I chose wrong? How to choose wisely?</p><p>I’ve been writing code in Java for 5 years. And I’m going to explain why choosing it as your first language is still worth. Despite that, Java was born years ago (1995) and there are lots of other languages. Perhaps more cool and fancier. Let me explain why I do think that investing your time in Java is still worth your effort.</p><h3>1. Friendly syntax</h3><p>Java is very verbose. This is very often considered as a disadvantage. But well…not for beginners. In Java a lot of things you have to write explicitly. It can be tiresome for experienced developers but at the same time, it can be helpful for people who start.</p><p>Java is stubborn. The language itself doesn’t let you do stupid things. It has garbage collector so you don’t have to bother with memory management. It has a lot of high-level building block already built-in. That means you can create something useful from the very beginning. You don’t need to use any external libraries to build valuable things.</p><p>Java has static types. It simply allows you to keep your code in order. And whats even more important, it allows you to clean and refactor your code without a huge effort after months of learning. You can use automatic refactoring tools build in your IDE which works based on static types.</p><h3>2. Huge community</h3><p>There is a lot of programmers who know Java. Even if they work with another language on daily basis. They still can read and understand Java code. So it means that they can help you with getting started.</p><p>If you are Java newbie you can count on massive Java community in such a place like StackOverflow, GitHub, Reddit, DZone and etc. There is plenty of bloggers which are eager to share knowledge. I’m even 100% sure that you personally know someone who codes in Java. Having mentor at the beginning is a game changer and something that would rush your progress.</p><h3>3. Books</h3><p>Well, that’s true that technologies are growing like crazy. But I would say that the foundation of computer science is quite stable. To understand core concepts you will have to study classical books which very often requires you to know Java.</p><p>Authors use examples written in Java or they use so-called pseudo code which syntax is frequently inspired by Java. If you want to dive deeper into computer science then Java or even C++ knowledge will be something that will help you a lot.</p><h3>4. JVM</h3><p>Java Virtual Machine is something that does not let Java’s world stop to grow. Thanks to that you know Java and its ecosystem you can switch to other languages like Scala, Kotlin, Groovy which are executed by JVM as well. You can easily use new modern features of these languages and mix them with Java tools which have been developed for many years.</p><h3>5. A lot of legacy code</h3><p>Well… legacy does not mean only badly written and difficult to maintain code. It also means software which works! The code that you can use to learn how to build things. You can expect that in Java world you will find very experienced people which are familiar with good practices and can teach you how to write code which works in production.</p><p>In Java, you can find a lot of mature tools and libraries which have been tested for years and you can trust that they work. Especially when you are building software which is going to last ages.</p><p>And last but not least. A lot of code has been written in Java already. It indicates that there is a big market which is hiring programmers of every level of experience.</p><h3>Final thoughts</h3><p>Hopefully, you will find this post useful. If you want to try programming don’t waste your time reading too many articles “how to start” or “which language should I learn”. Pick whatever and start building things. Programming languages are quite similar and easy to switch. Start with simple language with a solid community like Java and you will take advantage of this in the future.</p><p><a href="https://medium.com/_/subscribe/collection/applantic"><strong>Follow to not miss new articles!</strong></a><strong> 🚀</strong></p><p>Tap the 👏 button if you found this article useful!</p><p><strong>About us</strong></p><p><strong>Applantic </strong>is a team of passionate software developers. We write our stories on Medium ✍ but you can find us on <a href="https://goo.gl/cXV2W2">Instagram</a> 📷 or <a href="https://goo.gl/4SoE8Z">Facebook</a> ✍ as well.</p><p><strong>The author of this article is Piotr. </strong>He is a software engineer — well-versed in all phases of the software development lifecycle. He strongly believes in being agile and engineering culture. You can find him on <a href="https://goo.gl/aAEQy7">LinkedIn</a> and <a href="https://goo.gl/iQ1Qxs">GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=572b4dab329" width="1" height="1" alt=""><hr><p><a href="https://medium.com/applantic/5-reasons-why-you-should-learn-java-572b4dab329">5 reasons why you should learn Java</a> was originally published in <a href="https://medium.com/applantic">Applantic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to implement simple CQRS?— Part II]]></title>
            <link>https://medium.com/applantic/use-cqrs-part-ii-f2d2b112e3a9?source=rss-d5d41a2406c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2d2b112e3a9</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[cqrs]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Piotr Korlaga]]></dc:creator>
            <pubDate>Sun, 28 Jan 2018 14:10:53 GMT</pubDate>
            <atom:updated>2018-01-28T14:59:38.092Z</atom:updated>
            <content:encoded><![CDATA[<p>CQRS made as simple as possible</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FrAu44hsu1JSoPiUK0wmmg.jpeg" /></figure><p>As I promised a week ago I’m going to continue CQRS clarification. If you didn’t see the first part you definitely should. You can find it <a href="https://medium.com/applantic/applantic-what-is-cqrs-f32039d746bc"><strong>here</strong></a>.</p><p>In the previous post, I tried to explain what CQRS really is. Now I wanna go further and show you guys the code!</p><h3>The simplest implementation that you’ve ever seen</h3><pre>class Service {<br>    WriteModel writeModel = new WriteModel();<br>    <br>    public void <strong>command</strong>() {<br>        writeModel.setValue(100);<br>    }<br>    <br>    public ReadModel <strong>query</strong>() {<br>        return new ReadModel(writeModel);<br>    }<br>}</pre><p>Yes. That’s all. Yes. This is CQRS folks. But let me check…</p><p>We have C — Command. We have Q — Query. We have R — Responsibility and we have the last but not least S — Separation. That’s all. We achieve mythical CQRS pattern in just a few lines of code.</p><h3>Going deeper</h3><p>But let’s discuss something. In software design, things cannot be that simple, right? This is not the exception. The whole rumor about CQRS is created by the last letter — S.</p><h3>S — separation is the key</h3><p>What makes CQRS such a powerful technic is that we can manipulate separation level. At the first paragraph we separated the model but we also put everything in the same API. What’s worse we have everything at the same class and <strong>ReadModel</strong> is directly dependent on <strong>WriteModel</strong>. Separation is weak. We could change it a bit to look like this:</p><h4>Decoupling interfaces</h4><pre>class <strong>CommandService </strong>{<br>    WriteModel writeModel = new WriteModel();<br><br>    public void <strong>command</strong>() {<br>        writeModel.setValue(100);<br>    }<br>}</pre><pre>class <strong>QueryService </strong>{<br>    <br>    public ReadModel <strong>query</strong>() {<br>        return new ReadModel(new WriteModel());<br>    }<br>}</pre><p>In the example above we can separate the interfaces for <strong>Query</strong> and <strong>Command</strong>. And this is actually the part when CQRS is getting useful. Now, we have separated interfaces but still our read and write models are tightly coupled. So, what next?</p><p><strong>Decoupling models</strong></p><pre>class Database {<br>    private <strong>WriteModel</strong> writeModel = new WriteModel();<br>    private <strong>ReadModel</strong> readModel = new ReadModel();<br>    <br>    public WriteModel <strong>getWriteModel</strong>() {<br>        return writeModel;<br>    }<br>    <br>    public ReadModel <strong>getReadModel</strong>() {<br>        return readModel;<br>    }<br>}</pre><pre>class <strong>QueryService </strong>{<br>    private Database database;<br><br>    public ReadModel <strong>query</strong>() {<br>        return database.getReadModel();<br>    }<br>}</pre><pre>class <strong>CommandService </strong>{<br>    private Database database;<br><br>    public void <strong>command</strong>() {<br>        database.getWriteModel().setValue(100);<br>    }<br>}</pre><p>In the code above we have two independent models. A separate model for reading and another one for writing. Now <strong>Command </strong>and <strong>Query</strong> are independent APIs but the problem that comes with it is:</p><p>How <strong>Read Model </strong>will know that something changed in <strong>Write Model</strong>?</p><p><strong>Database </strong>class,<strong> </strong>which I created above, is only a mock of a real database. As you see we delegate model’s dependency to a database. In the world of relational databases <strong>WriteModel</strong> would be mapped to <strong>TABLE </strong>and <strong>ReadModel </strong>can be mapped to <strong>VIEW</strong>.</p><p>Furthermore the database view can be materialised and refreshed only when something had changed in <strong>WriteModel</strong>. And this is how we can simply achieve command and query separation.</p><h4>Decoupling datasources</h4><p>Is that all? Of course not. In the first part of this article, I also mentioned that the highest level of separation includes separation of datasources. But for now we still have one datasource and coupling on the database level. Actually database VIEW, even materialised, is nothing more than a snapshot of some aggregations and joins on WriteModel. But what’s the goal to decouple write and read sources?</p><p>In real life, we usually need a very advance search mechanism. Very often performing fetch operations on database is not sufficient. This is the place where we need search engine like <a href="https://www.elastic.co/products/elasticsearch"><strong>Elasticsearch</strong></a><strong>. </strong>But you know what?</p><p><strong>We are saved!</strong></p><p>Thanks to that we use CQRS approach from the very beginning and we decoupled our APIs and models to read and write parts. Now we can simply move our ReadModel to Elasticsearch cluster without too much effort. Let’s do that.</p><pre>class <strong>Database</strong> {<br>    private WriteModel writeModel = new WriteModel();<br><br>    public WriteModel getWriteModel() {<br>        return writeModel;<br>    }<br>}</pre><pre>class <strong>CommandService </strong>{<br>    private Database <strong>database</strong>;<br>    <br>    public void command() {<br>        <strong>database</strong>.getWriteModel().setValue(100);<br>    }<br>}</pre><pre>class <strong>Elasticsearch</strong> {<br>    private ReadModel readModel = new ReadModel();<br><br>    public ReadModel getReadModel() {<br>        return readModel;<br>    }<br>}</pre><pre>class QueryService {<br>    private Elasticsearch <strong>elasticsearch</strong>;<br><br>    public ReadModel query() {<br>        return <strong>elasticsearch</strong>.getReadModel();<br>    }<br>}</pre><p>And that’s it. Models didn’t change. Interfaces didn’t change. Unfortunately, once again we encounter the same basic problem:</p><p>How <strong>Read Model </strong>will know that something changed in <strong>Write Model</strong>?</p><p>The missing part is <strong>synchronization</strong>.<strong> </strong>Once we fully decouple our datasources we have to think more carefully about synchronization between them. In the previous example this was done by a database engine which takes care about data consistency. But this time everything is in our hands.</p><p>Unfortunately synchronization is the tricky part. I don’t want to cover any it’s strategies in this article but if you are interested I attached some useful resources:</p><ul><li><a href="https://www.elastic.co/blog/found-keeping-elasticsearch-in-sync">Keeping Elasticsearch in Sync</a></li><li><a href="https://qafoo.com/blog/086_how_to_synchronize_a_database_with_elastic_search.html">Qafoo GmbH - passion for software quality</a></li></ul><h3>To sum up</h3><p>If you want to migrate traditional application to CQRS you have to follow these steps:</p><ol><li>Create separate models for Read and Write</li><li>Decouple interfaces to Query and Command parts</li><li>Delegate coupling between models to database</li><li>Decouple datasources</li><li>Take care of synchronization between datasources</li></ol><p><a href="https://medium.com/_/subscribe/collection/applantic"><strong>Follow to not miss new articles!</strong></a><strong> 🚀</strong></p><p>Tap the 👏 button if you found this article useful!</p><p><strong>About us</strong></p><p><strong>Applantic </strong>is a team of passionate software developers. We write our stories on Medium ✍ but you can find us on <a href="https://goo.gl/cXV2W2">Instagram</a> 📷 or <a href="https://goo.gl/4SoE8Z">Facebook</a> ✍ as well.</p><p><strong>The author of this article is Piotr. </strong>He is a software engineer — well-versed in all phases of the software development lifecycle. He strongly believes in being agile and engineering culture. You can find him on <a href="https://goo.gl/aAEQy7">LinkedIn</a> and <a href="https://goo.gl/iQ1Qxs">GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2d2b112e3a9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/applantic/use-cqrs-part-ii-f2d2b112e3a9">How to implement simple CQRS?— Part II</a> was originally published in <a href="https://medium.com/applantic">Applantic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Don’t hack your model. Use CQRS! — Part I]]></title>
            <link>https://medium.com/applantic/applantic-what-is-cqrs-f32039d746bc?source=rss-d5d41a2406c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f32039d746bc</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[cqrs]]></category>
            <category><![CDATA[software-design-patterns]]></category>
            <category><![CDATA[programming-languages]]></category>
            <dc:creator><![CDATA[Piotr Korlaga]]></dc:creator>
            <pubDate>Sun, 21 Jan 2018 19:13:28 GMT</pubDate>
            <atom:updated>2018-01-29T13:34:30.801Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e4gaXFl_rAYd_B5zMnJCXg.jpeg" /></figure><h3>CQRS is (not?) that simple</h3><p>When I was trying to learn what the heck is CQRS, I found it very difficult. Authors of blog posts, and others in their explanations, are constantly mixing CQRS with different buzzwords. This makes things not easy for understanding. Oh well, at least for me.</p><h3>What really is CQRS?</h3><p>You can describe the entire idea of CQRS in just a single sentence.</p><p><strong>CQRS is separate model between write and read.</strong></p><p>In this blog post, we will talk about pure CQRS. No event sourcing, no message patterns, no eventual consistency anymore. All these buzzwords make things complex. Despite that, my goal is to keep CQRS sweet and simple.</p><h3>Let’s go deeper!</h3><h4>Traditional approach</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T6_nMt16YwuSTikiPoRR_A.png" /></figure><p>The traditional way of system design is creating one model which is being updated by UI events. We have one database schema and corresponding application model. The same model for reading and writing. Simple enough, and frankly speaking, this works well! But let’s try to do that in a slightly different way.</p><h4>CQRS to the rescue</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*STZ0GFFKWc8tVstbZ0BFEA.png" /></figure><p>Now we have two models instead of one common. First model perfectly matches writing purpose and the second one is designed to read data. In your application, you very often meet the situation when data is saved in some way but displaying in totally another. Being tied up to one model in an application is a big concern. Using CQRS simplifies things. Now you can structure your data models to your needs. No need to hack your common data model. Just use two! But that’s not the end…</p><h4>More than one read model</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ArrHoHQjTRcF6LdCNg17XQ.png" /></figure><p>It’s worth noticing that you can create multiple read model, not only one. Every one of them can have its own API that is isolated from the other. It helps us with keeping code architecture clear. And going further, we can have…</p><h4><strong>More than one data source</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BBSe-0dYLu-XUq9TnX7nFw.png" /></figure><p>Separation of data sources is the thing that really decouples the problem. But we all know the reality. Requirements are not clear and constantly changing. It’s hard to design correct database schema from the very beginning, and changes in that model are costly. Don’t try to do everything perfectly from the start. Use evolution way to carve your architecture. Start with simple CQRS with one data source and when you will feel comfortable with domain understanding you can cut database to smaller parts and even use polyglot persistence if you need.</p><h3>Enough with theory</h3><p>That’s all for today. You know CQRS and how simple it can be. You know how to separate read from write, how to create multiple read models and how CQRS lets you use polyglot persistence. But talk is cheap. Enough with theory. Let’s jump to the code.</p><p>I created a very simple project on our <a href="https://goo.gl/54wj1w">GitHub</a>. You can check it out right now or stay tuned and you will find my guide on this blog, next week. 🔜</p><p><a href="https://medium.com/_/subscribe/collection/applantic"><strong>Follow to not miss!</strong></a><strong> 🚀</strong></p><h3><strong>EDIT:</strong> <strong>Part 2 is available!</strong></h3><p><a href="https://medium.com/applantic/use-cqrs-part-ii-f2d2b112e3a9">How to implement simple CQRS?— Part II</a></p><p>Tap the 👏 button if you found this article useful!</p><p><strong>About us</strong></p><p><strong>Applantic </strong>is a team of passionated software developers. We write our stories on Medium ✍ but you can find us on <a href="https://goo.gl/cXV2W2">Instagram</a> 📷 or <a href="https://goo.gl/4SoE8Z">Facebook</a> ✍ &amp; 📷 as well.</p><p><strong>The author of this article is Piotr. </strong>He is a software engineer — well-versed in all phases of the software development lifecycle. He strongly believe in being agile and engineering culture. You can find him on <a href="https://goo.gl/aAEQy7">LinkedIn</a> and <a href="https://goo.gl/iQ1Qxs">GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f32039d746bc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/applantic/applantic-what-is-cqrs-f32039d746bc">Don’t hack your model. Use CQRS! — Part I</a> was originally published in <a href="https://medium.com/applantic">Applantic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>