<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Bit Mask on John Jr</title>
    <link>https://johnjr.dev/tags/bit-mask/</link>
    <description>Recent content in Bit Mask on John Jr</description>
    <generator>Hugo</generator>
    <language>en</language>
    <managingEditor>blog@johnjr.dev (John Jr)</managingEditor>
    <webMaster>blog@johnjr.dev (John Jr)</webMaster>
    <lastBuildDate>Mon, 10 Nov 2025 10:00:00 -0500</lastBuildDate>
    <atom:link href="https://johnjr.dev/tags/bit-mask/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Builder Design Pattern and Cyclomatic Complexity Reduction</title>
      <link>https://johnjr.dev/posts/builder-design-pattern-and-cyclomatic-complexity-reduction/</link>
      <pubDate>Mon, 10 Nov 2025 10:00:00 -0500</pubDate><author>blog@johnjr.dev (John Jr)</author>
      <guid>https://johnjr.dev/posts/builder-design-pattern-and-cyclomatic-complexity-reduction/</guid>
      <description>&lt;p&gt;In this post, I will explain in detail how I used the &lt;a href=&#34;https://en.wikipedia.org/wiki/Builder_pattern&#34;&gt;builder design pattern&lt;/a&gt; together with the &lt;a href=&#34;https://en.wikipedia.org/wiki/Bit_field&#34;&gt;bit mask field&lt;/a&gt; technique to reduce complexity. As a result, I decreased the &lt;a href=&#34;https://en.wikipedia.org/wiki/Cyclomatic_complexity&#34;&gt;cyclomatic complexity&lt;/a&gt; from 24 to 0 and reduced development time from hours to minutes.&lt;/p&gt;&#xA;&lt;p&gt;The rest of this post is organized as follows sections:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#the-problem&#34;&gt;&lt;strong&gt;The problem&lt;/strong&gt;&lt;/a&gt; explains the problem I was solving.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#creating-the-bit-mask-field&#34;&gt;&lt;strong&gt;Creating the bit mask field&lt;/strong&gt;&lt;/a&gt; presents a solution to the problem.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#cyclomatic-complexity&#34;&gt;&lt;strong&gt;Cyclomatic Complexity&lt;/strong&gt;&lt;/a&gt; discusses cyclomatic complexity and calculates this metric for the solution presented in the section above.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#builder-design-pattern&#34;&gt;&lt;strong&gt;Builder design pattern&lt;/strong&gt;&lt;/a&gt; explains the builder design pattern and describes the refactoring process that removed complexity.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#conclusion&#34;&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/a&gt; summarizes this post.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#references&#34;&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/a&gt; provides references related to the topics discussed here.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;All the examples shown here are in C++.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
