<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>principles Archives - Fluent C++</title>
	<atom:link href="https://www.fluentcpp.com/tag/principles/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/tag/principles/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Fri, 10 Feb 2023 09:01:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.4</generator>
<site xmlns="com-wordpress:feed-additions:1">214950964</site>	<item>
		<title>Design Patterns VS Design Principles: Abstract Factory</title>
		<link>https://www.fluentcpp.com/2022/04/06/design-patterns-vs-design-principles-abstract-factory/</link>
		
		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Wed, 06 Apr 2022 01:00:50 +0000</pubDate>
				<category><![CDATA[Expressive code]]></category>
		<category><![CDATA[abstract factory]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[GoF]]></category>
		<category><![CDATA[grasp]]></category>
		<category><![CDATA[principles]]></category>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=5975</guid>

					<description><![CDATA[<p>In the &#8220;Design Pattens VS Design Principles&#8221; series, we look at design patterns and relate them to design principles. In this episode, we examine the Abstract Factory pattern. Let&#8217;s see how Abstract Factory works and what it is useful for, then relate it to a design principle. We will also see a C++ technique to [&#8230;]</p>
<p>The post <a href="https://www.fluentcpp.com/2022/04/06/design-patterns-vs-design-principles-abstract-factory/">Design Patterns VS Design Principles: Abstract Factory</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In the &#8220;Design Pattens VS Design Principles&#8221; series, we look at design patterns and relate them to design principles. In this episode, we examine the <strong>Abstract Factory</strong> pattern.</p>
<p>Let&#8217;s see how Abstract Factory works and what it is useful for, then relate it to a design principle. We will also see a C++ technique to implement Abstract Factory with classes nested in a function.</p>
<h3><span style="color: #ff6600;">Design Patterns and Design Principles</span></h3>
<p>What is the difference between design patterns and design principles?</p>
<p>The design patterns we talk about are the collection of patterns described in the popular <a href="https://www.amazon.com/gp/product/0201633612/ref=as_li_qf_asin_il_tl?ie=UTF8&amp;tag=fluentcpp-20&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=0201633612&amp;linkId=8d82c9d9fb2521a0d54f2f07c0bc12e0">GoF book</a>:</p>
<p><a href="https://www.amazon.com/gp/product/0201633612/ref=as_li_qf_asin_il_tl?ie=UTF8&amp;tag=fluentcpp-20&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=0201633612&amp;linkId=8d82c9d9fb2521a0d54f2f07c0bc12e0"><img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-5042" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/05/design_patterns_book.jpg?resize=400%2C503&#038;ssl=1" alt="design patterns book GoF" width="400" height="503" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/05/design_patterns_book.jpg?w=400&amp;ssl=1 400w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/05/design_patterns_book.jpg?resize=119%2C150&amp;ssl=1 119w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/05/design_patterns_book.jpg?resize=239%2C300&amp;ssl=1 239w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/05/design_patterns_book.jpg?resize=25%2C32&amp;ssl=1 25w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/05/design_patterns_book.jpg?resize=80%2C100&amp;ssl=1 80w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/05/design_patterns_book.jpg?resize=160%2C201&amp;ssl=1 160w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/05/design_patterns_book.jpg?resize=318%2C400&amp;ssl=1 318w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/05/design_patterns_book.jpg?resize=350%2C440&amp;ssl=1 350w" sizes="(max-width: 400px) 100vw, 400px" data-recalc-dims="1" /></a></p>
<p>Design patterns are typical ways to organise the components of a program in typical situations.</p>
<p>Design principles, on the other hand, are general guidelines te help create robust designs. The 9 GRASP principles are described in Craig Larman&#8217;s <a href="https://www.amazon.com/gp/product/0131489062/ref=as_li_qf_asin_il_tl?ie=UTF8&amp;tag=fluentcpp-20&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=0131489062&amp;linkId=c8f9976423d1df2c59c9acd303a2ff14">Applying UML and Patterns</a> book:</p>
<p><a href="https://www.amazon.com/gp/product/0131489062/ref=as_li_qf_asin_il_tl?ie=UTF8&amp;tag=fluentcpp-20&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=0131489062&amp;linkId=c8f9976423d1df2c59c9acd303a2ff14"><img decoding="async" class="aligncenter size-full wp-image-4971" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=400%2C500&#038;ssl=1" alt="Applying UML and Patterns" width="400" height="500" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?w=400&amp;ssl=1 400w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=120%2C150&amp;ssl=1 120w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=240%2C300&amp;ssl=1 240w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=26%2C32&amp;ssl=1 26w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=80%2C100&amp;ssl=1 80w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=161%2C201&amp;ssl=1 161w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=320%2C400&amp;ssl=1 320w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=352%2C440&amp;ssl=1 352w" sizes="(max-width: 400px) 100vw, 400px" data-recalc-dims="1" /></a></p>
<p>The <a href="https://www.fluentcpp.com/2021/06/23/grasp-9-must-know-design-principles-for-code/">9 GRASP design principles</a> are:</p>
<ul>
<li>Low Coupling</li>
<li>High cohesion</li>
<li>Creator</li>
<li>Information expert</li>
<li>Polymorphism</li>
<li>Indirection</li>
<li>Protected Variations</li>
<li>Pure Fabrication</li>
<li>Controller</li>
</ul>
<p>Let&#8217;s analyse the GoF design pattern <strong>Abstract Factory</strong>, and decide to which GRASP principle it relates the most.</p>
<h3><span style="color: #ff6600;">What Abstract Factory is useful for</span></h3>
<p>The goal of the Abstract Factory pattern is to make sure that objects are created consistently with each other.</p>
<p>This need arises when several objects can be created in a context, and there are several ways to create those objects. The GoF books uses the term of &#8220;family&#8221;: there are several families of objects. You can also see it as if there were several <strong>brands</strong> of objects, and in a given context you want all objects to be created <strong>of the same brand</strong>.</p>
<p>To do that, the Abstract Factory pattern consists in assigning to one class the responsibility of creating all the objects of a given family or brand.</p>
<h4><span style="color: #ff6600;">Concrete factories</span></h4>
<p>Let&#8217;s illustrate with a simple example, with an Abstract Factory that builds the parts of a house. In practice, the objects we create in code are more abstract (I&#8217;ve used Abstract Factory to create objects related to transactions for example), but let&#8217;s use this simple example to illustrate the structure of the pattern.</p>
<p>The objects we want to create are a door, a roof and a wall. There are several types of houses: blue houses, red houses, and yellow houses. And there may be more of them.</p>
<p>When we build a blue house, we want to make sure that all its components are blue. If we were to instantiate each object separately, each time there would be a risk of not instantiating the right type.</p>
<p>To mitigate that risk, we instantiate only one object: the blue house factory. Then we only use this object to create the others. This means that if we get the right factory, we&#8217;re guaranteed to get all the components of the right color too.</p>
<pre class="lang:c++ decode:true">BlueHouseFactory
{
    Door createDoor() const; // this returns a blue door
    Roof createRoof() const; // this returns a blue roof
    Wall createWall() const; // this returns a blue wall
};</pre>
<p>Note that this is a simple factory that doesn&#8217;t use polymorphism on the objects it creates (<code>Door</code>, etc.). Indeed, there could also be polymorphism in the objects that the factory creates:</p>
<pre class="lang:c++ decode:true">class BlueHouseFactory
{
public:
    std::unique_ptr&lt;Door&gt; createDoor() const; // this returns a blue door
    std::unique_ptr&lt;Roof&gt; createRoof() const; // this returns a blue roof
    std::unique_ptr&lt;Wall&gt; createWall() const; // this returns a blue wall
};</pre>
<p>With subclasses for each object:</p>
<pre class="lang:c++ decode:true">class BlueDoor : public Door
{
    // ...
};</pre>
<p>And the code for <code>createDoor</code> would then look like this:</p>
<pre class="lang:c++ decode:true">std::unique_ptr&lt;Door&gt; BlueHouseFactory::createDoor()
{
    return std::make_unique&lt;BlueDoor&gt;();
}</pre>
<h4><span style="color: #ff6600;">Abstract Factory</span></h4>
<p>Now we have one factory, that creates blue components. We go on and introduce other factories, that create other types of components: the <code>RedHouseFactory</code> and the <code>YellowHouseFactory</code>.</p>
<p>The goal is to use only one factory in a given context. To do that, we introduce an abstract factory, that can be either one of the above factories:</p>
<pre class="lang:c++ decode:true">class HouseFactory
{
public:
    virtual std::unique_ptr&lt;Door&gt; createDoor() const = 0;
    virtual std::unique_ptr&lt;Roof&gt; createRoof() const = 0;
    virtual std::unique_ptr&lt;Wall&gt; createWall() const = 0;
    virtual ~HouseFactory() = 0;
};</pre>
<p>The concrete factories then implement this interface:</p>
<pre class="lang:c++ decode:true ">class BlueHouseFactory : public HouseFactory
{
public:
    std::unique_ptr&lt;Door&gt; createDoor() const override; // this returns a blue door
    std::unique_ptr&lt;Roof&gt; createRoof() const override; // this returns a blue roof
    std::unique_ptr&lt;Wall&gt; createWall() const override; // this returns a blue wall
};

class RedHouseFactory : public HouseFactory
{
public:
    std::unique_ptr&lt;Door&gt; createDoor() const override; // this returns a red door
    std::unique_ptr&lt;Roof&gt; createRoof() const override; // this returns a red roof
    std::unique_ptr&lt;Wall&gt; createWall() const override; // this returns a red wall
};

class YellowHouseFactory : public HouseFactory
{
public:
    std::unique_ptr&lt;Door&gt; createDoor() const override; // this returns a yellow door
    std::unique_ptr&lt;Roof&gt; createRoof() const override; // this returns a yellow roof
    std::unique_ptr&lt;Wall&gt; createWall() const override; // this returns a yellow wall
};</pre>
<h3><span style="color: #ff6600;">Creating the factory</span></h3>
<p>The factory is made to create objects, but who creates the factory?</p>
<p>There are various ways to do that. One of them is to instantiate various concrete factories in various places of the code, depending on the context. Given a function that uses a factory:</p>
<pre class="lang:c++ decode:true ">House buildAHouse(HouseFactory const&amp; houseFactory);</pre>
<p>We could call this fonction with a concrete factory if we know which one to use:</p>
<pre class="lang:c++ decode:true">auto const blueHouse = buildAHouse(BlueHouseFactory{});</pre>
<p>Another option is to centralise the creation of the factory, in a function (that happens to follow another design pattern, Factory Method, which we&#8217;ll explore in another post):</p>
<pre class="lang:c++ decode:true">std::unique_ptr&lt;HouseFactory&gt; createHouseFactory(Color color)
{
    switch (color)
    {
        case Color::Blue:
        {
            return std::unique_ptr&lt;BlueHouseFactory&gt;{};
            break;
        }
        case Color::Red:
        {
            return std::unique_ptr&lt;RedHouseFactory&gt;{};
            break;
        }
        case Color::Yellow:
        default:
        {
            return std::unique_ptr&lt;YellowHouseFactory&gt;{};
            break;
        }
    }
}</pre>
<p>This has the drawback of having to deal with the <code>default</code> case (Should we have a default color as in the above code? Should we produce an error? Or return a nullptr that we test everywhere?).</p>
<p>If you centralise the creation of the factory, know that C++ gives you the option to centralise the definitions of the factories along with them, by using classes nested in a function:</p>
<pre class="lang:c++ decode:true ">std::unique_ptr&lt;HouseFactory&gt; createHouseFactory(Color color)
{
    switch (color)
    {
        case Color::Blue:
        {
            class BlueHouseFactory : public HouseFactory
            {
            public:
                std::unique_ptr&lt;Door&gt; createDoor() const override { return std::make_unique&lt;BlueDoor&gt;(); };
                std::unique_ptr&lt;Roof&gt; createRoof() const override { return std::make_unique&lt;BlueRoof&gt;(); };
                std::unique_ptr&lt;Wall&gt; createWall() const override { return std::make_unique&lt;BlueWall&gt;(); };
            };

            return std::unique_ptr&lt;BlueHouseFactory&gt;{};
            break;
        }

        case Color::Red:
        {
            class RedHouseFactory : public HouseFactory
            {
            public:
                std::unique_ptr&lt;Door&gt; createDoor() const override { return std::make_unique&lt;RedDoor&gt;(); };
                std::unique_ptr&lt;Roof&gt; createRoof() const override { return std::make_unique&lt;RedRoof&gt;(); };
                std::unique_ptr&lt;Wall&gt; createWall() const override { return std::make_unique&lt;RedWall&gt;(); };
            };

            return std::unique_ptr&lt;RedHouseFactory&gt;{};
            break;
        }

        case Color::Yellow:
        default:
        {
            class YellowHouseFactory : public HouseFactory
            {
            public:
                std::unique_ptr&lt;Door&gt; createDoor() const override { return std::make_unique&lt;YellowDoor&gt;(); };
                std::unique_ptr&lt;Roof&gt; createRoof() const override { return std::make_unique&lt;YellowRoof&gt;(); };
                std::unique_ptr&lt;Wall&gt; createWall() const override { return std::make_unique&lt;YellowWall&gt;(); };
            };

            return std::unique_ptr&lt;YellowHouseFactory&gt;{};
            break;
        }
    }
}</pre>
<p>An advantage of this is that all the factory code is located together, and you&#8217;re guaranteed that no other code can instantiate a <code>BlueHouseFactory</code>, because they don&#8217;t have access to that class.</p>
<p>But as a drawback, it makes the factory creation fonction bigger. If the implementations of the factories are not very simple, this makes the code hard to follow.</p>
<h3><span style="color: #ff6600;"><span style="caret-color: #ff6600;">Design principles</span></span></h3>
<p>The role of Abstract Factory is to present an interface for creating objects, that is implemented by various concrete factories. For this reason, I think Abstract Factory implements the <strong>Polymorphism</strong> GRASP design principle.</p>
<p>Also, the factory often doesn&#8217;t model a domain object. It is a technical helper to centralise the creation of consistent objects. This also makes it a <strong>Pure Fabrication</strong>.</p>
<p>Doesn&#8217;t Abstract Factory also implement the Creator GRASP design principle? Given its name, this is what I would have thought before digging in the analysis.</p>
<p>But if we go back to the definition of Creator, it suggests that B should create A if B is close to A: if it uses A, if it has inputs to create A, if it already contains other instances of A, etc. This does not match the description of Abstract Factory as well as Polymorphism does.</p>
<p>Would you also have reacted Abstract Factory to Polymorphism and Pure Fabrication, or to another one?</p>
<p>Do you know of creational patterns that are not in the GoF book?</p>
<p>Let me know by leaving a comment below.</p>
<h3><span style="color: #000000;">You will also like</span></h3>
<ul>
<li><a href="https://www.fluentcpp.com/2021/07/01/minor-major-and-overarching-design-principles/">Minor, Major and Overarching Design Principles</a></li>
<li><a href="https://www.fluentcpp.com/2021/06/23/grasp-9-must-know-design-principles-for-code/">GRASP: 9 Must-Know Design Principles for Code</a></li>
<li><a href="https://www.fluentcpp.com/2021/07/26/design-patterns-vs-design-principles-chain-of-responsibility-command-and-interpreter/">esign Patterns VS Design Principles: Chain of responsibility, Command and Interpreter</a></li>
<li><a href="https://www.fluentcpp.com/2021/09/12/design-patterns-vs-design-principles-iterator-mediator-and-memento/">Design Patterns VS Design Principles: Iterator, Mediator and Memento</a></li>
<li><a href="https://www.fluentcpp.com/2021/10/19/design-patterns-vs-design-principles-observer-state-and-strategy/">Design Patterns VS Design Principles: Observer, State and Strategy</a></li>
</ul>
Don't want to miss out ? <strong>Follow:</strong> &nbsp&nbsp<a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Follow me on twitter" href="https://twitter.com/joboccara" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img decoding="async" alt="twitter" title="Follow me on twitter" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Find us on Linkedin" href="https://www.linkedin.com/in/jonathan-boccara-23826921/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Find us on Linkedin" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-rss nolightbox" data-provider="rss" target="_blank" rel="nofollow" title="Subscribe to our RSS Feed" href="https://www.fluentcpp.com/feed/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="rss" title="Subscribe to our RSS Feed" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/rss.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><br/>Share this post!<a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox" data-provider="facebook" target="_blank" rel="nofollow" title="Check out this post from Fluent C++" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.fluentcpp.com%2F2022%2F04%2F06%2Fdesign-patterns-vs-design-principles-abstract-factory%2F&#038;t=Design%20Patterns%20VS%20Design%20Principles%3A%20Abstract%20Factory&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.fluentcpp.com%2F2022%2F04%2F06%2Fdesign-patterns-vs-design-principles-abstract-factory%2F&#038;p&#091;images&#093;&#091;0&#093;=https%3A%2F%2Fwww.fluentcpp.com%2Fwp-content%2Fuploads%2F2019%2F05%2Fdesign_patterns_book.jpg&#038;p&#091;title&#093;=Design%20Patterns%20VS%20Design%20Principles%3A%20Abstract%20Factory" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="Facebook" title="Check out this post from Fluent C++" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Tweet about this" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.fluentcpp.com%2F2022%2F04%2F06%2Fdesign-patterns-vs-design-principles-abstract-factory%2F&#038;text=Check%20out%20this%20post%20from%20Fluent%20C%2B%2B" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Tweet about this" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.fluentcpp.com%2F2022%2F04%2F06%2Fdesign-patterns-vs-design-principles-abstract-factory%2F&#038;title=Design%20Patterns%20VS%20Design%20Principles%3A%20Abstract%20Factory" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Share on Linkedin" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><p>The post <a href="https://www.fluentcpp.com/2022/04/06/design-patterns-vs-design-principles-abstract-factory/">Design Patterns VS Design Principles: Abstract Factory</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">5975</post-id>	</item>
		<item>
		<title>GRASP: 9 Must-Know Design Principles for Code</title>
		<link>https://www.fluentcpp.com/2021/06/23/grasp-9-must-know-design-principles-for-code/</link>
		
		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Wed, 23 Jun 2021 01:00:51 +0000</pubDate>
				<category><![CDATA[Expressive code]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[expressive]]></category>
		<category><![CDATA[grasp]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[principles]]></category>
		<category><![CDATA[responsibility]]></category>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=4970</guid>

					<description><![CDATA[<p>In order to write code that is understandable, maintainable and that stands the test of time, one of the crucial skills that we all need to have is design. What does code design mean? In my definition, doing code design means deciding which class (or more generally which component) is in charge of which responsibility. [&#8230;]</p>
<p>The post <a href="https://www.fluentcpp.com/2021/06/23/grasp-9-must-know-design-principles-for-code/">GRASP: 9 Must-Know Design Principles for Code</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In order to write code that is understandable, maintainable and that stands the test of time, one of the crucial skills that we all need to have is <strong>design</strong>.</p>
<p>What does code design mean? In my definition, doing code design means deciding which class (or more generally which component) is in charge of which responsibility.</p>
<p>The reason why this is so crucial is because, according to the above definition, code that is well designed is consistent and well organised, and code that is poorly designed is essentially a mess.</p>
<p>And understanding, adding or fixing something in a well organised structure is, as you can imagine, easier that in a mess.</p>
<h3><span style="color: #ff6600;">The need for Patterns</span></h3>
<p>Being able to decide where to assign any given responsibility is a make-or-break skill for your code. But how do we do that?</p>
<p>With Experience, of course!</p>
<p>After years of trials and errors, after paying the high prices of your design mistakes, after living in a messy code, you will end up realizing that some design choices tend to work better than others.</p>
<p>Or there is an easier way: capitalizing on the experience of others.</p>
<p>The question of choosing where to assign a responsibility in code has been around for decades, and has been thought over by thousands and thousands of developers in their day-to-day code. Probably thousands and thousands of mistakes have been made, and as many lessons have been drawn from those mistakes.</p>
<p>If we could benefit from this <code>std::accumulate</code>d experience, then we would stand on the shoulders of giants.</p>
<p>Luckily for us, a lot of this wisdom is available to us, and what&#8217;s more, synthesized into manageable bits that we can apply in our everyday life while coding: <strong>design principles</strong>.</p>
<p>Design principles are guidelines that help us take the right decisions when assigning responsibilities in our code.</p>
<p>There is a set of 9 such design principles: <strong>the GRASP principles</strong>.</p>
<h3><span style="color: #ff6600;">The book where I learnt the design principles</span></h3>
<p>GRASP stands for General Responsibility Assignment Software Principles. I think the words that carry the most meaning in this acronym are RA: <strong>Responsibility Assignment</strong>. This is exactly what we&#8217;re talking about.</p>
<p>I learnt those principle in Craig Larman&#8217;s book <a href="https://www.amazon.com/gp/product/0131489062/ref=as_li_qf_asin_il_tl?ie=UTF8&amp;tag=fluentcpp-20&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=0131489062&amp;linkId=43cfc4d0a6ea922ef663317e4f91db85">Applying UML and Patterns</a>:</p>
<p><a href="https://www.amazon.com/gp/product/0131489062/ref=as_li_qf_asin_il_tl?ie=UTF8&amp;tag=fluentcpp-20&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=0131489062&amp;linkId=43cfc4d0a6ea922ef663317e4f91db85"><img loading="lazy" decoding="async" class="aligncenter wp-image-4971 size-full" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=400%2C500&#038;ssl=1" alt="Applying UML and Patterns" width="400" height="500" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?w=400&amp;ssl=1 400w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=120%2C150&amp;ssl=1 120w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=240%2C300&amp;ssl=1 240w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=26%2C32&amp;ssl=1 26w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=80%2C100&amp;ssl=1 80w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=161%2C201&amp;ssl=1 161w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=320%2C400&amp;ssl=1 320w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2019/04/51gVLEtrCNL._SX398_BO1204203200_.jpg?resize=352%2C440&amp;ssl=1 352w" sizes="(max-width: 400px) 100vw, 400px" data-recalc-dims="1" /></a></p>
<p>Even though the book title mentions UML, the book is about object-oriented design in general, as Martin Fowler praised (this is on the book cover): &#8220;People often ask me which is the best book to introduce them to the world of OO design. Ever since I came across it, <em>Applying UML and Patterns</em> has been my unreserved choice.&#8221;</p>
<p>I recommend that you read at least the parts about the GRASP patterns in this book, if not all of it.</p>
<p>Let me go further: even if you should read both, I think that GRASP principles are a more useful reading than the popular <a href="https://www.amazon.com/gp/product/0201633612/ref=as_li_qf_asin_il_tl?ie=UTF8&amp;tag=fluentcpp-20&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=0201633612&amp;linkId=30b9beea99b2068229ea70a52b729838">GoF design patterns</a>.</p>
<p>Why such a bold statement?</p>
<ul>
<li>The GRASP principles will let you understand the rationale behind the GoF design patterns,</li>
<li>Some GoF design patterns are obscure and not used often (at least in my experience, take the &#8220;Bridge&#8221; pattern for example),</li>
<li>Some GoF patterns should be avoided most of the time (for example the &#8220;Singleton&#8221; pattern, which is essentially a global variable with no copy constructor),</li>
<li>You can apply the GRASP pattern to other things than classes. And with free functions being idiomatic to C++, this is particularly relevant for C++ developers.</li>
</ul>
<p>Ssome of the GoF design patterns <em>are</em> indeed necessary to know (&#8220;Strategy&#8221; for example), so you should also read the GoF book (especially since it contains more than just a design patterns catalogue). But to me, GRASP is a more fundamental topic to read about.</p>
<h3><span style="color: #ff6600;">The GRASP patterns</span></h3>
<p>Let&#8217;s see what the 9 GRASP patterns are. I&#8217;ll make a brief summary of each one, and you can refer to the above book for more detailed discussions and examples.</p>
<h4><span style="color: #ff6600;">Information expert</span></h4>
<p>Let&#8217;s start by one that is quite natural: <strong>information expert</strong>. This principle recommends that if you have an operation to do, and this operations needs inputs, then you should consider putting the responsibility of carrying out this operation in the class that contains the inputs for it.</p>
<p>This helps keeping the data local, because if you put the operation somewhere else then the inputs will have to be carried over there, creating a relationship between the class that holds the input data (the &#8220;information expert&#8221;) and that new place. This would create coupling and be detrimental for encapsulation, thus creating complexity.</p>
<p>Granted, it&#8217;s a natural thing to do. But formalizing this as a principle still has several benefits. For example, if you feel that a design is not quite right, thinking about the information expert principle can help you pinpoint what was disturbing you in it. Also, it helps expressing your remarks in a code review.</p>
<h4><span style="color: #ff6600;">Creator</span></h4>
<p>The Creator principle gives guidelines as to which class B should be in charge of creating a certain type of objects A. The principle contains a set of rules, such as:</p>
<ul>
<li>B contains or aggregates instances of A</li>
<li>B closely uses A</li>
<li>B has the inputs to construct A</li>
<li>and so on</li>
</ul>
<p>The more rules are fulfilled, the better B is suited to instantiate objects of type A.</p>
<p>This goes a further than Information expert: it&#8217;s not just about having the input of the operation of construction, it&#8217;s about being &#8220;close&#8221; to the operation.</p>
<p>If you put together two part of the code that are semantically close (the construction of A, and the code that works a lot with A), then they become easier to reason about than if they were far apart.</p>
<h4><span style="color: #ff6600;">Low coupling</span></h4>
<p>Coupling happens between two parts of the code when one depends on the other. Coupling introduces complexity, if only because the code can then no longer be understood isolation.</p>
<p>Such dependencies can be explicit, in terms of a function call for example, and that&#8217;s unavoidable and often OK.</p>
<p>But other types of coupling are less sane and less visible, for example when a part of the code expects that another part has set a data member to a certain value.</p>
<p>The design principle of low coupling encourages to keep coupling low, and it can help in particular to choose between two designs: select the one that introduces the lower amount of coupling.</p>
<p>For more details about the various types of coupling and the various types of problems that coupling generates, refer to this <a href="https://www.fluentcpp.com/2019/12/31/the-dangers-of-coupling-and-how-to-avoid-them/">dedicated article on coupling</a>.</p>
<h4><span style="color: #ff6600;">Protected variations</span></h4>
<p>The principle of Protected variations is related to the one of Low coupling, because it helps reducing the impacts of the changes of the code of one part A on another part B. The code of part B is <strong>protected</strong> against the <strong>variations</strong> of the code of part A, hence the name of the pattern.</p>
<p>How do you achieve such a protection? By organizing the responsibilities around <strong>stable interfaces</strong>.</p>
<p>This is particularly relevant for code that tends to change often. Introducing an interface between this unstable part of the code and the rest of the codebase helps limiting the rippling effects of those frequent changes.</p>
<p>The principle of protected variations is, according to my understanding, very close to the concept of &#8220;anti-corruption layer&#8221; from <a href="https://www.amazon.com/gp/product/0321125215/ref=as_li_qf_asin_il_tl?ie=UTF8&amp;tag=fluentcpp-20&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=0321125215&amp;linkId=5e7f9b4a2e8fda8e97dc7ba19deed1be">Domain Driven Design</a>.</p>
<h4><span style="color: #ff6600;">Indirection</span></h4>
<p>The Indirection pattern is another way to reduce coupling by creating an intermediary class (or any kind of component) between two classes A and B. This way, the changes in each one of A and B don&#8217;t affect the other one. The intermediary class absorbs the impact by adapting its code rather than A or B (or more other classes).</p>
<p>This relates a lot to the Adapter design pattern, even though the Adapter design pattern is rather made to connect two existing incompatible interfaces. But it also has the effect of protecting each one against the changes of the other.</p>
<p>Indirection looks a bit like Protected variations, as they both introduce a layer between components in order to reduce coupling.</p>
<p>According to my understanding, the difference between Protected variations and Indirection is that Protected variations is about designing interfaces in the existing components, whereas Indirection is about introducing a new component in the middle.</p>
<h4><span style="color: #ff6600;">Polymorphism</span></h4>
<p>The <strong>Polymorphism</strong> principle is an exhortation to use&#8230; polymorphism in your code.</p>
<p>Polymorphism is often seen as having a base class with virtual methods that defines an interface, and derived classes implementing this interface, but this is only one type of polymorphism. There are plenty of types of polymorphism (including templates for example) and I hope we&#8217;ll get to dive into this topic at some point on Fluent C++.</p>
<p>The usage for polymorsphism is when there are several ways to accomplish a task, and you want to decouple the clients of this task from the various pieces of code that implement the various ways to perform it.</p>
<p>The Polymorphism principle is very close to the GoF Strategy pattern, if not identical. It contributes to the Low Coupling principle.</p>
<h4><span style="color: #ff6600;">High cohesion</span></h4>
<p>The principle of High cohesion encourages to focus classes around one responsibility, and to have all its components oriented towards achieving this responsibility. This is the principle of &#8220;do one thing and do it well&#8221;.</p>
<p>The principle of high cohesion also applies to other elements of the code, such as functions, and also modules and systems.</p>
<p>This ties back well with the idea of having a well-organized code: a highly cohesive component lets you label it in your mind with &#8220;this is the part of the code that does X&#8221;. This allows better mental abstractions as well as <a href="https://www.fluentcpp.com/2016/12/15/respect-levels-of-abstraction/">code abstractions</a>.</p>
<h4><span style="color: #ff6600;">Pure fabrication</span></h4>
<p>It is natural to represent in our code objects that map the reality of the domain that we&#8217;re trying to model. For example, if you&#8217;re working on a financial application, you can probably expect to encounter some classes called <code>Transaction</code> or <code>Portfolio</code> in the code.</p>
<p>But sometimes you have a responsibility to assign, and it seems to not fit well in any domain class. And according to the principle of High cohesion above, you shouldn&#8217;t force a responsibility into a class that is already doing something else.</p>
<p>That&#8217;s when the principle of <strong>Pure fabrication</strong> comes into play: create a class that does not map to a domain object, and let it achieve this new responsibility in a cohesive way.</p>
<p>This principle is probably one of the hardest to guess, because it goes against our natural tendency to write code that represents the problem we&#8217;re trying to solve.</p>
<h4><span style="color: #ff6600;">Controller</span></h4>
<p>Here is an example of a pure fabrication: a UI <strong>Controller</strong>. This is such a common pattern that it was included in the 9 GRASP principles. Personal opinion: I would have kept this as an example of pure fabrication and not made a principle out of it.</p>
<p>The controller is the first non-UI component that receives the UI event and organizes the operations to react to this event. Indeed, that doesn&#8217;t map to any domain object, even if the UI itself can display domain concepts.</p>
<p>There are also other examples of pure fabrications in the GoF design patterns: for example, a Facade object is a pure fabrication.</p>
<h3><span style="color: #ff6600;">Some principles are more fundamental than others</span></h3>
<p>These were the 9 GRASP principles:</p>
<ul>
<li>Information expert</li>
<li>Creator</li>
<li>Low coupling</li>
<li>Protected variations</li>
<li>Indirection</li>
<li>Polymorphism</li>
<li>High cohesion</li>
<li>Pure fabrication</li>
<li>Controller</li>
</ul>
<p>Those principles are not all of the same type. Some of those are overarching principles of good design. Some are techniques to put those principles into practice. Some are merely examples.</p>
<p>Also, they relates to some GoF design patterns, sometimes closely and sometimes the GoF patterns are implementations of the GRASP patterns.</p>
<p>In the next post, we will try to relate the GRASP patterns together.</p>
<h3>You will also like</h3>
<ul>
<li><a href="https://www.fluentcpp.com/2016/12/15/respect-levels-of-abstraction/">It all comes down to respecting levels of abstraction</a></li>
<li><a href="https://www.fluentcpp.com/2017/06/30/insulating-a-toxic-api-from-the-rest-of-your-code/">How to Insulate a Toxic Api from the Rest of Your Code</a></li>
<li><a href="https://www.fluentcpp.com/2018/11/13/to-dry-or-not-to-dry/">To DRY or not to DRY?</a></li>
<li><a href="https://www.fluentcpp.com/2019/01/04/functional-programming-is-not-a-silver-bullet/">Functional Programming Is Not a Silver Bullet</a></li>
<li><a href="https://www.fluentcpp.com/2019/12/31/the-dangers-of-coupling-and-how-to-avoid-them/">The Dangers of Coupling and How to Avoid Them</a></li>
</ul>
Don't want to miss out ? <strong>Follow:</strong> &nbsp&nbsp<a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Follow me on twitter" href="https://twitter.com/joboccara" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Follow me on twitter" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Find us on Linkedin" href="https://www.linkedin.com/in/jonathan-boccara-23826921/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Find us on Linkedin" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-rss nolightbox" data-provider="rss" target="_blank" rel="nofollow" title="Subscribe to our RSS Feed" href="https://www.fluentcpp.com/feed/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="rss" title="Subscribe to our RSS Feed" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/rss.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><br/>Share this post!<a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox" data-provider="facebook" target="_blank" rel="nofollow" title="Check out this post from Fluent C++" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F06%2F23%2Fgrasp-9-must-know-design-principles-for-code%2F&#038;t=GRASP%3A%209%20Must-Know%20Design%20Principles%20for%20Code&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F06%2F23%2Fgrasp-9-must-know-design-principles-for-code%2F&#038;p&#091;images&#093;&#091;0&#093;=https%3A%2F%2Fwww.fluentcpp.com%2Fwp-content%2Fuploads%2F2019%2F04%2F51gVLEtrCNL._SX398_BO1204203200_.jpg&#038;p&#091;title&#093;=GRASP%3A%209%20Must-Know%20Design%20Principles%20for%20Code" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="Facebook" title="Check out this post from Fluent C++" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Tweet about this" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F06%2F23%2Fgrasp-9-must-know-design-principles-for-code%2F&#038;text=Check%20out%20this%20post%20from%20Fluent%20C%2B%2B" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img loading="lazy" decoding="async" alt="twitter" title="Tweet about this" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.fluentcpp.com%2F2021%2F06%2F23%2Fgrasp-9-must-know-design-principles-for-code%2F&#038;title=GRASP%3A%209%20Must-Know%20Design%20Principles%20for%20Code" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img loading="lazy" decoding="async" alt="linkedin" title="Share on Linkedin" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" data-recalc-dims="1" /></a><p>The post <a href="https://www.fluentcpp.com/2021/06/23/grasp-9-must-know-design-principles-for-code/">GRASP: 9 Must-Know Design Principles for Code</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4970</post-id>	</item>
	</channel>
</rss>
