<?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 Luca Pelosi on Medium]]></title>
        <description><![CDATA[Stories by Luca Pelosi on Medium]]></description>
        <link>https://medium.com/@lucapelosi?source=rss-1882bf3cf377------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xl3BOl7r3ODLTN25N0LcHQ.jpeg</url>
            <title>Stories by Luca Pelosi on Medium</title>
            <link>https://medium.com/@lucapelosi?source=rss-1882bf3cf377------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 00:41:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lucapelosi/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[What is Wealth?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@lucapelosi/what-is-wealth-75998ede19ab?source=rss-1882bf3cf377------2"><img src="https://cdn-images-1.medium.com/max/718/0*jbJxr50CyrBUclJG.jpg" width="718"></a></p><p class="medium-feed-snippet">You think you know the answer but maybe you don&#x2019;t understand the question</p><p class="medium-feed-link"><a href="https://medium.com/@lucapelosi/what-is-wealth-75998ede19ab?source=rss-1882bf3cf377------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@lucapelosi/what-is-wealth-75998ede19ab?source=rss-1882bf3cf377------2</link>
            <guid isPermaLink="false">https://medium.com/p/75998ede19ab</guid>
            <category><![CDATA[rich]]></category>
            <category><![CDATA[wealth]]></category>
            <category><![CDATA[financial-freedom]]></category>
            <category><![CDATA[freedom]]></category>
            <category><![CDATA[poor]]></category>
            <dc:creator><![CDATA[Luca Pelosi]]></dc:creator>
            <pubDate>Mon, 06 May 2024 08:02:02 GMT</pubDate>
            <atom:updated>2024-05-09T08:27:40.180Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[The Cognitive Illusion of Overconfidence]]></title>
            <link>https://medium.com/@lucapelosi/the-cognitive-illusion-of-overconfidence-2ff2c625f064?source=rss-1882bf3cf377------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ff2c625f064</guid>
            <category><![CDATA[cognitive-bias]]></category>
            <category><![CDATA[professional-development]]></category>
            <category><![CDATA[dunning-kruger-effect]]></category>
            <category><![CDATA[self-awareness]]></category>
            <category><![CDATA[continuous-improvement]]></category>
            <dc:creator><![CDATA[Luca Pelosi]]></dc:creator>
            <pubDate>Mon, 05 Feb 2024 09:01:44 GMT</pubDate>
            <atom:updated>2024-02-05T09:01:44.876Z</atom:updated>
            <content:encoded><![CDATA[<h4>How the Dunning-Kruger effect changes your career</h4><p>In the vast landscape of human cognition, the interplay between self-awareness and competence often follows a delicate dance. Yet, nestled within this intricate choreography lies a fascinating and often perplexing phenomenon known as the Dunning-Kruger effect. Coined by psychologists David Dunning and Justin Kruger in 1999, this cognitive bias sheds light on the peculiar tendency of individuals to overestimate their own abilities while simultaneously underestimating the competence of others.</p><p>As we navigate the realms of knowledge and expertise, the Dunning-Kruger effect emerges as a compelling lens through which to examine the quirks and foibles of the human mind. This article delves into the roots, manifestations, and implications of the Dunning-Kruger effect, unraveling the layers of this cognitive illusion that can profoundly impact decision-making, interpersonal dynamics, and societal structures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cPYQ6ZtL0g9eZXW0" /><figcaption>Photo by <a href="https://unsplash.com/@robbie36?utm_source=medium&amp;utm_medium=referral">Robert Collins</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Visualise the Dunning-Kruger effect</h3><p>The Dunning-Kruger effect can be visualized through a simple diagram that illustrates the relationship between one’s perceived competence and actual competence. The typical diagram consists of a graph with two axes: one representing self-assessed competence and the other representing actual competence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zMYc4gLIjYGenVll.png" /><figcaption>Source: <a href="https://story.fund/">https://story.fund/</a></figcaption></figure><h4>Curve or slope</h4><p>You might notice a curve or slope, illustrating the general trend observed in the Dunning-Kruger effect. As competence increases, confidence tends to rise, but only up to a certain point. Beyond that point, confidence may plateau or even decrease as individuals gain a deeper understanding of the complexity of the subject matter.</p><h4>Peak of Overconfidence</h4><blockquote>Have you ever met any youngster who thinks he has everything about life figured out?</blockquote><p>The diagram may highlight a peak point, representing the apex of overconfidence. This is where individuals with low competence often exhibit the highest level of unwarranted confidence before a more accurate self-assessment begins to emerge.</p><h3>Tips for Junior People</h3><p>For a young person at the outset of their career who is aware of the Dunning-Kruger effect, navigating the delicate balance between confidence and competence becomes crucial. Here are some key behaviors to adopt:</p><ul><li>Cultivate Humility</li><li>Seek Feedback Actively</li><li>Continuous Learning</li><li>Set Realistic Goals</li><li>Embrace Mistakes as Learning Opportunities</li><li>Build a Professional Network</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Vz8vM_YkmbXmYiB8" /><figcaption>Photo by <a href="https://unsplash.com/@elliot_drew?utm_source=medium&amp;utm_medium=referral">Jesús Rodríguez</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Tips for Senior People</h3><p>The Dunning-Kruger phenomenon comes to light mainly in the advanced phase of our career, as we notice a contradictory phenomenon: after so many years of work we seem to know less than before!</p><blockquote>This feeling often also leads to suffering from the so-called “Impostor Syndrome”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pAUvTwb1XUcSuYHR" /><figcaption>Photo by <a href="https://unsplash.com/@punttim?utm_source=medium&amp;utm_medium=referral">Tim Gouw</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>For a senior person at an advanced stage of their career who is aware of this effect, maintaining a healthy and effective professional demeanor involves a nuanced approach. Here are some key behaviors for a senior professional to consider:</p><ol><li>Cultivate a Growth Mindset: we never stop learning</li><li>Encourage Mentorship and Collaboration</li><li>Acknowledge Limits of Expertise</li><li>Encourage Constructive Criticism: always give and ask feedbacks</li><li>Remain Adaptable</li></ol><blockquote>It’s about maintaining a balance between confidence and humility, fostering a culture of continuous improvement</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zMJS_Haz-TqM_jS1" /><figcaption>Photo by <a href="https://unsplash.com/@huntersrace?utm_source=medium&amp;utm_medium=referral">Hunters Race</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Tips for Everyone</h3><p>I wrote a series of short articles in which I have collected advice, philosophies of life and virtuous attitudes that, if followed throughout your life, will surely be able to improve it and put you in a position to fully enjoy it, maximizing “<strong>success</strong>”. Whatever it means to you.</p><blockquote>You can read all the tips of this series on my “<a href="https://medium.com/@lucapelosi/list/personal-growth-7c846d55bf4f">Personal Growth</a>” list whenever you want.</blockquote><p><em>If you would </em><strong><em>start earning on Medium</em></strong><em> and want to support my work, become a </em><strong><em>Medium Member</em></strong><em> via my </em><a href="https://medium.com/@lucapelosi/membership"><em>referral link</em></a><em>, gaining </em><strong><em>unlimited access to every story</em></strong><em> on Medium without paying any additional fees:</em></p><blockquote><a href="https://medium.com/@lucapelosi/membership">https://medium.com/@lucapelosi/membership</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ff2c625f064" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 7 Best Tips for Personal Growth]]></title>
            <link>https://medium.com/@lucapelosi/the-7-best-tips-for-personal-growth-301f10721737?source=rss-1882bf3cf377------2</link>
            <guid isPermaLink="false">https://medium.com/p/301f10721737</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[life-skills]]></category>
            <category><![CDATA[change]]></category>
            <category><![CDATA[growth-mindset]]></category>
            <category><![CDATA[personal-development]]></category>
            <dc:creator><![CDATA[Luca Pelosi]]></dc:creator>
            <pubDate>Mon, 29 Jan 2024 09:01:50 GMT</pubDate>
            <atom:updated>2024-01-29T09:01:50.995Z</atom:updated>
            <content:encoded><![CDATA[<h4>PERSONAL GROWTH</h4><h4>Take life the right way and be successful</h4><p>Embarking on a journey of personal growth is akin to cultivating a garden; it requires patience, dedication, and a thoughtful approach. As we navigate the complexities of life, the pursuit of self-improvement becomes an integral part of our quest for fulfillment and success. Whether you’re seeking to enhance your professional skills, foster meaningful relationships, or simply become the best version of yourself, the path to personal growth is both rewarding and transformative.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CbmL0QmMArz0vE3c" /><figcaption>Photo by <a href="https://unsplash.com/@igcorreia?utm_source=medium&amp;utm_medium=referral">Ignacio Correia</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I wrote a series of short articles in which I have collected advice, philosophies of life and virtuous attitudes that, if followed throughout your life, will surely be able to improve it and put you in a position to fully enjoy it, maximizing “<strong>success</strong>”. Whatever it means to you.</p><blockquote><em>You can read all the tips of this series on my “</em><a href="https://medium.com/@lucapelosi/list/personal-growth-7c846d55bf4f"><em>Personal Growth</em></a><em>” list whenever you want.</em></blockquote><p>In this article, I want to summarize all these 7 tips that will make your life better, fuller and worth living. If you are interested, you can learn more about them by reading the dedicated article.</p><h4>1. “Find Time to Pause Your Worries”</h4><p>Addressing sentimental, work-related, or financial challenges may consume your thoughts regularly. However, it’s crucial to recognize that preserving your mental health should always be a top priority. Even in the face of significant losses, long-term happiness should not be compromised.</p><blockquote>Delve deeper into this concept, read about the metaphor of the glass of water, <a href="https://medium.com/@lucapelosi/tips-for-personal-growth-day-1-c8a836fc4c52">here is a dedicated article</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*maySWIueqGzz7hUP.jpeg" /><figcaption>Manki Kim on Unsplash</figcaption></figure><h4>2. “Be Persevering”</h4><p>Perseverance is probably the only superpower that we can all harness to achieve what was initially unthinkable.<br>However, putting it into practice is not easy and it is not free, but discovering which doors it can open for you can be the best reward.</p><p>By staying resilient and determined, one can overcome obstacles, achieve long-term goals, and build a foundation of experience and wisdom. Perseverance fosters growth, resilience, and eventual success in various aspects of life.</p><blockquote>If you want to know how to achieve this, <a href="https://medium.com/@lucapelosi/tips-for-personal-growth-day-2-c0f67bd8a931">here is a dedicated article</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*ol6UwsoaN8MaX_vM.jpeg" /><figcaption>Petr Slováček on Unsplash</figcaption></figure><h4><strong>3. “Manage your Time”</strong></h4><p>Effective time management enhances productivity, reduces stress, and fosters a sense of control over one’s life. By prioritizing tasks and allocating time wisely, individuals can achieve goals efficiently, leading to a better work-life balance. It instills discipline, minimizes procrastination, and allows for more meaningful engagement in activities. Proper time management enables individuals to identify and focus on high-priority tasks, leading to increased efficiency and effectiveness. Moreover, it creates opportunities for personal growth, relaxation, and pursuing hobbies, fostering overall well-being and satisfaction. In essence, mastering time management is key to unlocking a more fulfilling and balanced life.</p><blockquote>If you want to know how to achieve this, <a href="https://medium.com/@lucapelosi/tips-for-personal-growth-day-3-724dfaad0496">here is a dedicated article</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*lVWGqiiaP9gs68yo.jpeg" /><figcaption>Robson Hatsukami Morgan on Unsplash</figcaption></figure><h4><strong>4. “Learn Constantly”</strong></h4><p>Embracing a mindset of constant learning enriches lives by fostering adaptability, expanding knowledge, and stimulating personal growth. It opens doors to new opportunities, enhances problem-solving skills, and keeps individuals at the forefront of innovation. Continuous learning cultivates a curious and agile mind, allowing individuals to thrive in dynamic environments. It is a lifelong journey that not only deepens expertise but also brings fulfillment and a sense of accomplishment as one evolves and stays relevant in an ever-changing world.</p><blockquote>If you want to know how to achieve this, <a href="https://medium.com/@lucapelosi/tips-for-a-personal-growth-day-4-333850edda34">here is a dedicated article</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*pt_xLZefazrcY6X_.jpeg" /><figcaption>Milad Fakurian on Unsplash</figcaption></figure><h4><strong>5. “Improve your Decision Making”</strong></h4><p>Improving decision-making skills empowers individuals to navigate life with clarity and confidence. By honing this ability, one can assess situations more effectively, weigh options with greater precision, and make informed choices. Enhanced decision-making contributes to better outcomes, minimizes regrets, and builds a foundation for success. It instills a sense of control, reduces stress, and fosters a proactive approach to challenges. Ultimately, the skill of making sound decisions is integral to personal and professional growth, leading to a more fulfilling and satisfying life.</p><blockquote>If you want to know how to achieve this, <a href="https://medium.com/@lucapelosi/tips-for-a-personal-growth-day-5-f65b574970dd">here is a dedicated article</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*Sjx96BS4ayfZ7DyM.jpeg" /><figcaption>Jens Lelie on Unsplash</figcaption></figure><h4>6. “Pursue a Dream”</h4><p>Pursuing a dream infuses life with purpose, passion, and intrinsic motivation. It fuels personal growth, encouraging individuals to step beyond comfort zones and overcome obstacles. The journey towards a dream instills resilience, determination, and a sense of achievement. It fosters a fulfilling and meaningful existence, as the pursuit itself becomes a source of joy. Pursuing dreams not only shapes individual identity but also contributes positively to the world, inspiring others and creating a lasting impact on one’s life and the community.</p><blockquote>If you want to know how to achieve this, <a href="https://medium.com/@lucapelosi/tips-for-a-personal-growth-day-6-62bec4407559">here is a dedicated article</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*sQMg6VdHO84rgc0D.jpeg" /><figcaption>Benjamin Davies on Unsplash</figcaption></figure><h4>7. “Look for the more Enterprising Version of Yourself”</h4><p>Seeking the more enterprising version of oneself cultivates a mindset of continuous improvement and innovation. It propels individuals towards setting and achieving ambitious goals, unlocking untapped potential, and embracing new opportunities. This approach fosters adaptability, resilience, and a proactive attitude in the face of challenges. Striving for an enterprising self sparks personal and professional growth, leading to a more dynamic, fulfilling life while positively impacting relationships, career, and overall well-being.</p><blockquote>If you want to know how to achieve this, <a href="https://medium.com/@lucapelosi/tips-for-personal-growth-day-7-6fdfa6fe478d">here is a dedicated article</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*5pG5L0VVx7MVD5RE" /><figcaption>Photo by Diego PH on Unsplash</figcaption></figure><h3>Conclusions</h3><p>I hope this short article has given you food for thought.</p><p>If you are interested in personal growth, I recommend to <strong>follow me</strong> and <strong>subscribe to my email</strong> to read more articles like this.</p><p><em>If you would </em><strong><em>start earning on Medium</em></strong><em> and want to support my work, become a </em><strong><em>Medium Member</em></strong><em> via my </em><a href="https://medium.com/@lucapelosi/membership"><em>referral link</em></a><em>, gaining </em><strong><em>unlimited access to every story</em></strong><em> on Medium without paying any additional fees:</em></p><blockquote><a href="https://medium.com/@lucapelosi/membership">https://medium.com/@lucapelosi/membership</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*4wiJA61TKpv8g-rW.jpeg" /><figcaption>Ben White on Unsplash</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=301f10721737" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tips for Personal Growth: Day 7]]></title>
            <link>https://medium.com/@lucapelosi/tips-for-personal-growth-day-7-6fdfa6fe478d?source=rss-1882bf3cf377------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fdfa6fe478d</guid>
            <category><![CDATA[mindset]]></category>
            <category><![CDATA[comfort-zone]]></category>
            <category><![CDATA[habits-for-success]]></category>
            <category><![CDATA[personal-growth]]></category>
            <category><![CDATA[self-discovery]]></category>
            <dc:creator><![CDATA[Luca Pelosi]]></dc:creator>
            <pubDate>Sun, 21 Jan 2024 10:02:58 GMT</pubDate>
            <atom:updated>2024-01-21T10:02:58.120Z</atom:updated>
            <content:encoded><![CDATA[<h4>Daily tips to take life the right way and be successful</h4><p>This is a series of short articles in which I have collected advice, philosophies of life and virtuous attitudes that, if followed throughout your life, will surely be able to improve it and put you in a position to fully enjoy it, maximizing “<strong>success</strong>”. Whatever it means to you.</p><blockquote>You can read the others tips of this series on my “<a href="https://medium.com/@lucapelosi/list/personal-growth-7c846d55bf4f">Personal Growth</a>” whenever you want.</blockquote><h3>“Look for the more Enterprising Version of Yourself”</h3><p>In the fast-paced landscape of today’s world, personal and professional growth have become indispensable pursuits. As individuals strive to navigate the complexities of life and work, embracing an enterprising mindset emerges as a key factor in unlocking hidden potentials and achieving unparalleled success. This journey toward self-discovery and empowerment requires a conscious effort to cultivate the enterprising version of oneself — a version characterized by innovation, resilience, and a proactive approach to life’s challenges. In this article, we explore the significance of adopting an enterprising mindset, and how cultivating this aspect of your personality can lead to transformative changes in both your personal and professional spheres. Join us on a journey of self-exploration as we delve into the principles and practices that can help you uncover the more enterprising version of yourself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5pG5L0VVx7MVD5RE" /><figcaption>Photo by Diego PH on Unsplash</figcaption></figure><h3>Would I be able to be?</h3><p>The belief that one doesn’t deserve more often stems from a complex interplay of self-doubt, fear of failure, and societal expectations. Many individuals find themselves grappling with the notion that their capabilities and worth fall short of deserving greater opportunities or accomplishments. This mindset is frequently reinforced by internalized criticism, comparison with others, or past experiences that may have dented confidence. The fear of not being able to meet the expectations associated with seeking more can become a formidable barrier. It’s crucial to recognize that this belief is not a reflection of actual capabilities but rather a manifestation of limiting beliefs that can hinder personal and professional growth. Overcoming this mental hurdle involves challenging these ingrained perceptions and embracing the understanding that everyone deserves the chance to explore their full potential without self-imposed limitations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W88IvY_tJr3jyyl6" /><figcaption>Photo by <a href="https://unsplash.com/@justinveenema?utm_source=medium&amp;utm_medium=referral">Justin Veenema</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Discover what is hidden inside you</h3><p>Discovering your hidden abilities is an empowering journey that involves unraveling the unique tapestry of talents and interests woven into the fabric of your being. Each individual possesses innate abilities, some more apparent than others, waiting to be uncovered and honed. Delving into these hidden potentials doesn’t necessitate a quest beyond one’s capacity; rather, it’s an exploration of what already exists within. These latent talents might be passions or skills that, once recognized, have the potential to elevate you to an expert level compared to the majority. It’s not about aspiring to be more than you can handle; instead, it’s an invitation to authentically embrace and express the extraordinary qualities that nature has bestowed upon you. Discovering and nurturing these unique aspects of yourself not only fosters personal fulfillment but also contributes to a richer, more vibrant collective tapestry of human capabilities.</p><h3>It starts tomorrow morning</h3><p>Embarking on the journey to develop the more enterprising and entrepreneurial facets of yourself is a transformative process that requires a deliberate commitment to stepping outside your comfort zone. Begin by incorporating small, daily habits that challenge the status quo and foster a mindset of innovation and proactivity. For instance, make it a habit to set aside time each day for <a href="https://medium.com/@lucapelosi/tips-for-a-personal-growth-day-4-333850edda34">learning something new</a>, whether it’s a skill related to your profession or a completely unrelated field. Engaging in continuous education expands your knowledge base and nurtures a versatile mindset crucial for entrepreneurial thinking. Additionally, challenge yourself to initiate conversations with people you don’t know well, fostering networking skills and broadening your social connections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VVg3f8ey3fYUbY0g" /><figcaption>Photo by <a href="https://unsplash.com/@limamauro23?utm_source=medium&amp;utm_medium=referral">Mauro Lima</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Another effective habit is to set and pursue achievable but ambitious goals regularly. Break down larger objectives into smaller, actionable steps, creating a roadmap that guides you toward success. This not only cultivates a sense of accomplishment but also instills the discipline and resilience essential for entrepreneurial endeavors. Embrace failure as a natural part of the learning process, viewing setbacks as opportunities to refine your approach and grow.</p><p>Furthermore, take calculated risks in <a href="https://medium.com/@lucapelosi/tips-for-a-personal-growth-day-5-f65b574970dd">your decision-making</a>, whether it’s proposing a new idea at work or starting a small side project. The willingness to venture beyond the familiar builds confidence and resilience, crucial qualities in the entrepreneurial world. By consistently integrating these habits into your daily routine, you gradually cultivate the enterprising version of yourself, setting the stage for sustained personal and professional growth. Remember, it’s the cumulative effect of these daily choices that propel you toward a more entrepreneurial and enterprising future.</p><h3>Conclusions</h3><p>I hope this short article has given you food for thought.</p><p>If you are interested in personal growth, I recommend to <strong>follow me</strong> and <strong>subscribe to my email</strong> to read more articles like this (<a href="https://medium.com/@lucapelosi/list/personal-growth-7c846d55bf4f">here you’ll find my “Daily Tips” series</a>).</p><p><em>If you would </em><strong><em>start earning on Medium</em></strong><em> and want to support my work, become a </em><strong><em>Medium Member</em></strong><em> via my </em><a href="https://medium.com/@lucapelosi/membership"><em>referral link</em></a><em>, gaining </em><strong><em>unlimited access to every story</em></strong><em> on Medium without paying any additional fees:</em></p><blockquote><a href="https://medium.com/@lucapelosi/membership"><em>https://medium.com/@lucapelosi/membership</em></a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*4wiJA61TKpv8g-rW.jpeg" /><figcaption>Ben White on Unsplash</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fdfa6fe478d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Essential Design Patterns: Decorator]]></title>
            <link>https://medium.com/@lucapelosi/essential-design-patterns-decorator-20be2ecf5f54?source=rss-1882bf3cf377------2</link>
            <guid isPermaLink="false">https://medium.com/p/20be2ecf5f54</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[object-oriented]]></category>
            <category><![CDATA[software-design]]></category>
            <category><![CDATA[decorator-pattern]]></category>
            <dc:creator><![CDATA[Luca Pelosi]]></dc:creator>
            <pubDate>Sat, 20 Jan 2024 10:01:55 GMT</pubDate>
            <atom:updated>2024-01-21T09:10:35.425Z</atom:updated>
            <content:encoded><![CDATA[<h4>SOFTWARE ENGINEER LEARNING PATH</h4><h4>Structural Pattern: learn why and how to implement it.</h4><p>A “<strong>Design Pattern</strong>” is a well-established technique to resolve a real-world problem and you can apply it only if specific terms and conditions are met. Many times, a design pattern arises from a more generic “<strong>Design Principle”</strong>.</p><p>If you are interested in understanding more about Software Architecture or learning other Design Patterns and many more, you can take a look at my list of “<a href="https://medium.com/@lucapelosi/list/technology-software-engineering-415ea9113386"><em>Technology &amp; Software Engineering</em></a>”.</p><p>If you’re interested in learning the basics of <strong>Software Architecture</strong> first, you might be interested in a series of articles that put you on your way to becoming a good <strong>Software Architect</strong>: <a href="https://medium.com/@lucapelosi/clean-architecture-in-a-nutshell-bc361926c7b7"><em>The “Clean Architecture” book in a nutshell</em></a><em>.</em></p><blockquote><em>To have unlimited access to every story on Medium, become a </em><strong><em>Member</em></strong><em> and </em><strong><em>support my work</em></strong><em> use this link</em><strong><em> </em></strong><a href="https://medium.com/@lucapelosi/membership"><em>https://medium.com/@lucapelosi/membership</em></a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8iniSupokz2-1ULP" /><figcaption>Photo by Julia Kadel on Unsplash</figcaption></figure><h3>Why do we need a “Decorator”</h3><p>In the dynamic realm of software development, crafting flexible, extensible, and maintainable code is a perpetual pursuit. As applications evolve and requirements undergo constant changes, developers seek design principles that empower them to adapt with grace. Enter the <strong>Decorator</strong> design pattern — a versatile and elegant solution that enhances the modularity of code, promotes reusability, and fosters a dynamic approach to extending functionality.</p><p>The <strong>Decorator</strong> pattern is a structural design pattern that allows behavior to be added to an individual object, either statically or dynamically, without affecting the behavior of other objects from the same class.</p><p>We will delve into the essence of the Decorator pattern by examining its core concepts, design considerations, and real-world scenarios where it shines. From its origins in the Gang of Four’s classic design patterns book to its contemporary applications in modern software development, we will showcase its enduring relevance.</p><h3>How it works in a nutshell</h3><h4>Problem</h4><p>In software development, there is a recurring challenge where the need arises to augment the behavior of individual objects in a flexible and reusable manner. Traditional approaches, such as subclassing or directly modifying the existing code, often fall short, either introducing excessive complexity or violating the open-closed principle. As requirements evolve and new features are added, the inability to dynamically extend an object’s functionality without altering its structure becomes a significant hindrance. This lack of adaptability can lead to code that is rigid, difficult to maintain, and resistant to change.</p><h4>Solution</h4><p>The Decorator design pattern addresses the aforementioned problem by providing a flexible and modular way to extend the behavior of individual objects at runtime. It introduces a set of decorator classes that wrap around the core object, allowing for the dynamic addition of new functionalities. These decorators adhere to the same interface as the core object, ensuring seamless integration and preserving the open-closed principle.</p><p>By employing the Decorator pattern, developers can enhance an object’s capabilities without modifying its structure, promoting code that is both adaptable and extensible. This approach facilitates the construction of systems where new features can be added incrementally, fostering a design that is resilient to change and promoting the separation of concerns. The Decorator pattern, therefore, serves as an elegant solution to the challenge of extending object behavior dynamically while maintaining code integrity and ease of maintenance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/0*-48wvXpRWEURFWXV.png" /><figcaption>Source: The Decorator Pattern — Learning JavaScript Design Patterns [Book]</figcaption></figure><h3>How to implement a Decorator pattern</h3><p>Implementing the Decorator pattern in Java involves creating a set of decorator classes that wrap around a core component. These decorators add or modify behavior while adhering to the same interface as the core component. Here’s a step-by-step guide with a simple example:</p><p>Let’s consider a scenario where we have a basic coffee interface and its concrete implementation:</p><pre>// Step 1: Core Component (Coffee)<br>public interface Coffee {<br>    double cost();<br>    String description();<br>}<br><br>// Step 2: Concrete Component (SimpleCoffee)<br>public class SimpleCoffee implements Coffee {<br>    @Override<br>    public double cost() {<br>        return 2.0;<br>    }<br><br>    @Override<br>    public String description() {<br>        return &quot;Simple Coffee&quot;;<br>    }<br>}</pre><p>Now, let’s create decorator classes that extend the Coffee interface:</p><pre>// Step 3: Decorator (CoffeeDecorator)<br>public abstract class CoffeeDecorator implements Coffee {<br>    protected Coffee decoratedCoffee;<br><br>    public CoffeeDecorator(Coffee decoratedCoffee) {<br>        this.decoratedCoffee = decoratedCoffee;<br>    }<br><br>    @Override<br>    public double cost() {<br>        return decoratedCoffee.cost();<br>    }<br><br>    @Override<br>    public String description() {<br>        return decoratedCoffee.description();<br>    }<br>}</pre><p>Now, we can create concrete decorator classes that add specific functionalities:</p><pre>// Step 4: Concrete Decorator (MilkDecorator)<br>public class MilkDecorator extends CoffeeDecorator {<br>    public MilkDecorator(Coffee decoratedCoffee) {<br>        super(decoratedCoffee);<br>    }<br><br>    @Override<br>    public double cost() {<br>        return super.cost() + 0.5;<br>    }<br><br>    @Override<br>    public String description() {<br>        return super.description() + &quot;, Milk&quot;;<br>    }<br>}<br><br>// Step 5: Concrete Decorator (SugarDecorator)<br>public class SugarDecorator extends CoffeeDecorator {<br>    public SugarDecorator(Coffee decoratedCoffee) {<br>        super(decoratedCoffee);<br>    }<br><br>    @Override<br>    public double cost() {<br>        return super.cost() + 0.2;<br>    }<br><br>    @Override<br>    public String description() {<br>        return super.description() + &quot;, Sugar&quot;;<br>    }<br>}</pre><p>Now, you can use these decorators to create a decorated coffee:</p><pre>// Step 6: Client Code<br>public class Main {<br>    public static void main(String[] args) {<br>        // Creating a simple coffee<br>        Coffee simpleCoffee = new SimpleCoffee();<br>        System.out.println(&quot;Cost: $&quot; + simpleCoffee.cost() + &quot;, Description: &quot; + simpleCoffee.description());<br><br>        // Adding milk to the coffee using the MilkDecorator<br>        Coffee milkCoffee = new MilkDecorator(simpleCoffee);<br>        System.out.println(&quot;Cost: $&quot; + milkCoffee.cost() + &quot;, Description: &quot; + milkCoffee.description());<br><br>        // Adding sugar to the coffee using the SugarDecorator<br>        Coffee sugarCoffee = new SugarDecorator(simpleCoffee);<br>        System.out.println(&quot;Cost: $&quot; + sugarCoffee.cost() + &quot;, Description: &quot; + sugarCoffee.description());<br>    }<br>}</pre><p>This example demonstrates how the Decorator pattern allows you to dynamically extend the behavior of objects while adhering to the open-closed principle.</p><h3>Drawbacks of Decorator</h3><p>While the Decorator pattern provides a flexible and dynamic way to extend object behavior, it is essential to be aware of its potential drawbacks</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FTwlBoPXrXrsAUzW" /><figcaption>Photo by <a href="https://unsplash.com/@elisa_ventur?utm_source=medium&amp;utm_medium=referral">Elisa Ventur</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><ol><li><strong>Complexity and Overhead:</strong><br> — The use of multiple decorator classes can lead to a complex class hierarchy. As the number of decorators increases, it might become challenging to manage and understand the relationships among them.<br> — The creation of numerous decorator instances can result in increased object creation overhead and memory consumption.</li><li><strong>Ordering of Decorators:</strong><br> — The order in which decorators are applied can be crucial. Changing the order of decorators may lead to unexpected behavior, as each decorator modifies the behavior of the underlying component.<br> — It might be challenging to predict the outcome if the order of decorators is not carefully considered.</li><li><strong>Potential for Tight Coupling:</strong><br> — If not designed carefully, the Decorator pattern can lead to tight coupling between components and decorators. This can reduce the flexibility gained from using the pattern and make it harder to modify or extend the system.</li><li><strong>Difficulty in Removing Decorators:</strong><br> — Once decorators are applied, removing them might be challenging, especially in a system with multiple interconnected decorators. This can make it less straightforward to revert to the original behavior.</li><li><strong>Limited Support for Component Removal:</strong><br> — In some implementations, the removal of specific decorators from a decorated object might not be straightforward. This limitation can affect the dynamic nature of the pattern and hinder the ability to adjust the object’s behavior at runtime.</li><li><strong>Potential for Misuse:</strong><br> — Developers might misuse the Decorator pattern by creating a large number of specialized decorators for every possible combination of features. This can lead to unnecessary complexity and defeat the purpose of having a modular and flexible design.</li></ol><h3>Conclusion</h3><p>I hope you enjoyed this insight into the <strong>Decorator</strong> pattern and learned better how to best use it and the related architectural implications.</p><p>Despite these potential drawbacks, the Decorator pattern remains a powerful and widely used design pattern when applied judiciously. By carefully managing the hierarchy and considering the specific requirements of a given system, developers can mitigate these concerns and leverage the pattern’s benefits effectively.</p><p>However, I can assure you that <strong>Decorator is a pattern widely used</strong> in large companies and in complex enterprise projects and you definitely need to master it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8EZ7COkN1l2c8jFD" /><figcaption>Photo by freddie marriage on Unsplash</figcaption></figure><p><strong><em>Follow me</em></strong><em> and boost your knowledge and career by having unlimited access to every story on Medium. </em><strong><em>Become a Member</em></strong><em> and </em><strong><em>support my work</em></strong><em>:</em></p><blockquote><a href="https://medium.com/@lucapelosi/membership"><em>https://medium.com/@lucapelosi/membership</em></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20be2ecf5f54" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Essential Design Patterns: Circuit Breaker]]></title>
            <link>https://medium.com/@lucapelosi/essential-design-patterns-circuit-breaker-8578b8c481c?source=rss-1882bf3cf377------2</link>
            <guid isPermaLink="false">https://medium.com/p/8578b8c481c</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[circuit-breaker]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[performance]]></category>
            <dc:creator><![CDATA[Luca Pelosi]]></dc:creator>
            <pubDate>Fri, 19 Jan 2024 11:01:45 GMT</pubDate>
            <atom:updated>2024-01-19T11:01:45.740Z</atom:updated>
            <content:encoded><![CDATA[<h4>Software Engineer Learning Path</h4><h4>Here’s what it is and how it works</h4><p>If you are interested in strengthening your foundation as a Software Engineer and quickly <strong>learning</strong> the most important skills, read other articles in the series “<a href="https://medium.com/@lucapelosi/list/software-engineering-learning-path-6dbc9c9f33e2">Software Engineer Learning Path</a>”.</p><blockquote><em>To have unlimited access to every story on Medium, become a </em><strong><em>Member</em></strong><em> and </em><strong><em>support my work</em></strong><em> use this link</em><strong><em> </em></strong><a href="https://medium.com/@lucapelosi/membership"><em>https://medium.com/@lucapelosi/membership</em></a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*gK3BEw5JGBw9K6tJMhxAkw.jpeg" /><figcaption>Photo by Mathew Schwartz on Unsplash</figcaption></figure><p>In the dynamic landscape of modern software development, creating robust and resilient applications is a paramount concern. As systems grow in complexity and scale, it becomes crucial to design architectures that can gracefully handle failures, prevent cascading issues, and ensure optimal performance under varying conditions. One indispensable tool in the arsenal of developers striving for resilient systems is the Circuit Breaker design pattern.</p><p>Originating from the field of electrical engineering, the Circuit Breaker pattern has found a new home in software development as a powerful mechanism for enhancing fault tolerance. This pattern acts as a guardian for distributed systems, protecting them from potential failures and allowing applications to gracefully degrade when faced with adverse conditions. By intelligently managing the flow of requests, the Circuit Breaker pattern helps prevent the propagation of faults, ultimately contributing to the overall stability and reliability of the system.</p><h4>How Circuit Breaker can improve the customer experience</h4><p>The Circuit Breaker pattern can significantly enhance the customer experience in various real-world scenarios by preventing or mitigating the impact of service failures and improving the overall system resilience. Here are some scenarios where the Circuit Breaker pattern can make a substantial difference:</p><ol><li><strong>Microservices Architecture</strong>: In a microservices-based architecture, where different services communicate with each other, a failure in one service could potentially cascade and affect the entire system. Implementing Circuit Breaker pattern isolates the failing service, preventing it from further impacting other components. This isolation helps maintain the functionality of the rest of the system and ensures that users experience minimal disruptions.</li><li><strong>Third-Party Integrations:</strong> When integrating with external services or APIs, it’s common to experience intermittent failures or latency issues. The Circuit Breaker pattern can shield your application from prolonged outages by temporarily halting requests to the failing external service. This prevents your application from becoming unresponsive or slow due to external dependencies and maintains a smoother user experience.</li><li><strong>Graceful Degradation:</strong> Instead of allowing an entire application or feature to fail in the presence of a malfunctioning component, Circuit Breaker enables graceful degradation. Certain functionalities or features can be gracefully disabled or replaced with fallback mechanisms, ensuring that users can still access critical parts of the application even when non-essential components are experiencing issues.</li><li><strong>Elasticity in Cloud Environments:</strong> In cloud environments, where resources are dynamically provisioned and de-provisioned, services might experience temporary disruptions during scaling operations or infrastructure failures. By implementing the Circuit Breaker pattern, applications can handle these transient failures more gracefully, preventing extended downtimes and maintaining a seamless experience for users.</li><li><strong>Avoiding Resource Exhaustion</strong>: In scenarios where a sudden surge in traffic or malicious activity causes a spike in requests, the Circuit Breaker pattern can prevent resource exhaustion by limiting the number of concurrent requests to a failing service. This helps the system to remain responsive to legitimate users and prevents it from becoming overwhelmed by an unusually high volume of requests.</li><li><strong>Fallback Mechanisms for User-Facing Features:</strong> For user-facing features that rely on external services, a Circuit Breaker with fallback mechanisms can provide users with alternative functionality during service outages. For example, an e-commerce website might offer a cached product catalog or display static content if the real-time inventory service is temporarily unavailable.</li><li><strong>Reducing Mean Time to Recovery (MTTR):</strong> The Circuit Breaker pattern can contribute to faster recovery times by avoiding repeated attempts to call a failing service. Instead of repeatedly sending requests to a service that is experiencing issues, the Circuit Breaker allows the system to recover, automatically transitioning to a closed state when the service stabilizes.</li></ol><p>In summary, the Circuit Breaker pattern is a powerful tool for maintaining system reliability, preventing cascading failures, and ultimately improving the customer experience by ensuring that applications remain functional and responsive even in the face of transient faults or service disruptions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Uh_AEwduK_ksVf_M" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>How it works in a nutshell</h4><p>The Circuit Breaker design pattern involves three primary states: Closed, Open, and Half-Open. The pattern operates based on the observed behavior of a potentially failing operation, monitoring it and dynamically transitioning between these states to handle failures effectively. The logic associated with each state is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/0*huYv2BBJzDz3ZQmA.png" /></figure><p><strong>Closed State:</strong></p><ul><li>In the initial state, the Circuit Breaker is in a closed state, allowing normal operation.</li><li>The system monitors the outcomes of the operations (e.g., service calls). If the success rate remains above a specified threshold and the error rate is acceptable, the Circuit Breaker continues to operate in the closed state.</li><li>If the monitored metrics indicate potential issues (e.g., an increasing error rate), the Circuit Breaker transitions to an open state to prevent further damage and avoid overloading the failing component.</li></ul><p><strong>Open State:</strong></p><ul><li>When the Circuit Breaker transitions to the open state, it stops forwarding requests to the failing operation.</li><li>This state is a protective mechanism to prevent the system from experiencing additional failures due to a malfunctioning or slow component.</li><li>While in the open state, the Circuit Breaker may redirect requests to a predefined fallback or alternative behavior to provide a graceful degradation of service to users.</li><li>The open state has a timeout associated with it. After this timeout expires, the Circuit Breaker transitions to the half-open state, allowing a limited number of trial operations to determine if the failing operation has recovered.</li></ul><p><strong>Half-Open State:</strong></p><ul><li>The half-open state is a transitional state that allows a controlled number of requests to pass through to the failing operation to assess its recovery.</li><li>If these trial operations succeed, the Circuit Breaker may transition back to the closed state, indicating that the failing operation has recovered.</li><li>If the trial operations still result in failures, the Circuit Breaker remains in the open state, giving more time for the failing operation to stabilize before attempting another transition to the half-open state.</li></ul><p>The Circuit Breaker pattern thus provides a dynamic and adaptive mechanism for handling failures in a distributed system. It actively monitors the health of operations, responds to anomalies, and adjusts its behavior to protect the overall system from cascading failures. The pattern’s logic aims to balance the need for continuous operation, even in the presence of failures, with the need to prevent further damage and allow for recovery.</p><h4>How to implement Circuit Breaker pattern</h4><p>Implementing the Circuit Breaker pattern in Java involves creating a class that monitors the interactions with a potentially failing service, transitions between states (closed, open, and half-open), and provides fallback mechanisms. Below is a simple example of implementing the Circuit Breaker pattern in Java using a class named CircuitBreaker.</p><pre>import java.time.Duration;<br>import java.time.Instant;<br><br>public class CircuitBreaker {<br><br>    private static final int FAILURE_THRESHOLD = 3;<br>    private static final Duration TIMEOUT = Duration.ofSeconds(5);<br><br>    private int failureCount = 0;<br>    private Instant lastFailureTime = null;<br>    private State state = State.CLOSED;<br><br>    public void execute(Runnable operation) {<br>        try {<br>            if (state == State.OPEN &amp;&amp; isTimeoutExpired()) {<br>                // Attempt to transition to the half-open state<br>                state = State.HALF_OPEN;<br>                failureCount = 0;<br>            }<br><br>            if (state == State.CLOSED || state == State.HALF_OPEN) {<br>                operation.run();<br>                // Reset failure count upon successful execution<br>                failureCount = 0;<br>            }<br><br>        } catch (Exception e) {<br>            handleFailure();<br>            throw e;<br>        }<br>    }<br><br>    private void handleFailure() {<br>        failureCount++;<br>        lastFailureTime = Instant.now();<br><br>        if (failureCount &gt;= FAILURE_THRESHOLD) {<br>            // Tripped the threshold, transition to the open state<br>            state = State.OPEN;<br>        }<br>    }<br><br>    private boolean isTimeoutExpired() {<br>        return Duration.between(lastFailureTime, Instant.now()).compareTo(TIMEOUT) &gt; 0;<br>    }<br><br>    private enum State {<br>        OPEN, CLOSED, HALF_OPEN<br>    }<br><br>    public static void main(String[] args) {<br>        CircuitBreaker circuitBreaker = new CircuitBreaker();<br><br>        for (int i = 0; i &lt; 10; i++) {<br>            try {<br>                circuitBreaker.execute(() -&gt; {<br>                    // Simulate a service call<br>                    if (Math.random() &lt; 0.3) {<br>                        throw new RuntimeException(&quot;Service failure&quot;);<br>                    }<br>                    System.out.println(&quot;Service call successful&quot;);<br>                });<br><br>            } catch (Exception e) {<br>                System.out.println(&quot;Service call failed: &quot; + e.getMessage());<br>            }<br><br>            try {<br>                Thread.sleep(1000); // Simulate time passing between service calls<br>            } catch (InterruptedException e) {<br>                e.printStackTrace();<br>            }<br>        }<br>    }<br>}</pre><p>In this example:</p><ul><li>The execute method represents the operation that interacts with the potentially failing service.</li><li>The Circuit Breaker monitors the number of consecutive failures and transitions between the closed, open, and half-open states accordingly.</li><li>A simple timeout mechanism is used to transition from the open to the half-open state after a specified duration.</li><li>The main method demonstrates how to use the CircuitBreaker class to execute a service call while handling failures based on the Circuit Breaker&#39;s state.</li></ul><p>Note: This is a basic example for illustrative purposes. In a real-world scenario, you might want to consider additional features like exponential backoff, more sophisticated state transitions, and integrating with metrics and monitoring systems for better decision-making. There are also third-party libraries available, such as Netflix Hystrix or resilience4j, that provide more advanced implementations of the Circuit Breaker pattern.</p><h4>A better way — third party libraries</h4><p>To implement the Circuit Breaker pattern using Netflix Hystrix in Java, follow these steps:</p><ol><li>Add Hystrix dependency to your project. If you’re using Maven, include the following dependency in your pom.xml:</li></ol><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;com.netflix.hystrix&lt;/groupId&gt;<br>    &lt;artifactId&gt;hystrix-core&lt;/artifactId&gt;<br>    &lt;version&gt;1.5.18&lt;/version&gt; &lt;!-- Use the latest version available --&gt;<br>&lt;/dependency&gt;</pre><p>2. Create a class that extends HystrixCommand to encapsulate the service call. Override the run method with the logic you want to execute, and handle exceptions in the fallback method. Here&#39;s a simple example:</p><pre>import com.netflix.hystrix.HystrixCommand;<br>import com.netflix.hystrix.HystrixCommandGroupKey;<br><br>public class MyHystrixCommand extends HystrixCommand&lt;String&gt; {<br><br>    public MyHystrixCommand() {<br>        super(HystrixCommandGroupKey.Factory.asKey(&quot;ExampleGroup&quot;));<br>    }<br><br>    @Override<br>    protected String run() throws Exception {<br>        // Logic for the actual service call<br>        // Simulate a failure for demonstration purposes<br>        if (Math.random() &lt; 0.3) {<br>            throw new RuntimeException(&quot;Service failure&quot;);<br>        }<br>        return &quot;Service call successful&quot;;<br>    }<br><br>    @Override<br>    protected String getFallback() {<br>        return &quot;Fallback: Service call failed&quot;;<br>    }<br>}</pre><p>Customize the HystrixCommandGroupKey as needed to categorize your commands.</p><p>3. In your application code, execute the Hystrix command:</p><pre>import com.netflix.hystrix.HystrixCommand;<br>import com.netflix.hystrix.HystrixCommandGroupKey;<br><br>public class Main {<br>    public static void main(String[] args) {<br>        HystrixCommand&lt;String&gt; command = new MyHystrixCommand();<br><br>        // Execute the command and retrieve the result<br>        String result = command.execute();<br><br>        // Process the result<br>        System.out.println(result);<br>    }<br>}</pre><p>This example demonstrates how Hystrix automatically applies the Circuit Breaker pattern. If the service call within the run method fails, Hystrix will invoke the fallback method, preventing the failure from cascading through your application.</p><p>4. Optionally, you can configure various aspects of Hystrix, such as circuit breaker properties and metrics, by adding configuration settings to your application. For example, you can use @HystrixCommand annotation on methods to customize Hystrix behavior.</p><pre>import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;<br><br>public class MyService {<br><br>    @HystrixCommand(fallbackMethod = &quot;fallbackMethod&quot;, commandProperties = {<br>            @HystrixProperty(name = &quot;circuitBreaker.requestVolumeThreshold&quot;, value = &quot;10&quot;),<br>            @HystrixProperty(name = &quot;circuitBreaker.sleepWindowInMilliseconds&quot;, value = &quot;5000&quot;)<br>    })<br>    public String performServiceCall() {<br>        // Logic for the actual service call<br>        // ...<br>    }<br><br>    public String fallbackMethod() {<br>        return &quot;Fallback: Service call failed&quot;;<br>    }<br>}</pre><p>This example uses the @HystrixCommand annotation to specify a fallback method and set some circuit breaker properties.</p><p>Remember to adjust the configurations based on your specific requirements. Netflix Hystrix provides various configuration options to fine-tune the behavior of the Circuit Breaker pattern in your application.</p><p><em>Boost your knowledge and career by having unlimited access to every story on Medium. </em><strong><em>Become a Member</em></strong><em> and support my work: </em><a href="https://medium.com/@lucapelosi/membership"><em>https://medium.com/@lucapelosi/membership</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PHr5cy132AzuYBi9" /></figure><p>Photo by charlesdeluvio on Unsplash</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8578b8c481c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Solid Knowledge of Computer Science]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@lucapelosi/how-to-build-a-solid-knowledge-of-computer-science-9d8856a032e5?source=rss-1882bf3cf377------2"><img src="https://cdn-images-1.medium.com/max/2600/0*bW7bN3-hTH_FTAG4" width="3670"></a></p><p class="medium-feed-snippet">Don&#x2019;t waste time studying the latest framework</p><p class="medium-feed-link"><a href="https://medium.com/@lucapelosi/how-to-build-a-solid-knowledge-of-computer-science-9d8856a032e5?source=rss-1882bf3cf377------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@lucapelosi/how-to-build-a-solid-knowledge-of-computer-science-9d8856a032e5?source=rss-1882bf3cf377------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d8856a032e5</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[learning-and-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Luca Pelosi]]></dc:creator>
            <pubDate>Tue, 12 Sep 2023 15:15:38 GMT</pubDate>
            <atom:updated>2023-09-12T15:21:56.941Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[The 10 best suggestions from the “Oracle of Omaha”]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@lucapelosi/the-10-best-suggestions-from-the-oracle-of-omaha-5f16d4c552eb?source=rss-1882bf3cf377------2"><img src="https://cdn-images-1.medium.com/max/1500/0*j5mRcvo8e3a1GTo6.jpg" width="1500"></a></p><p class="medium-feed-snippet">The principles of W. Buffett and C. Munger worth $ 991 billion</p><p class="medium-feed-link"><a href="https://medium.com/@lucapelosi/the-10-best-suggestions-from-the-oracle-of-omaha-5f16d4c552eb?source=rss-1882bf3cf377------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@lucapelosi/the-10-best-suggestions-from-the-oracle-of-omaha-5f16d4c552eb?source=rss-1882bf3cf377------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f16d4c552eb</guid>
            <category><![CDATA[personal-growth]]></category>
            <category><![CDATA[charlie-munger]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[warren-buffett]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Luca Pelosi]]></dc:creator>
            <pubDate>Mon, 20 Mar 2023 11:01:33 GMT</pubDate>
            <atom:updated>2024-01-27T21:45:00.113Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Human Resources (HR) Levels and Salaries Explained]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@lucapelosi/human-resources-hr-levels-and-salaries-explained-d34688eadd05?source=rss-1882bf3cf377------2"><img src="https://cdn-images-1.medium.com/max/2272/1*a8_4obqlrWA8gkgKP12i5Q.png" width="2272"></a></p><p class="medium-feed-snippet">Compare your career path and find out how much you should earn</p><p class="medium-feed-link"><a href="https://medium.com/@lucapelosi/human-resources-hr-levels-and-salaries-explained-d34688eadd05?source=rss-1882bf3cf377------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@lucapelosi/human-resources-hr-levels-and-salaries-explained-d34688eadd05?source=rss-1882bf3cf377------2</link>
            <guid isPermaLink="false">https://medium.com/p/d34688eadd05</guid>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[salary]]></category>
            <category><![CDATA[hr]]></category>
            <category><![CDATA[career-paths]]></category>
            <category><![CDATA[human-resources]]></category>
            <dc:creator><![CDATA[Luca Pelosi]]></dc:creator>
            <pubDate>Thu, 23 Feb 2023 13:02:47 GMT</pubDate>
            <atom:updated>2023-02-23T13:02:47.718Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[10 Reasons Traders Lose Money]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@lucapelosi/10-reasons-traders-lose-money-284bb64e971?source=rss-1882bf3cf377------2"><img src="https://cdn-images-1.medium.com/max/2600/0*mslWXr0xQNsfjl3l" width="6000"></a></p><p class="medium-feed-snippet">Don&#x2019;t listen to web trading gurus</p><p class="medium-feed-link"><a href="https://medium.com/@lucapelosi/10-reasons-traders-lose-money-284bb64e971?source=rss-1882bf3cf377------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@lucapelosi/10-reasons-traders-lose-money-284bb64e971?source=rss-1882bf3cf377------2</link>
            <guid isPermaLink="false">https://medium.com/p/284bb64e971</guid>
            <category><![CDATA[investing]]></category>
            <category><![CDATA[earnings]]></category>
            <category><![CDATA[trader]]></category>
            <category><![CDATA[money]]></category>
            <category><![CDATA[trading]]></category>
            <dc:creator><![CDATA[Luca Pelosi]]></dc:creator>
            <pubDate>Mon, 20 Feb 2023 14:02:41 GMT</pubDate>
            <atom:updated>2024-01-27T21:25:08.053Z</atom:updated>
        </item>
    </channel>
</rss>