<?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 Monika Szumiec Kendi Coding on Medium]]></title>
        <description><![CDATA[Stories by Monika Szumiec Kendi Coding on Medium]]></description>
        <link>https://medium.com/@monikaszumiec?source=rss-83bdf2444acf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*kKltfN4SC-VtrREA.</url>
            <title>Stories by Monika Szumiec Kendi Coding on Medium</title>
            <link>https://medium.com/@monikaszumiec?source=rss-83bdf2444acf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 07:08:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@monikaszumiec/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[Learn design patterns with Kendi — part 3 behavioral patterns]]></title>
            <link>https://medium.com/@monikaszumiec/learn-design-patterns-with-kendi-part-3-behavioral-patterns-379f4a25d0bf?source=rss-83bdf2444acf------2</link>
            <guid isPermaLink="false">https://medium.com/p/379f4a25d0bf</guid>
            <category><![CDATA[mediator]]></category>
            <category><![CDATA[strategy]]></category>
            <category><![CDATA[behavioral-patterns]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[memento]]></category>
            <dc:creator><![CDATA[Monika Szumiec Kendi Coding]]></dc:creator>
            <pubDate>Tue, 12 Sep 2017 13:47:15 GMT</pubDate>
            <atom:updated>2017-09-12T13:47:15.821Z</atom:updated>
            <content:encoded><![CDATA[<p>In the last part of our tutorial we’ll describe behavioral patterns. If you missed the previous parts, we encourage you to read them as well. We’re continuing the case of on-line shop from the previous part:</p><p><a href="https://medium.com/@monikaszumiec/poznajemy-z-kendi-wzorce-projektowe-cz%C4%99%C5%9B%C4%87-2-wzorce-strukturalne-27534632cc2d">Lear design patterns with Kendi — part 2 structural patterns</a></p><p>This time we make a step forward and move on from the order to its delivery. Let’s consider some cases:</p><p>Case no. 1 — We have objects that depend on each other, but in spite of this, they should not know each other. If we change the value of one object, the value of another object should automatically change. How to provide these objects with communication and loose connection? The solution is to use the Mediator pattern.</p><p>Use case: The user created an order. At the same time a parcel was created. The parcel contains data based on the order — the same id and delivery mean. If the user edits the order and changes the delivery mean, the parcel should be updated automatically with that value. In turn this parcel knows its price and this price depends on various factors (delivery mean, weight, kilometers). The total amount of the order is the sum of the order itself and the delivery. Order and parcel are two separate abstractions so they shouldn’t know about each other, but they must communicate with each other to exchange information about the delivery means and price.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f61d1c63bc229bca25fdb17fbb2ba815/href">https://medium.com/media/f61d1c63bc229bca25fdb17fbb2ba815/href</a></iframe><p>Case no. 2 — Some object properties can be edited by the user. The user decides whether the changes are to be saved or canceled. If the user cancels the changes, the object needs to be restored to the previous values. In that case, the previous values ​​must be preserved. How to store these values? The solution is to use the Memento pattern.</p><p>Use case: The user may edit the payment and the delivery means and then may save or cancel changes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d3298706393f2c557ea284ecc628f963/href">https://medium.com/media/d3298706393f2c557ea284ecc628f963/href</a></iframe><p>Case no. 3 — Depending on the input conditions, we want to use different versions of the algorithm to get the same goal at the end. We want to avoid creation of one large method with multiple conditional statements. The solution is to use the Strategy template.</p><p>Use case: The user chose one of possible delivery means. The goal is to provide the user with the parcel. The goal will be acomplished after all the steps of the delivery algorithm are fulfilled. Depending on the delivery mean, a specific algorithm (strategy) is performed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/838f65a6a4c074c61a6bcebc05455212/href">https://medium.com/media/838f65a6a4c074c61a6bcebc05455212/href</a></iframe><p>To sum up:</p><ul><li>behavioral patterns encapsulate communication between objects (mediator), object state (memorial) or algorithm (strategy).</li><li>The mediator provides a loose connection of objects because objects communicate through the mediator rather than referring to each other. Cooperating objects are obliged to communicate with the mediator whenever a significant event occurs. The whole logic of communication is set in the mediator, which simplifies cooperating objects, but can cause the overgrowth of the mediator class.</li><li>The memento is passive and serves to encapsulate the state of the object (all or selected values). Only the memento source can create and modify it. Objects using mementos cannot manipulate them. Therefore, the memento has two interfaces, one for the source and the other for the using objects. The source uses the memento when to restore its former state.</li><li>There are other behavioral patterns not mentioned in this article: Interpreter, Iterator, Chain of Responsibility, Template Method, Observer, Visitor, Command and State.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=379f4a25d0bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lear design patterns with Kendi — part 2 structural patterns]]></title>
            <link>https://medium.com/@monikaszumiec/poznajemy-z-kendi-wzorce-projektowe-cz%C4%99%C5%9B%C4%87-2-wzorce-strukturalne-27534632cc2d?source=rss-83bdf2444acf------2</link>
            <guid isPermaLink="false">https://medium.com/p/27534632cc2d</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[structural-patterns]]></category>
            <category><![CDATA[decorators]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[adapter]]></category>
            <dc:creator><![CDATA[Monika Szumiec Kendi Coding]]></dc:creator>
            <pubDate>Tue, 05 Sep 2017 16:54:05 GMT</pubDate>
            <atom:updated>2017-09-08T08:37:30.624Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is a continuation of design patterns learning. This time we’ll explore the structural patterns. If you’ve missed the first part about the creational patterns, we encourage you to read this article as well:</p><p><a href="https://medium.com/@monikaszumiec/poznajemy-z-kendi-projektowe-wzorce-konstrukcyjne-cz%C4%99%C5%9B%C4%87-1-621e038acc0f">Lear design patterns with Kendi — part 1 creational patterns</a></p><p>As previously, we’re going to start from recognizing the problem and we’ll try to find a solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*WRjEDPjyaOFYH0IAEceMUg.png" /><figcaption>Kendi as a model ;-)</figcaption></figure><p>Case no. 1 — We’ve got a simple object. We want to dynamically add new states and tasks to it. How to achieve it without class overriding or class inheritance? The solution is the Decorator pattern.</p><p>Use case: Together with Kendi we set up an online shop, in which we sell clothes for pets. Our clients can design clothes for their pets. They choose the standard product and put some decorations on it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dbf5eff420b624a86a3682f31a60e39e/href">https://medium.com/media/dbf5eff420b624a86a3682f31a60e39e/href</a></iframe><p>Case no. 2 — We want to use existing class, but its interface doesn’t match to that one we need. How to achieve compatible interface without class overwriting? The solution is the Adapter pattern.</p><p>Use case: The user made and save a design of cloth for its pet. Struct Design contains a lot of information needed to order, but it doesn’t contains the whole needed information.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/410be33fbd1cfc1e97bea2de2ed549fd/href">https://medium.com/media/410be33fbd1cfc1e97bea2de2ed549fd/href</a></iframe><p>Case no. 3 — We want to make proxy, that will pretend the real object till the time the real object is really needed. The solution is the Proxy pattern.</p><p>Use case: We want to optimize loading of the order’s preview. At the entrance, the user sees the order details such as the order id and the list of ordered products (the item in the list contains only the type and size). All details of the ordered product are available after transition to its preview. We don’t want to load the real products and related operations (such as creating a photo from product url) on the order entry.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/17f4e26acdfc87edec124529abaa139b/href">https://medium.com/media/17f4e26acdfc87edec124529abaa139b/href</a></iframe><p>To sum up:</p><ul><li>the structural patterns compose classes and objects into the larger structures.</li><li>The Decorator is the object wrapper. Using this pattern let you avoid class overloading with all possible tasks that the object might do. According to the principle “pay only for that what you use” the decorator adds the concrete task to the object in the right time. The disadvantage of the decorator pattern is creating many small objects, that differ only connection, not class or variables, which make the diagnostic harder.</li><li>Adapter allows you to perform tasks that are not supported by the custom class. This allows classes with incompatible interfaces to work together. There are two types of adapters: class and object. Class adapters cannot adapt subclasses of an adapted class, while an object adapter will work for a subclasses.</li><li>The proxy replaces the real object until we really need it. There are remote, virtual, and security proxies. The remote proxy passes encoded requests to real objects in another address space. A virtual proxy can store additional information about the real object. The security proxy checks if the sender of the request has access to it.</li><li>There are other structural patterns not mentioned in this article: Facade, Composite, Bridge and Flyweight.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27534632cc2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lear design patterns with Kendi — part 1 creational patterns]]></title>
            <link>https://medium.com/@monikaszumiec/poznajemy-z-kendi-projektowe-wzorce-konstrukcyjne-cz%C4%99%C5%9B%C4%87-1-621e038acc0f?source=rss-83bdf2444acf------2</link>
            <guid isPermaLink="false">https://medium.com/p/621e038acc0f</guid>
            <category><![CDATA[prototype]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[builders]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[factory-method]]></category>
            <dc:creator><![CDATA[Monika Szumiec Kendi Coding]]></dc:creator>
            <pubDate>Sat, 02 Sep 2017 15:51:20 GMT</pubDate>
            <atom:updated>2017-09-07T16:37:06.138Z</atom:updated>
            <content:encoded><![CDATA[<p>Each junior developer that wants to became the senior developer, obligatory learns from “Design Patterns”, classic by Erich Gamma, Richard Helm, Ralph Johnson i John Vlissides. I have to addmit that my beginning with “Design Patterns” wasn’t easy — after all it’s a big guide full of abstraction and such abstact way of thinking you have to develop. Fortunately, I have a companion in this painful process, my loyal black Labrador Kendi, that wakes me barking every time I start to fall asleep. I belive that “practice makes master” and that you should always put the abstraction in your own words to really understand it. And because it is worth sharing with others — together with Kendi we’ll share our knowledge about patterns. So who willing, let read…</p><p>To start with — what is the pattern all about? It always start with the problem and one must solve it. Someone finds optimized solution, that can be used in such case. So if you know the pattern, you don’t have to invent it yourself. Thus it is crucial to properly identify the type of problem. Therefore, we’re going to disscuss each pattern starting with the case analysis.</p><p>Case no. 1 — we want to build comlex objects of different types. These objects are a result of one manufacturing process. How to build these objects without duplicating the code? The solution is to use the Builder pattern, where the complex object creation algorithm is independent of the components of that object and the way the components are joined, and the construction process enables the creation of objects of different types.</p><p>Use case: If I was a Director of Dog House Production (what a job!), I would hired a chief builder to create a dog house project. In turn, this builder would heired other builders that would done this project and as a result built different types of dog houses (a small one for the basset but big for the Labrador).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1a36793f5dbf12bdb1f45e1706a62564/href">https://medium.com/media/1a36793f5dbf12bdb1f45e1706a62564/href</a></iframe><p>Case no. 2— we want to be able to add and remove products at run time. we want to avoid creating hierarchy of factory classes corresponding to product class hierarchy. The solution is to use the Prototype pattern.</p><p>Use case: We find that dog house production doesn’t pay off. Instead, we buy ready-made dog houses. When ordering, the client gives us the preferences, such as “Paint it for that color” or “Add this title in the front”. We dynamically create a new product by combining the prototype clone with the client’s preferences.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2e57e97aa2d93584839336d8cc38ea72/href">https://medium.com/media/2e57e97aa2d93584839336d8cc38ea72/href</a></iframe><p>To sum up:</p><ul><li>the creational patterns help maintain system independence from the way of object creating, composing and representing. They encapsulate information of which specific classes the system uses and hides the process of creating and composing objects.</li><li>The best control over the creation process of complex object provides the Builder pattern. It generates the product step by step and only after the process is finished the Director takes the product from the Builder. The other patterns create the object in one step.</li><li>The Factory Method is a popular object constructor, especialy useful when one class wants to delegate a task to some other auxiliary class class.</li><li>The disadvantage of the Factory Method is the creation of a parallel hierarchy of classes (product classes = constructor classes). Thus, it is sometimes better to use a Prototype pattern that, contrary to the Factory Method, reduces the number of classes by cloning objects instead of creating new ones. In addition, the Prototype pattern is the only one that provides the ability of adding and removing products at run time.</li><li>There are other design patterns not mentioned in this article: Abstract Factory and Singleton.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JWEOWedCKUlGL1qkPBZVbQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i2PCNrjUSX30NSIAXIZzSA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_uIl3hK08m9l5eE8LDj3LQ.jpeg" /><figcaption>code design by Monika, code review by Kendi ;-)</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=621e038acc0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>