<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Software Design on Andrew Walsh</title><link>https://www.awalsh128.com/tags/software-design/</link><description>Recent content in Software Design on Andrew Walsh</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><copyright>© 2026 Andrew Walsh</copyright><lastBuildDate>Sat, 09 Oct 2021 00:00:00 -0700</lastBuildDate><atom:link href="https://www.awalsh128.com/tags/software-design/feed.xml" rel="self" type="application/rss+xml"/><item><title>Fluent C++ v0.1 Release</title><link>https://www.awalsh128.com/fluentcpp-v01-release/</link><pubDate>Sat, 09 Oct 2021 00:00:00 -0700</pubDate><guid>https://www.awalsh128.com/fluentcpp-v01-release/</guid><description>Fluent style querying for C++.</description></item><item><title>Log per class pattern.</title><link>https://www.awalsh128.com/log-per-class-pattern/</link><pubDate>Sun, 29 Mar 2015 00:00:00 -0700</pubDate><guid>https://www.awalsh128.com/log-per-class-pattern/</guid><description>&lt;h3 class="relative group"&gt;Rookie Moves&#10; &lt;div id="rookie-moves" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#rookie-moves" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h3&gt;&#10;&lt;p&gt;Awhile ago, I had originally created a single logger for each service and shared it statically across the&#10;application.&lt;/p&gt;</description></item><item><title>State behavioral pattern to the rescue.</title><link>https://www.awalsh128.com/state-behavioral-pattern-to-rescue/</link><pubDate>Mon, 17 Mar 2014 00:00:00 -0700</pubDate><guid>https://www.awalsh128.com/state-behavioral-pattern-to-rescue/</guid><description>&lt;h3 class="relative group"&gt;The Creeping Problem&#10; &lt;div id="the-creeping-problem" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-creeping-problem" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h3&gt;&#10;&lt;p&gt;I recently found myself developing a request-response style system, where the lifetime of a request could be&#10;interrupted at any moment. For most same process execution, like your average desktop application, this is a&#10;concern, but arises more often when dealing with multiple coordinated processes. My case ended up being the&#10;latter.&lt;/p&gt;</description></item><item><title>Namespaces for classes.</title><link>https://www.awalsh128.com/namespace-within-classes/</link><pubDate>Fri, 22 Jul 2011 00:00:00 -0700</pubDate><guid>https://www.awalsh128.com/namespace-within-classes/</guid><description>&lt;p&gt;When designing classes for outside use (eg. API) or as a library component for multiple applications,&#10;readability and easy element (field/function) selection is important. No developer likes hunting around for&#10;fields or functions; a legible and hierarchical organization of elements aids quicker turnaround time in code&#10;delivery.&lt;br&gt;&#10;&lt;br&gt;&#10;In some cases, a large class is needed that can possibly contain dozens or hundreds of elements. Naming&#10;convention can aid in this organization (ie. using common prefixes in field/function names) but are not&#10;inherent to the grammar of languages. Therefore, no semantic advantage can be taken from using these&#10;conventions.&lt;br&gt;&#10;&lt;br&gt;&#10;&lt;code&gt;class Store   ItemList clothingMensShirts   ItemList clothingMensShoes   ...   ItemList clothingWomensShirts   ItemList clothingWomensShoes   ...   ItemList hardwareToolsWrenches   ...   ItemList hardwareMaterialsWood   ...   ItemList electronicsGamesPCFallout3Copies   ...   ItemList electronicsAudioHeadphones   ...&lt;/code&gt;&lt;br&gt;&#10;&lt;br&gt;&#10;The current solution to the management of large classes is by using publicly exposed nested classes.&lt;br&gt;&#10;&lt;br&gt;&#10;&lt;code&gt;class Clothing inherits Department   ClothingSection mens   ...class Mens inherits ClothingSection   ItemList shirt   ItemList shoes   ...abstract class Store   ...   Department clothing   ...class IKEA inherits Store   ...IKEA newYorkStore = new IKEA();newYorkStore.buy(newYorkStore.clothing.mens.shirts[0]);&lt;/code&gt;&lt;br&gt;&#10;&lt;br&gt;&#10;This is a possible solution but also comes with it's own problems. Encapsulation of the nested class will not&#10;only hide information from the public user but also from the parent class as well. This can be problematic&#10;when designing an abstract class where the functions, that must be implemented, must also access non-public&#10;elements inside the nested. For example, in the store example, any data the top level class (Store) may want&#10;to access from the lower level ones (ClothingSection, ItemList) will be unavailable if that data must also be&#10;hidden from the public user.&lt;br&gt;&#10;&lt;br&gt;&#10;Also, the nested classes cannot be abstracted to require implementation from any inheriting class. Revisting&#10;the store example, this means that abstracting the ClothingSection class would require two new classes for one&#10;implementation. Creating not only a child Store but also a child ClothingSection class.&lt;br&gt;&#10;&lt;br&gt;&#10;Nested classes are helpful for creating logical hierarchies within a class or providing abstract functionality&#10;privately inside the class. Although, I would propose the use of namespacing inside a class instead. It would&#10;provide the logical hierarchy needed in a very simple way and allow for information sharing across the entire&#10;domain of the class. It would need a separate keyword though to prevent use outside of classes.&lt;br&gt;&#10;&lt;br&gt;&#10;&lt;code&gt;class Storeclassnamespace clothing   classnamespace mens      ItemList shirts      ItemList shoes      ...   ...   classnamespace womens      ItemList shirts      ItemList shoes      ...   ...   classnamespace hardware      classnamespace tools         ItemList wrenches         ...      ...      classnamespace materials         ItenList Wood         ...      ...   ...&lt;/code&gt;&lt;/p&gt;</description></item></channel></rss>