<?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 Helena Franczak on Medium]]></title>
        <description><![CDATA[Stories by Helena Franczak on Medium]]></description>
        <link>https://medium.com/@helenafranczak?source=rss-1b0c74a742c6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*aAtcXpiaJMY3ny11.jpg</url>
            <title>Stories by Helena Franczak on Medium</title>
            <link>https://medium.com/@helenafranczak?source=rss-1b0c74a742c6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 01:21:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@helenafranczak/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[CoffeeMachine Exercise vol3. Circular Dependency]]></title>
            <link>https://medium.com/@helenafranczak/coffeemachine-exercise-vol3-circular-dependency-cf1f1d63a44c?source=rss-1b0c74a742c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf1f1d63a44c</guid>
            <category><![CDATA[circular-dependencies]]></category>
            <category><![CDATA[software-design]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <dc:creator><![CDATA[Helena Franczak]]></dc:creator>
            <pubDate>Tue, 29 Oct 2019 22:46:11 GMT</pubDate>
            <atom:updated>2019-10-29T22:46:11.782Z</atom:updated>
            <content:encoded><![CDATA[<p>This post is a part of a series about the virtual coffee machine exercise. For more context please have a look at the first post where I explain how to start with this exercise. In a nutshell: imagine a coffee machine and write a program that represents it. In my previous two posts I wrote about abstract and interface class and about dependency inversion and injection. In this post I will focus on circular dependency.</p><p>Ready? Let’s start!</p><p>The next step for my coffee machine program is to add an ability to refill ingredients. I need to implement a refill logic. To make it easier firstly I implemented it in the same project by creating a new class called Refiller, then I moved it to a separate project. Moving it to separate project will allow me to use test doubles and it will improve the program’s design. In the real world a Refiller would not be a part of a coffee machine. It will be a separate entity that the coffee machine talks to.</p><h3><strong>Circular Dependency</strong></h3><p>When I started refactoring code by moving the Reffiler to a new project, I came across a Circular Dependency. It is a relation between two or more modules(projects) which are directly or indirectly dependent on each other to function. In simple words it happens when A depends on B and B depends on A. This is an unwanted scenario and to solve that you can use an Interface or re-think about your design. In my example, the CoffeeMachine depends on the Refiller and the Refiller depends on Ingredients class which is a part of the CoffeeMachine program.</p><p>To solve that problem I used both: new design — moved Ingredients to a separate program and created a refiller interface — IRefiller. Just re-designing the program would solve the circular dependency in this case, however creating an IRefiller is a great idea from the design point of view because if the Refiller breaks and needs to be replaced it should not break the coffee machine. By having an Interface I will make sure that any refiller that implements the interface will work. This way my program will follow the Open Close Principle which says that software entities should be open for extension but closed for modification. The coffee machine application will be now open for new extensions that implement the IRefiller. We can now supply a different refiller without changing the coffee machine class.</p><p>Ok, great, now we have four programs and it’s dependencies as follows: CoffeeMachine depends on Ingredients and IRefiller. Refiller depends on IRefiller. IRefiller depends on Ingredients.</p><p>Because of the change in my project’s structure I had to make changes to the CoffeMachine class as well. That class has to know about the Refiler, it doesn’t have to know about Ingredients though ( the external ingredients , which can’t be confused with the machine’s internal ingredients used to create a beverage) because Refiller uses Ingredients and passes them on to the Machine. So now, the CoffeeMachine object has to have the Refiller as a parameter.</p><h3><strong>Sum up</strong></h3><p>The final version of my coffee machine program looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*okME21KA-ZT-um4aO36_FQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf1f1d63a44c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CoffeeMachine Exercise vol2. Dependency Injection and Inversion.]]></title>
            <link>https://medium.com/@helenafranczak/coffeemachine-exercise-vol2-dependency-injection-and-inversion-232f8b8e434?source=rss-1b0c74a742c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/232f8b8e434</guid>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[dependency-inversion]]></category>
            <dc:creator><![CDATA[Helena Franczak]]></dc:creator>
            <pubDate>Tue, 29 Oct 2019 22:45:16 GMT</pubDate>
            <atom:updated>2019-10-30T04:13:47.598Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*ndyYcudp67PKzERQjf4ksQ.png" /><figcaption>Image found on <a href="https://stackify.com/dependency-inversion-principle/">https://stackify.com/dependency-inversion-principle/</a></figcaption></figure><p>This post is a continuation of my previous post “Coding exercise: Virtual Coffee Machine . Abstract class vs interface.” I encourage you to read it to get more context on what is a virtual coffee machine. In a nutshell it is a coding exercise I did with my mentors at MYOB. The task is straightforward: imagine a real coffee machine and write a program that represents it. In the previous post I was sharing my findings on abstract and virtual classes, in this post I will talk about dependency injection and inversion. In the last post from this series I will talk about circular dependency.</p><h3><strong>Dependency Injection</strong></h3><p>It is a design pattern where one object supplies dependencies of another object. The “dependency” is an object that can be used. Look at the code below and notice how the class Recipe has in the constructor parameters another object called “Ingredients”</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ebb096651f59192f80db85f46157d55e/href">https://medium.com/media/ebb096651f59192f80db85f46157d55e/href</a></iframe><p>This is how the recipe class is used:</p><p>_recipe = new CappRecipe( new Ingredients(12, 0.3, 0.1, 1));</p><p>Below you can see the Ingredients constructor, so that the above numbers are not a mystery. Ingredients class is quite large, if you are curious about the complete code, please have a look at the GitHub repo.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b081257f8806d6f0b97c21447feb8b55/href">https://medium.com/media/b081257f8806d6f0b97c21447feb8b55/href</a></iframe><p>Benefits of using dependency injection:</p><ol><li>Helps with encapsulation. I have a CappMaker class that is responsible for making a cappuccino. It has injected a CappRecipe which is responsible for holding the recipe, it takes in Ingredients. The recipe is encapsulated in CappRecipe with the help of dependency injection — firstly, the Ingredients are injected to CappRecipe and then the CappRecipe to CappMaker.</li><li>Enables me to replace dependencies without changing the class to use them. It also reduces the risk that I will have to change a class just because one of its dependencies changed.</li><li>Loosely couples code. Helps to achieve a separation of concern, which can increase a readability.</li><li>Increases testability</li></ol><h3><strong>Dependency Inversion</strong></h3><p>The principle is as follows: High-level modules should be easily reusable and unaffected by changes in low-level modules which provide utility features. Based on that idea, the definition consists of two parts:</p><p>1. High-level modules should not depend on low-level modules. Both should depend on abstractions.<br>2. Abstractions should not depend on details. Details should depend on abstractions.</p><p>In the context of the coffee machine program, the dependency inversion happens when passing an interface as an object parameter. This allows to implement necessary contracts the high-level object needs to call.</p><p>In the coffee machine project I created an interface with two methods in it, to write and read:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e4555b4cc9213167e402676188849b7/href">https://medium.com/media/8e4555b4cc9213167e402676188849b7/href</a></iframe><p>Followed by a class that implements the above interface and allows to read and write form console.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/50d299ec1438e02282eb975e353cbce7/href">https://medium.com/media/50d299ec1438e02282eb975e353cbce7/href</a></iframe><p>The above is a the abstraction of the low-level module that can be implemented in the high-level module below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/11e33d8feaae5435597442720bfac4dd/href">https://medium.com/media/11e33d8feaae5435597442720bfac4dd/href</a></iframe><p>Now anytime I want my program to write or read from console I have to use _iOConsoleService.Write(“bla bla”) instead of Console.WriteLane(“bla bla)<br>_iOConsoleService.Read() instead of Console.ReadLine().</p><p>Benefits of using dependency injection</p><ol><li>It allows the program to adapt to changing rules. For example: if suddenly the requirement is to have all interactions with a user to be through SMS, we will not have to change the code everywhere.</li><li>It allows to write tests for interactions with the user as we can mock them using the interface: IOConsoleServices.</li><li>De-couples classes by preventing having a direct reference to each other.</li></ol><h3><strong>To sum up</strong></h3><p>Dependency injection is a code-level tactic. It relieves a class from too much code by allowing that code to be moved somewhere else and encapsulate it there.</p><p>Dependency inversion is an architectural strategy, it happens when we introduce and abstraction between classes and allow all other classes to use the abstraction.</p><p>I will close this post with a quote from this article: <a href="https://daedtech.com/dependency-injection-or-inversion/">https://daedtech.com/dependency-injection-or-inversion/</a></p><p>Dependency Injection == “Gimme it” and Dependency Inversion == “Someone take care of this for me, somehow.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=232f8b8e434" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding exercise: Virtual Coffee Machine . Abstract class vs interface.]]></title>
            <link>https://medium.com/@helenafranczak/coding-exercise-virtual-coffee-machine-abstract-class-vs-interface-24b6f6d8e386?source=rss-1b0c74a742c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/24b6f6d8e386</guid>
            <category><![CDATA[abstract-class]]></category>
            <category><![CDATA[interfaces]]></category>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <dc:creator><![CDATA[Helena Franczak]]></dc:creator>
            <pubDate>Fri, 25 Oct 2019 00:10:39 GMT</pubDate>
            <atom:updated>2019-10-25T00:10:39.334Z</atom:updated>
            <content:encoded><![CDATA[<h3>Coding exercise: Virtual Coffee Machine . Abstract class vs interface.</h3><p>During my journey in the Future Makers Academy at MYOB, my amazing mentors came up with a task to write a program that represents a virtual coffee machine. In this article I will share my journey and what I learned about interface and abstract class. In the next two articles I will talk about dependency inversion and injection, and circular dependency. I encourage you to program a coffee machine yourself and share in the comments below: GitHub repo and what you learned from coding along.</p><p>Ready? GO!</p><p>Imagine a coffee machine and what it does, what are the steps, what are the ingredients and end products. Write it down, or even better, draw it on a white board. Decide what could be a class, a method and how should the program interact with a user. Hint: all classes should be nouns, and all methods should be verbs..</p><p>It is best to start with a smaller “problem” so think in simple terms — assume your machine does only one thing: a coffee and it interacts with a user. Once you achieve that think how to add other beverages to it, how to make a menu, how to refill the machine, how to include steps to make a beverage, and so on.</p><h3><strong>Example Solution</strong></h3><p>Below I will describe how my mentors and I did that exercise and what I learned and found useful along the way. I suggest reading it to find inspiration on what else you could add to your program to experiment with concepts of inheritance and interface.</p><p>My mentors and I started with drawing the “coffee machine” on a white board</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4cmYtt6fLpZ_o09k" /></figure><p>Once the components of the project were defined, I tried to write a program, but it was too complex without a visual drawing, soon I got lost and entangled. The way out was to sketch out the design on a whiteboard. This is when everything started to make sense and I was “unstuck”.</p><p>Initially the coffee machine was simplified:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cB1yaF8HLxbznOom" /></figure><p>In the above drawing you can see one interface ( IBeverageMaker) and an abstract class (Beverage) that I plan to use.</p><p>Let me explain in more detail how those two are useful in my program and what the differences between both types are.</p><p>Let’s dive in…</p><h3><strong>Abstract Class</strong></h3><p>I want my beverages ( cappuccino, latte, etc ) to have the same message when a user doesn’t like the drink and a specific different message (per beverage) when the user is satisfied. To achieve this I used an abstract class called Beverage, and made my first coffee class: Capp to inherit the behaviour specified in the abstract class:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/82e19baf87d36be325611931f28beae2/href">https://medium.com/media/82e19baf87d36be325611931f28beae2/href</a></iframe><p>Capp class:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8c2d119ee70473073d388180963c00e/href">https://medium.com/media/a8c2d119ee70473073d388180963c00e/href</a></iframe><h3>Learnings:</h3><ol><li>An abstract class can have 3 types of methods:</li></ol><ul><li>Abstract methods may or may not contain implementation like the Drink() method above. Those methods have to be overwritten by every subclass.</li><li>Non abstract method, like Throw(), because it belongs to an abstract class it has a shared logic between all subclasses and it can’t be overwritten.</li><li>Virtual method, in that case it may or may not be overwritten.</li></ul><p>2. Abstract class can not be instantiated, it requires a subclass (Capp) to provide implementations for the abstract methods.</p><p>3. Each subclass can implement only one parent abstract class.</p><p>4. Generally it is a good habit to think twice before using an abstract class because you might find that every subclass is doing their own thing and there are no common ways of implementation (how).</p><h3>Interface</h3><p>In the above example the common logic was in the method Throw() which shows a message when a customer is unhappy. The “how” was specified in that method Throw( return “Yuck I dislike it!” ). This was the reason behind making it an abstract class. In a case where the only common thing is the “what” for all objects then it’s an indicator for using an interface. Have a look at the example.</p><p>Interface of IBeverageMaker:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6ba9ea4777c90738e5ad43f684e950ae/href">https://medium.com/media/6ba9ea4777c90738e5ad43f684e950ae/href</a></iframe><p>CappMaker Class that implements the IBeverageMaker Interface:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8463b0b84271c0dc89790bd9e9fa382/href">https://medium.com/media/e8463b0b84271c0dc89790bd9e9fa382/href</a></iframe><p>The above class has also dependency injection of a recipe abstract class that depends on Ingredients class(_recipe = new CappRecipe(new Ingredients(…))). I will talk about that in my next post.</p><h3><strong>Learnings</strong></h3><ol><li>Interface is a declaration of methods and properties, kind of like a contract for an object to implement, not the actual implementation. In the previous example the abstract class had both: the declaration and implementation.</li><li>Interface is a contract between the class and the outside world, it defines what kind of operation an object can perform.</li><li>You can use many interfaces on one class however they are not used for multiple inheritance. There is no code reusability here. All we do is to agree to a contract.</li><li>Interfaces are used for building loosely coupled, extensible and testable applications.</li><li>A hint on how to spot a need for Interface: look at the drawing and notice that you could say “CappMaker can make a Beverage”. The key word “can” is used to describe behaviours of that class, which indicates that it might be a good candidate for an interface.</li></ol><h3><strong>Sum up</strong></h3><p>This exercise is an excellent way to learn the basics of OOP, software design, and many other concepts. I hope that this article will give you a bit of an insight on how to learn from creating a program that represents a virtual coffee machine. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24b6f6d8e386" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Embracing Uncertainty]]></title>
            <link>https://medium.com/@helenafranczak/embracing-uncertainty-c5a05ce39ff9?source=rss-1b0c74a742c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5a05ce39ff9</guid>
            <category><![CDATA[uncertainity]]></category>
            <category><![CDATA[amor-fati]]></category>
            <category><![CDATA[embracing-change]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[memento-mori]]></category>
            <dc:creator><![CDATA[Helena Franczak]]></dc:creator>
            <pubDate>Fri, 14 Jun 2019 05:53:47 GMT</pubDate>
            <atom:updated>2019-06-14T05:53:47.697Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>“When I look back at the past and think of all the time I squandered in error and idleness, lacking the knowledge I needed to live; when I think of how I sinned against my heart and my soul, then my heart bleeds. Life is a gift, life is happiness … Every minute could have been an eternity of happiness! If youth only knew. Now my life will change, now I will be reborn.” ~Fyodor Dostoyevsky</blockquote><p>Sunday, 23 December 1849 Dostoyevski receives a death sentence. He has only a few minutes to process this information, the time to walk from the prison to the execution place. As he is walking, along with other prisoners, he notices that everything around him is brighter, more colourful, sharp in appearance. He sees detailed expressions in prisoner’s brave looks, behind which were terrified humans who were about to die. He is fully present staring death into its eyes. In that short time, he realized he shares the same faith with everyone and everything alive. That connection is death, the moment of no return, the moment that made him present like never before, he was truly alive for the first time. <strong>He connected with life because he was faced with the reality of death.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*u3F4GrtAq4uL_-uwk76yvg.png" /></figure><p>This paradoxical effect is well described in the literature and studies of human nature. But not only there, as it is experienced by each of us on different levels.</p><p>I can prove it.</p><p>Think about your daily train of thoughts. Notice that there is a tendency to circulate around the same thoughts every day. So much and so intensively that we tend to be attracted to this inner monologue of ours and even when we are talking with someone else we indulge in our looping thoughts. We dream away from the conversation and the current moment. This changes when we have to say goodbye to someone who is leaving for a long journey, maybe even they will never come back, and it is the last time we are seeing them. The sense of separation makes us very attentive, sometimes it feels as if a part of us is dying. In the “goodbye moment” we are very present, paying attention to the particular facial expressions, each and every word that person says, every gesticulation. We are not in our dreamland anymore just because we are facing the soon-to-come separation. <strong>We connect with the person because we are faced with the reality of losing her.</strong></p><p>The same logic applies to uncertainty and change. When we are faced with a change in our life we ultimately experience a loss as well. Loss of the previous state. This is a huge discomfort and fear for many. So big that some of us like to hold on to the illusion of stability and when something changes we turn into suffering, self-pity and blaming. As if we forgot that life is the opposite of stability and stillness, life is movement and connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*8tXELz9IDN3wGAnlOR6Auw.png" /></figure><p>What if we learn to accept and embrace all the pain that comes with a change. Affirm the movement and accept all its possibilities, accept your fate. Treat the unpleasant moments as opportunities to learn and get stronger. Each change, each pain that the change brings, will make us more bulletproof and yet ready for what is coming. How amazing it would be to walk around feeling empowered like that? It will make us possess something way more precious than money, career, fame or anything you can imagine: the ultimate approach to harsh moments in life. We need to stare the difficulties in its eye and treat the uncertainty as the most precious thing in life. Ironically, like Dostoyevski, was reborn after facing death (his death sentence was revoked in the last minute), we will be empowered after accepting our faith, the ugly and unwanted part of a change, the part we can’t influence or amend. We must not be afraid of it but embrace it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*u0M33S0MbsxORDQK_fNiqw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5a05ce39ff9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>