<?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 Barend Nieuwoudt on Medium]]></title>
        <description><![CDATA[Stories by Barend Nieuwoudt on Medium]]></description>
        <link>https://medium.com/@barendnieuwoudt?source=rss-e396b780de1a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*I60d-sx5MGxBGoZ2xAYCGA.jpeg</url>
            <title>Stories by Barend Nieuwoudt on Medium</title>
            <link>https://medium.com/@barendnieuwoudt?source=rss-e396b780de1a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 08:36:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@barendnieuwoudt/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[Kafka Basics: Intro to Kafka Theory]]></title>
            <link>https://medium.com/@barendnieuwoudt/kafka-basics-intro-to-kafka-theory-4299025bb73e?source=rss-e396b780de1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4299025bb73e</guid>
            <category><![CDATA[apache-kafka-tutorial]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[apache-kafka]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Barend Nieuwoudt]]></dc:creator>
            <pubDate>Tue, 14 Apr 2026 06:26:44 GMT</pubDate>
            <atom:updated>2026-04-14T06:26:44.666Z</atom:updated>
            <content:encoded><![CDATA[<p>Core concepts illustrated and explained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bf6sqVJG9JkllmjTg7vtKQ.png" /></figure><p><strong>Brokers </strong>are servers that make up the cluster. Each broker stores a portion of the data and messages on the topics.</p><p><strong>Producers </strong>are programs that publish messages to a Kafka topic. A group of producers are called a producer group.</p><p><strong>Consumers </strong>are programs that subscribe to a Kafka topic, and read messages from that topic. A group of consumers are called a consumer group.</p><p><strong>Zookeeper:</strong></p><p>Kafka is a distributed system that enables horizontal scaling across multiple servers/brokers. To ensure that all data is available and consistent across the cluster, Kafka requires coordination among its various components. The <strong>Zookeeper</strong> is responsible for this coordination.</p><p>The zookeeper together with the Kafka cluster make up your Kafka ecosystem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dY4NrBmOgPafzf29gaatLg.png" /></figure><p>A T<strong>opic </strong>in Apache Kafka is a category to which messages are published by producers. Topics are split into <strong>Partitions.</strong></p><p><strong>Partitions </strong>are a way to split a topic across multiple brokers in a Kafka cluster. Each partition is an ordered, immutable sequence of messages.</p><p>The partitions within a topic can be replicated across multiple brokers, to ensure redundancy and prevent data loss.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4299025bb73e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kafka Basics: Install & Run Kafka]]></title>
            <link>https://medium.com/@barendnieuwoudt/kafka-basics-install-run-kafka-4d1d1f7e549e?source=rss-e396b780de1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d1d1f7e549e</guid>
            <category><![CDATA[apache]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[apache-kafka]]></category>
            <dc:creator><![CDATA[Barend Nieuwoudt]]></dc:creator>
            <pubDate>Tue, 14 Apr 2026 06:24:22 GMT</pubDate>
            <atom:updated>2026-04-14T06:24:22.884Z</atom:updated>
            <content:encoded><![CDATA[<p>Quick &amp; Easy Tutorial to get your Kafka running on Windows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*6LYq3bODCbJEVO0h" /></figure><p>Firstly, download <a href="http://kafka.apache.org/downloads">Apache Kafka</a> and extract the contents to your installation directory. I put mine in “<em>C:/Kakfa/kafka_2.13–3.9.1/”</em>.</p><p>Update <em>“&lt;installation_dir&gt;/config/zookeeper.properties”</em> as follows, to include a data directory:</p><pre>dataDir=C:/Kafka/kafka_2.13-3.9.1/zookeeper-data</pre><p>Now update “<em>&lt;installation_dir&gt;/config/server.properties”</em> to include a log location:</p><pre>log.dirs=C:/Kafka/kafka_2.13-3.9.1/kafka-logs</pre><p>Then, inside a command prompt, open the “<em>&lt;installation_dir&gt;/bin/windows”</em> directory before running each of the following commands in order:</p><pre>cd C:\Kafka\kafka_2.13–3.9.1\bin\windows</pre><p>Firstly, start the <strong>Zookeeper</strong>:</p><pre>zookeeper-server-start.bat C:\Kafka\kafka_2.13-3.9.1\config\zookeeper.properties</pre><p>When the zookeeper has finished booting, start the <strong>Kafka Server</strong>:</p><pre>kafka-server-start.bat C:\Kafka\kafka_2.13-3.9.1\config\server.properties</pre><p>Create a new topic, called <em>first_topic</em>:</p><pre>kafka-topics.bat --bootstrap-server localhost:9092 --topic first_topic --create</pre><p>After all the required services are started, you can run a local producer and consumer and send messages between them to test that everything is working as expected.</p><p>These commands must be run from the “<em>&lt;installation_dir&gt;/bin/windows” </em>directory.</p><p>Firstly, start your <strong>producer, </strong>the application that will publish messages:</p><pre>kafka-console-producer.bat --bootstrap-server localhost:9092 --topic first_topic</pre><p>Then, start your <strong>consumer</strong>, the application that will read messages:</p><pre>kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic first_topic</pre><p>Any message you type and send in your producer should be displayed on your consumer side:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*52MEVlOtKmbIeKeiHYKt7g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d1d1f7e549e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JUnit 4 Vs JUnit 5: Differences & Boilerplate Code]]></title>
            <link>https://medium.com/@barendnieuwoudt/junit-4-vs-junit-5-differences-boilerplate-code-b6333f6cf58e?source=rss-e396b780de1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6333f6cf58e</guid>
            <category><![CDATA[software-engineer]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[unittest]]></category>
            <category><![CDATA[junit]]></category>
            <dc:creator><![CDATA[Barend Nieuwoudt]]></dc:creator>
            <pubDate>Sat, 24 May 2025 08:19:07 GMT</pubDate>
            <atom:updated>2025-05-24T08:19:07.766Z</atom:updated>
            <content:encoded><![CDATA[<p>Key differences &amp; how to use each.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RJa1XYDD-zT6Oboe" /><figcaption>Photo by <a href="https://unsplash.com/@emilep?utm_source=medium&amp;utm_medium=referral">Emile Perron</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>JUnit 4 Example:</h4><pre>import org.junit.Before;<br>import org.junit.Test;<br>import org.junit.runner.RunWith;<br>import org.mockito.Mock;<br>import org.mockito.junit.MockitoJUnitRunner;<br><br>@RunWith(MockitoJUnitRunner.class)<br>public class FeatureNameTest{<br><br>    @Before<br>    public void beforeEach() {<br>        // Code<br>    }<br>    <br>    @Test<br>    public void firstTest() {<br>        // Code<br>    }<br><br>}</pre><h4>JUnit 5 Example:</h4><pre>import org.junit.jupiter.api.BeforeEach;<br>import org.junit.jupiter.api.DisplayName;<br>import org.junit.jupiter.api.Test;<br>import org.junit.jupiter.api.extension.ExtendWith;<br>import org.mockito.ArgumentCaptor;<br>import org.mockito.Captor;<br>import org.mockito.Mock;<br>import org.mockito.junit.jupiter.MockitoExtension;<br><br>@ExtendWith({MockitoExtension.class})<br>class FeatureNameTest {<br><br>    @BeforeEach<br>    void beforeEach() {<br>        // Code<br>    }<br>    <br>    @Test<br>    @DisplayName(&quot;Some cool test description&quot;)<br>    void firstTest() {<br>        // Code<br>    }<br><br>}</pre><h4>Note the following:</h4><ul><li>JUnit 4 uses @Before and @Test from org.junit.</li><li>JUnit 5 uses @BeforeEach and @Test from org.junit.jupiter.api.</li><li>@DisplayName is a JUnit 5 feature for giving tests human-readable names.</li><li>JUnit 4 uses @RunWith(...) to plug in external test runners.</li><li>JUnit 5 uses @ExtendWith(...) to register extensions like Mockito.</li><li>JUnit 5 replaces @Before with @BeforeEach.</li><li>JUnit 5 allows using private or package-private methods, while JUnit 4 requires public.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6333f6cf58e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Retrospective Ideas that are NOT glad/sad/mad]]></title>
            <link>https://medium.com/@barendnieuwoudt/favorite-retrospective-ideas-56a41a0b9dcd?source=rss-e396b780de1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/56a41a0b9dcd</guid>
            <category><![CDATA[retrospectives]]></category>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Barend Nieuwoudt]]></dc:creator>
            <pubDate>Mon, 17 Mar 2025 11:24:11 GMT</pubDate>
            <atom:updated>2025-03-20T09:51:21.506Z</atom:updated>
            <content:encoded><![CDATA[<p>Coming up with retrospective ideas is hard. I’ve found that 99% of all of the ‘retrospective ideas’ lists that I find on the internet are garbage. It’s all some variation of the words good, bad, better, worse or whatever.</p><p>Glad/Sad/Mad, Stop/Start/Continue, Rose/Bud/Thorn, or any variation of “this makes the boat/car/plane move” and “this makes the boat/car/plane stop” are all essentially the same. They aren’t necessarily bad, just the same.</p><p>So, here are some, that I hope, are a little bit different than relabeling the Glad/Sad/Mad retro.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WjYe5yl8h06YHBY3" /><figcaption>Photo by <a href="https://unsplash.com/@kanashi?utm_source=medium&amp;utm_medium=referral">Kanashi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Who moved my cheese?</h3><p>The only consistent thing in life is change and “Who moved my cheese?” is a book about dealing with change.</p><p>Have I read it? No. BUT, the retro idea based on this book is interesting.</p><p>Here are some prompts to assist in the information gathering phase of your retro:</p><h4>1. What worked well?</h4><p>I’m aware of how ironic (or hypocritical) this sounds, given my rant from earlier. I’m not actually saying these types of prompts are bad, I’m merely proposing that we need a little bit more variety in our retros. It is important to celebrate the wins. This section can also be replaced with a space for giving recognition to individuals.</p><h4>2. What status quo can be challenged?</h4><p>This is the good stuff. Often processes are so widely accepted as “this is how we do things” that they often become outdated, inefficient or ineffective because nobody thinks about it critically, often enough. Specifically asking the question around these established processes could yield a lot of important actions. Here, make sure to consider all processes, even the ‘working’ ones.</p><p>Just an extra note from the last time I hosted this retro: There were lots of answers here that were things outside of the team’s control to change. This meant that this section felt a little bit like complaining and no problems were being solved. To be clear, these have to either be processes that the team own or have some influence on even if it&#39;s a really small amount.</p><h4>3. What are we doing for continuous inspection, and learning?</h4><p>The question about learning is often very focused on new things, which is essential for growth. This question, however, makes us think about learning things we <em>think </em>we already know. This is the whole point of a retro.</p><h4>4. What are the risks/concerns for the next sprint?</h4><p>Retrospectives are often only about the sprint that finished already. This part is a bit more forward thinking. It&#39;s useful to ask and come up with actions that solve new problems and challenges that may arise, instead of only actioning the problems of the last sprint. Those who forget history are indeed doomed to repeat it, but we can’t <em>only </em>live in the past.</p><h4>5. What could have worked better?</h4><p>What didn’t work, what was terrible, what did we not like, etc. It’s all the same question, but phrasing it like “what could be better” is a little bit more positive than asking “what was bad?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Leat7Hj83gPqU3fr" /><figcaption>Photo by <a href="https://unsplash.com/@helloimnik?utm_source=medium&amp;utm_medium=referral">Nik</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Spotify Health Check</h3><p>Usually, the outcome of a retro is a bunch of actions that would apply to the next sprint, or any sprint thereafter, but the health check retro has an additional artifact: This retro is meant to also gauge and visualize the overall ‘health’ of the team.</p><p>Here are some categories, and the prompts to go along with them. I’ve found that doing all of the categories in a single hour-long retro can prove challenging, even for a smaller team.</p><h4>Team</h4><ul><li>Fun — We love going to work and have great fun working together.</li><li>Learning — We’re learning lots of interesting stuff all the time.</li><li>Support — We always get great support and help when we ask.</li></ul><h4>Organization</h4><ul><li>Mission — We know exactly why we are here, and we are really excited about it.</li><li>Pawn or Player — We are in control of our destiny. We decide what to build and how to build it.</li></ul><h4>Delivering</h4><ul><li>Value — we deliver great stuff. We’re proud of it and our stakeholders are really happy.</li><li>Suitable process — Our way of working fits us perfectly.</li><li>Speed — We get stuff done really quickly. No waiting, no delays.</li></ul><h4>Tech</h4><ul><li>Tech quality — We’re proud of the quality of our code. It is clean, easy to read, and has great test coverage.</li><li>Easy Releasing — Releasing is simple, safe, painless and mostly automated.</li></ul><p>Now, you could ask these questions in a survey of sorts, and have people rank how they feel about each item. A rating out of 5, or a thumbs up/down could work.</p><p>I set this up on a board, where each participant would add a green, yellow or red sticky under each of the items. Inside the sticky they wrote their justification for why they picked a specific color. I do believe it’s important to ask ‘why’, especially if the rating is bad.</p><p>In the discussion that followed, we addressed the red and yellow stickies first and then came up with actions. Participants found it easy to write their reasoning for how they feel as they went along, rather than try remembering it at the end during the discussion. It was also really easy to spot, at a glance, which items/topics the team felt good about, or not.</p><p>So, at the risk of doing exactly what I was complaining about before, you can host a retro in this style but make the items/topics whatever you like. Another cool variation of this is to measure the health of the team against Agile Principles or the values of Scrum:</p><ul><li>Courage — Team members have the courage to do the right thing and work on tough problems.</li><li>Focus — Everybody focuses on the work of the sprint and the goals of the scrum team.</li><li>Commitment — People personally commit to achieving the goals of the scrum team.</li><li>Respect — Team members respect each other to be capable, independent people.</li><li>Openness — The team and its stakeholders agree to be open about all the work and the challenges with performing the work.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9XQSNsAgxzLLP-YL" /><figcaption>Photo by <a href="https://unsplash.com/@javaistan?utm_source=medium&amp;utm_medium=referral">Afif Ramdhasuma</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Personal Feedback Retrospective</h3><p>When my last company made the push to implement Scrum and be more agile, we made a conscious effort to practice the agile principles. Specifically, continuous feedback.</p><p>In one of the retro sessions, every person in the team received a piece of paper with their name on it. Each participant then had to write at least one sticky note with feedback for every other participant and go put it on that person’s sheet.</p><p>This can be very uncomfortable, and I’ve noticed that unless specifically required to write <em>constructive </em>feedback, participants will simply write nice things to each other. These are obviously also welcome but asking your participants to write at least one constructive bit of feedback may be necessary. Each person then has a page, with loads of feedback on it and it&#39;s up to the individual to decide how to action them.</p><p>I do not recommend doing this with a brand-new team. The team needs to exist long enough that people can think of real constructive feedback. Participants can’t give proper feedback to individuals they don’t know.</p><h4>Final Thoughts</h4><p>Retros often become a bit too routine, doing the same monotonous task every other week. I think having variety will improve participation, and in doing so, increase the value of the ceremony.</p><p>Reflection is an important part of growth, for individuals and teams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P8GPkvH7O3EdhX6P" /><figcaption>Photo by <a href="https://unsplash.com/@parabol?utm_source=medium&amp;utm_medium=referral">Parabol | The Agile Meeting Tool</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Further Reading:</h4><ol><li><a href="https://echometerapp.com/en/spotify-health-check-retrospective/?ref=32retroIdes">Spotify Health Check Retrospective: Overview, Access &amp; Tips — Echometer (echometerapp.com)</a></li><li><a href="https://www.visual-paradigm.com/scrum/the-5-scrum-values/">What are The 5 Scrum Values? (visual-paradigm.com)</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56a41a0b9dcd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Guide to Resilience in Java Spring Boot Applications]]></title>
            <link>https://medium.com/@barendnieuwoudt/guide-to-resilience-in-java-spring-boot-applications-4b2198951846?source=rss-e396b780de1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b2198951846</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[resilience4j]]></category>
            <dc:creator><![CDATA[Barend Nieuwoudt]]></dc:creator>
            <pubDate>Sun, 20 Oct 2024 13:10:46 GMT</pubDate>
            <atom:updated>2024-10-20T13:10:46.761Z</atom:updated>
            <content:encoded><![CDATA[<p>How Resilience4J can help implement more Resilient Java Applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qOuNXRaFeFsa8WrVTZPZQg.png" /></figure><p>Lets consider some common resilience challenges. The first of which are <strong>Noisy Neighbors</strong>. Imagine one process taking up too much of a resource, such that there isn’t enough of that resource for another process to use. A similar scenario could happen in the case where the resource in question has <strong>limited capacity</strong> to begin with. Finally, a resource could be unexpectedly unavailable, causing a <strong>transient failure</strong>.</p><p>Writing resilient software would mean writing software that can overcome, adapt or fail gracefully in the above mentioned scenarios. Let’s look at some common resilience patterns, and how to implement them.</p><p>To add Resilience4J to your Gradle project, see the <a href="https://resilience4j.readme.io/docs/gradle">Getting Started Guide</a>.</p><h4>Rate Limiter.</h4><p>If you know that your software is accessing some scarce resource, or you want to make sure you aren’t the noisy neighbor, you can limit the amount of uses of a resources within a given time period. This is how you solve for a resource with <strong>limited capacity</strong>. To add a rate limiter, annotate your method as such:</p><pre>@RateLimiter(name = &quot;myRateLimiter&quot;)</pre><p>Your rate limiter can then be configured in your application.properties:</p><pre>resilience4j.ratelimiter.instances.myRateLimiter.limit-for-period=5<br>resilience4j.ratelimiter.instances.myRateLimiter.limit-refresh-period=60s<br>resilience4j.ratelimiter.instances.myRateLimiter.timeout-duration=0s</pre><h4>Bulkhead.</h4><p>Bulkheads are similar to rate limiters, except they don’t limit requests over a time period, they limit concurrent requests at any given moment in time.</p><pre>@Bulkhead(name = &quot;courseBulkheadApi&quot;, fallbackMethod = &quot;bulkheadFallback&quot;)</pre><p>The configuration can then be specified in the application.properties file:</p><pre>resilience4j.bulkhead.instances.courseBulkheadApi.maxConcurrentCalls=10<br>resilience4j.bulkhead.instances.courseBulkheadApi.maxWaitDuration=100ms</pre><h4>Retry.</h4><p>The idea is that if it didn’t work, try it again. This is useful for a resource that is not expected to be unavailable for very long, or any scenario that can be recovered from quickly. In that case, if a resource does become available again and the retry succeeds, the <strong>transient failure</strong> is entirely hidden from the user.</p><pre>@Retry(name = &quot;myRetry&quot;, fallbackMethod = &quot;fallbackAfterRetry&quot;)</pre><p>Spring has its own implementation of a retry, which is sometimes preferred to the Resilience4J retry implementation.</p><pre>@Retryable(exclude = MyNonRetryableException.class, maxAttempts = 3, backOff = @BackOff(delay = 250, multiplayer = 2))</pre><p>See the <a href="https://resilience4j.readme.io/docs/retry#create-and-configure-retry">Resilience4J Retry Documentation</a> for configurable properties.</p><h4>Circuit Breaker.</h4><p>A circuit breaker will change the behavior of the software when a certain failure threshold is reached, and only when the reopen threshold is reached again will the behavior change back to what it was initially.</p><p>A retry will do the same thing over and over again and eventually fall back to doing something else, for a single request. When the next request comes in the software will behave exactly as it did for the first request, potentially spending the same amount of time retrying if the underlying problem is still unresolved. Once a circuit breaker has ‘tripped’ the fallback code will immediately execute for the next requests, until the reopen threshold is reached again, wasting no time trying something that’s unlikely to succeed.</p><p>To implement a circuit breaker using Resilience4J, annotate your method:</p><pre>@CircuitBreaker(name = &quot;myCircuitBreaker&quot;)</pre><p>See the <a href="https://resilience4j.readme.io/docs/circuitbreaker#create-and-configure-a-circuitbreaker">Resilience4J Circuit Breaker Documentation</a> for the configurable properties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HCx-SXLySJ920WTgByicvg.png" /></figure><h4>Conclusion.</h4><p>Designing resilient software is critical to it’s success. It’s up to you to use the above mentioned methods to ensure your software doesn’t fail, or does so gracefully. Good Luck.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b2198951846" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Text Adventure in Python]]></title>
            <link>https://medium.com/@barendnieuwoudt/creating-a-text-adventure-in-python-958ba119a859?source=rss-e396b780de1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/958ba119a859</guid>
            <category><![CDATA[textadventure]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[zork]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Barend Nieuwoudt]]></dc:creator>
            <pubDate>Sun, 13 Oct 2024 10:40:30 GMT</pubDate>
            <atom:updated>2024-10-13T10:41:57.565Z</atom:updated>
            <content:encoded><![CDATA[<p>Its actually really really simple.</p><p>Think about one of the most famous text adventure games out there: Zork. You could travel in the cardinal directions to get from one location to the next. If you drew out that map it would look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fbzip0TsDO2UMiesd0e__w.jpeg" /><figcaption><a href="https://blog.amigaguru.com/zork-1-the-great-underground-empire-review/">SOURCE</a></figcaption></figure><p>That right there is a graph. In proper graph terminology we can think of each spot as a ‘vertex’ and each line that connect the vertices as an ‘edge’. We’ll use these terms later when me make our own game.</p><p>Now, lets look at what the actual game play looked like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*3yUUaLS-mVFmj-10cpPvjA.png" /></figure><p>Here, we will call #1 in the image, the title, and #2 the description. At this point, you actually have everything you need to make a basic text adventure, like in the following code.</p><pre>class Vertex:<br> <br> def __init__(self, title, desc):<br>  self.title = title<br>  self.desc = desc<br>  self.edges = {}<br>  <br> def addEdge(self, desc, dest):<br>  self.edges[desc] = dest<br>  <br> def visit(self):<br>  print(self)<br>  c = input(&quot; &gt; &quot;)<br>  if c in self.edges:<br>   self.edges[c].visit()<br>  else:<br>   self.visit()<br> <br> def __str__(self):<br>  edges = [ f&quot;{key} - {self.edges[key].title}&quot; for key in self.edges]<br>  return f&quot;{self.title}\n{self.desc}\n\n{str(edges)}&quot;<br><br>if __name__ == &quot;__main__&quot;:<br><br> # Create your house vertex/location<br> house = Vertex(&quot;House&quot;, &quot;You are standing in the living room of your house.&quot;)<br> # Create your yard vertex/location<br> yard = Vertex(&quot;Lawn&quot;, &quot;You are standing on the grass, on you front lawn.&quot;)<br> <br> # Create the Edge that connects your house to your yard.<br> house.addEdge(&quot;leave&quot;, yard)<br> # Create the Edge that connects your yard to your house.<br> yard.addEdge(&quot;go inside&quot;, house)<br> <br> # Start the game, by visiting your house.<br> house.visit()</pre><p>If you don’t want to show the user the options that they have at each spot, you can simplify the __str__() methods as follows:</p><pre>def __str__(self):<br>  return f&quot;{self.title}\n{self.desc}\n\n&quot;</pre><p>Lets add another interesting action in the game: what if there are secrets that the player can only discover if they choose to inspect the area they are currently visiting.</p><p>Update the code as follows:</p><pre>class Vertex:<br> <br> def __init__(self, title, desc, secret = &quot;You see nothing interesting.&quot;):<br>  self.title = title<br>  self.desc = desc<br>  self.secret = secret<br>  self.edges = {}<br>  <br> def addEdge(self, desc, dest):<br>  self.edges[desc] = dest<br>  <br> def visit(self):<br>  print(self)<br>  c = input(&quot; &gt; &quot;)<br>  <br>  if c == &#39;inspect&#39;:<br>   print(f&quot;{self.secret}\n&quot;)<br>   self.visit()<br>  elif c in self.edges:<br>   self.edges[c].visit()<br>  else:<br>   self.visit()<br> <br> def __str__(self):<br>  edges = [ f&quot;{key} - {self.edges[key].title}&quot; for key in self.edges]<br>  return f&quot;{self.title}\n{self.desc}\n\n{str(edges)}&quot;<br><br>if __name__ == &quot;__main__&quot;:<br><br> # Create your house vertex/location<br> house = Vertex(&quot;House&quot;, &quot;You are standing in the living room of your house.&quot;)<br> # Create your yard vertex/location<br> yard = Vertex(&quot;Lawn&quot;, &quot;You are standing on the grass, on you front lawn.&quot;, &quot;You notice a bloody spot in the grass.&quot;)<br> <br> # Create the Edge that connects your house to your yard.<br> house.addEdge(&quot;leave&quot;, yard)<br> # Create the Edge that connects your yard to your house.<br> yard.addEdge(&quot;go inside&quot;, house)<br> <br> # Start the game, by visiting your house.<br> house.visit()</pre><p>There are a couple of changes here. Firstly, notice that a vertex now has another parameter called ‘secret’ with a default value of “You see nothing interesting.”</p><pre> def __init__(self, title, desc, secret = &quot;You see nothing interesting.&quot;):<br>  self.title = title<br>  self.desc = desc<br>  self.secret = secret<br>  self.edges = {}</pre><p>This default allows us to skip adding a secret to any location, so if the player does the <em>inspect </em>action when there are no secrets it will print something that makes sense.</p><p>But when you do want a secret in your environment, you can add one like in the yard example.</p><pre> # Create your yard vertex/location<br> yard = Vertex(&quot;Lawn&quot;, &quot;You are standing on the grass, on you front lawn.&quot;, &quot;You notice a bloody spot in the grass.&quot;)</pre><p>Given the modifications above, when the player is standing on the front lawn, and they enter <em>inspect</em> it will reveal the text that says “You notice a bloody spot in the grass.”</p><p>The description of the location is also updated with the new information, so the player can see the already discovered information when they visit the location again at a later time.</p><pre>  if c == &#39;inspect&#39;:<br>   print(f&quot;{self.secret}\n&quot;)<br>   self.desc = f&quot;{self.desc}\n{self.secret}&quot;<br>   self.visit()<br>  elif c in self.edges:<br>   self.edges[c].visit()<br>  else:<br>   self.visit()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*8BAb_lRI9D9SSx_4WBvzNg.png" /></figure><p>Now, its up to you to make up an interesting story, and write all your own locations, paths, and the secrets that they hold. Good luck.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=958ba119a859" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java & Spring Boot: Exposing Metrics using Gradle, Prometheus & Grafana]]></title>
            <link>https://medium.com/@barendnieuwoudt/java-spring-boot-exposing-metrics-using-gradle-prometheus-grafana-3c5609dac96c?source=rss-e396b780de1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c5609dac96c</guid>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[metrics]]></category>
            <dc:creator><![CDATA[Barend Nieuwoudt]]></dc:creator>
            <pubDate>Mon, 25 Mar 2024 15:42:06 GMT</pubDate>
            <atom:updated>2024-03-25T15:42:06.569Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a quick tutorial to show you how to export metrics from your Spring Boot application to Grafana via Prometheus.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bB9kzxTNA7GMau7AwGi0dA.png" /></figure><h4>Making the metrics available on your Spring Boot application</h4><p>Add the following imports to your Spring Boot application’s <strong>build.gradle</strong>:</p><pre>implementation &#39;org.springframework.boot:spring-boot-starter-web&#39;<br>implementation &#39;org.springframework.boot:spring-boot-starter-actuator&#39;<br>implementation &#39;io.micrometer:micrometer-registry-prometheus:1.9.1&#39;</pre><p>Add the following to you Spring Boot application’s <strong>application.properties</strong>:</p><pre>management.endpoints.web.exposure.include=health,metrics,prometheus</pre><p>To ensure the actuator is exposing some metrics, run your application and visit: http://<em>server</em>:<em>port</em>/actuator/prometheus</p><p>In my case, it was: <a href="http://localhost:8080/actuator/prometheus">http://localhost:8080/actuator/prometheus</a></p><h4>Setting up Prometheus</h4><p><a href="https://prometheus.io/download/">Download the Prometheus zip</a> and extract the contents.</p><p>Update the <strong>prometheus.yaml</strong> file as follows:</p><pre>global:<br>  scrape_interval: 5s<br>  evaluation_interval: 5s<br><br>alerting:<br>  alertmanagers:<br>    - static_configs:<br>        - targets:<br><br>rule_files:<br><br>scrape_configs:<br><br>  - job_name: &quot;prometheus&quot;<br><br>    static_configs:<br>      - targets: [&quot;localhost:8080&quot;]<br>    metrics_path: &#39;/actuator/prometheus&#39;</pre><p>Go to <a href="http://localhost:9090/graph">http://localhost:9090/graph</a>. Use the metrics explorer (to the right of the search bar) to pick a metric and click ‘<em>execute</em>’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DOeG2x2WmbC2duMcuJzC6w.png" /></figure><p>If everything has worked out so far, you should see those same metrics from earlier, displayed in a prettier graph.</p><h4>Setting up Grafana</h4><p><a href="https://grafana.com/grafana/download?platform=windows">Download Grafana</a>, unzip the contents and run “bin/grafana-server.exe”</p><ol><li>Go to: <a href="http://localhost:3000/">http://localhost:3000</a>, and log in with admin/admin.</li><li>Click the top left menu icon, and under ‘<em>connections’ </em>add a new connection.</li><li>Select Prometheus from the list of possible connections.</li><li>Add a new data source and then add the URL: <a href="http://localhost:9090/graph">http://localhost:9090/</a></li><li>Click ‘Save &amp; Test’ at the bottom of the page.</li></ol><p>If all is well, you should now have you metrics displayed in Grafana.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c5609dac96c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java Spring JPA: How to Solve “Unable to load authentication DLL mssql-jdbc_auth” Issue]]></title>
            <link>https://medium.com/@barendnieuwoudt/java-spring-jpa-how-to-solve-unable-to-load-authentication-dll-mssql-jdbc-auth-issue-ea4eb262e11b?source=rss-e396b780de1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea4eb262e11b</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[sql-server]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[spring-jpa]]></category>
            <dc:creator><![CDATA[Barend Nieuwoudt]]></dc:creator>
            <pubDate>Mon, 25 Mar 2024 15:27:20 GMT</pubDate>
            <atom:updated>2024-03-25T15:27:20.083Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eHeAJKv2UenM4QQ_wI7ZkA.png" /></figure><h4>Using Windows Authentication</h4><p>Windows Authentication means logging into the SQL Server instance with your local Windows account’s credentials. For this to work,<em> a DLL is required on your java class path</em>.</p><p>The easiest way to accomplish this is to <a href="https://learn.microsoft.com/en-us/sql/connect/jdbc/release-notes-for-the-jdbc-driver?view=sql-server-ver16">download the DLL from the Microsoft website</a> and plonk it in the java/lib folder.</p><p>You can find the java directory by executing “<strong>where java”</strong> in a command prompt window:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*uCZGigitPdmdj-SzHoFQsg.png" /></figure><p>or by typing <strong>%java_home%</strong> into the search bar:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/1*K0rx2XYx2jdiVvf85vtcDw.png" /></figure><p>Then, with the DLL in place at, for example:</p><pre>C:\Program Files\AdoptOpenJDK\jdk-17.0.8+7\lib\mssql-jdbc_auth-12.4.2.x64.dll</pre><p>add <strong>integrated security</strong> to your connection string:</p><pre>spring:<br>  datasource:<br>    url: jdbc:sqlserver://someServer.co.za;trustServerCertificate=true;databaseName=someDatabase;encrypt=true;integratedSecurity=true</pre><p><em>Assuming SQL Server is set up to allow this user to log in using Windows Auth.</em></p><h4>Using SQL Authentication</h4><p>DLLs are Windows specific files, but more obvious than that, ‘<em>Windows Authentication</em>’ is not possible on a machine not running Windows (There are ways around it, using something like <a href="https://web.mit.edu/kerberos/">Kerberos</a> but that is out of the scope of this article). So, to log into a SQL Server from a Linux machine, or when you want to avoid using Windows Auth for whatever reason, using SQL Server Authentication is the way to go.</p><p>Update your spring data source to have a username and password, and make sure your connection string does NOT include integrated security:</p><pre>spring:<br>  datasource:<br>    url: jdbc:sqlserver://someServer.co.za;trustServerCertificate=true;databaseName=someDatabase;encrypt=true;<br>    username: username<br>    password: password</pre><p><em>Assuming SQL Server is set up to allow this user to log in using SQL Auth.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea4eb262e11b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generating API code with Java, Springboot and the OpenAPI Generator]]></title>
            <link>https://medium.com/@barendnieuwoudt/generating-api-code-with-java-springboot-and-the-openapi-generator-f2e232ea0612?source=rss-e396b780de1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2e232ea0612</guid>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[open-api]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[code-generation]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Barend Nieuwoudt]]></dc:creator>
            <pubDate>Tue, 19 Mar 2024 13:48:50 GMT</pubDate>
            <atom:updated>2024-03-19T20:43:55.054Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T4uKjXcsJVQFRoHB8QqPfw.png" /></figure><p>Firstly, set up a new Java Springboot app. Head to the <a href="https://start.spring.io/">Spring Initializr</a> and make sure to add the <strong>Spring Web</strong> dependency.</p><p>Once you’ve downloaded and extracted your new project, to add the <a href="https://plugins.gradle.org/plugin/org.openapi.generator">OpenAPI plugin</a>, update the <strong>build.gradle</strong> file:</p><pre>plugins {<br> id &#39;java&#39;<br> id &#39;org.springframework.boot&#39; version &#39;3.2.3&#39;<br> id &#39;io.spring.dependency-management&#39; version &#39;1.1.4&#39;<br> id &#39;org.openapi.generator&#39; version &#39;7.4.0&#39;<br>}</pre><p>Now add a new task to perform the code generation:</p><pre>openApiGenerate {<br>    inputSpec.set(&quot;$rootDir/src/main/resources/yaml/apispec.yaml&quot;)<br>    generatorName = &quot;spring&quot;<br>}</pre><p>Here, my YAML spec is stored in the src/main/resources/yaml folder. Update yours to have the correct path to the spec.</p><p>Now, to perform the code generation, execute the following command in the root directory of your project:</p><pre>gradlew openApiGenerate</pre><p>Once the task was performed successfully, the generated classes should be present in your build directory.</p><p>Technically, this is all you need to perform code generation, but this plugin is a lot more powerful. Firstly, I want to name the packages that the code is generated into, by updating the openApiGenerate task:</p><pre>openApiGenerate {<br> inputSpec.set(&quot;$rootDir/src/main/resources/yaml/apispec.yaml&quot;)<br> generatorName = &quot;spring&quot;<br> apiPackage = &quot;co.za.project.api&quot;<br> invokerPackage = &quot;co.za.project.api&quot;<br> modelPackage = &quot;co.za.project.model&quot;<br>}</pre><p>For a full list of configuration options, visit the <a href="https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/README.adoc">OpenAPI Plugin’s Github</a> page. For an example of a YAML Spec, check out the <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/petstore.yaml">petstore.yaml</a>.</p><h4>Example build.gradle:</h4><pre>plugins {<br> id &#39;java&#39;<br> id &#39;org.springframework.boot&#39; version &#39;3.2.3&#39;<br> id &#39;io.spring.dependency-management&#39; version &#39;1.1.4&#39;<br> id &#39;org.openapi.generator&#39; version &#39;7.4.0&#39;<br>}<br><br>group = &#39;co.za.api&#39;<br>version = &#39;0.0.1-SNAPSHOT&#39;<br><br>java {<br> sourceCompatibility = &#39;21&#39;<br>}<br><br>repositories {<br> mavenCentral()<br>}<br><br>dependencies {<br> implementation &#39;org.springframework.boot:spring-boot-starter-web&#39;<br> testImplementation &#39;org.springframework.boot:spring-boot-starter-test&#39;<br>}<br><br>tasks.named(&#39;test&#39;) {<br> useJUnitPlatform()<br>}<br><br>openApiGenerate {<br> inputSpec.set(&quot;$rootDir/src/main/resources/yaml/apispec.yaml&quot;)<br> generatorName = &quot;spring&quot;<br> apiPackage = &quot;co.za.project.api&quot;<br> invokerPackage = &quot;co.za.project.api&quot;<br> modelPackage = &quot;co.za.project.model&quot;<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2e232ea0612" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[@WebFluxTest vs @SpringBootTest]]></title>
            <link>https://medium.com/@barendnieuwoudt/webfluxtest-vs-springboottest-e62753910039?source=rss-e396b780de1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e62753910039</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Barend Nieuwoudt]]></dc:creator>
            <pubDate>Tue, 20 Feb 2024 08:14:10 GMT</pubDate>
            <atom:updated>2024-02-20T08:14:10.248Z</atom:updated>
            <content:encoded><![CDATA[<p>Spring Boot provides both <a href="https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/context/SpringBootTest.html">@SpringBootTest </a>and <a href="https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTest.html">@WebFluxTest</a> for creating testcases and the use of each will be better suited to different scenarios.</p><p>Firstly, consider the difference between a unit test and an integration test: A <strong>unit test</strong> is an automated or manual test of a smaller piece of code, often the smallest testable section. These pieces of code could be a single function or method, called a ‘unit’. <strong>Integration tests</strong> are automated or manual tests that test the integration of several smaller units.</p><p><a href="https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/context/SpringBootTest.html">@SpringBootTest</a> will create an entire application context, making it better suited for integration tests. This annotation loads a full application context similar to how the application would have started normally, which is useful for tests that go through multiple layers of the application. Injecting all the beans will mean doing more work; This is necessary for testing multiple layers, but makes the execution of each test slow and more resource hungry.</p><p>Spring Boot also allows for testing different layers in isolation: <a href="https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTest.html">@WebFluxTest</a>, similar to <a href="https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTest.html">@WebMvcTest</a>, is used to test the WebFlux controllers. <a href="https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTest.html">@WebFluxTest</a> will load @Controller, @ControllerAdvice, and a couple more beans, but will NOT load all the @Component beans. Additional required components can be added with the @Import annotation and <a href="https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/mock/mockito/MockBean.html">@MockBean</a> can provide mock implementations where necessary. This makes <a href="https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTest.html">@WebFluxTest</a> better suited to create unit tests for controllers since it doesn’t load the entire application context and only applies configuration relevant to the tests.</p><p>Technically, you can create unit tests annotated with <a href="https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/context/SpringBootTest.html">@SpringBootTest</a> and mock the first layer beyond the controller class, but this would be very wasteful of resources. To save resources during unit test execution, Spring Boot has lots of ways to test different slices of the application: see the other <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/test-auto-configuration.html#appendix.test-auto-configuration">Test Auto-configuration Annotations</a> for more annotations to test slices in isolation.</p><p>For more information on how to use @WebFluxTest, see <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.testing.spring-boot-applications.spring-webflux-tests">Auto-configured Spring WebFlux Tests</a>. Also read up on the <a href="https://docs.spring.io/spring-framework/reference/testing/webtestclient.html">WebTestClient</a>. Good Luck.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*1MUh4f7PLZWBflK-UBcOZw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e62753910039" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>