<?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 Perry Tribolet on Medium]]></title>
        <description><![CDATA[Stories by Perry Tribolet on Medium]]></description>
        <link>https://medium.com/@perrytribolet?source=rss-6f3fac704710------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*AYTcauZTDzdUSZYJ.jpg</url>
            <title>Stories by Perry Tribolet on Medium</title>
            <link>https://medium.com/@perrytribolet?source=rss-6f3fac704710------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 22:41:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@perrytribolet/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[The Recipe Design Pattern]]></title>
            <link>https://medium.com/@perrytribolet/the-recipe-design-pattern-e924ce8ab1c9?source=rss-6f3fac704710------2</link>
            <guid isPermaLink="false">https://medium.com/p/e924ce8ab1c9</guid>
            <category><![CDATA[design-patterns]]></category>
            <dc:creator><![CDATA[Perry Tribolet]]></dc:creator>
            <pubDate>Wed, 19 Sep 2018 01:29:45 GMT</pubDate>
            <atom:updated>2018-09-20T16:03:41.530Z</atom:updated>
            <content:encoded><![CDATA[<p>Many of today’s software development problems require solutions not provided by the original GOF (Gang of Four) design patterns book. I offer a new pattern, which I call the recipe pattern, as a critical addition, being especially relevant to today’s MVC and Web API styles of programming.</p><h3><strong>Intent</strong></h3><p>The recipe pattern is not entirely new. It’s core is a fusion of the GOF’s command and composite patterns. In a nutshell, the command pattern resides inside the composite pattern.</p><p>In fact, there’s an example in the book that combines the two patterns in GOF — which the author’s call the Macro command.</p><p>But the Macro command as described in GOF, simply provides the client a list of unrelated command objects. The recipe pattern instead integrates all the constituent command objects in the composite hierarchy through a mutual reference to an end product object. The entire hierarchy exists to serve that one object. As the recipe finishes its execution, the product object becomes the finished outcome of the recipe.</p><h3>Applicability</h3><p>This approach has near-ubiquitous applicability in today’s software world. For instance, In the case of MVC, the model could be thought of as a product created by a recipe. Another example would be the response payload of a web API would be a recipe product.</p><p>The recipe pattern acknowledges that every web page or api controller method creates some overarching , or summary, object in the process of fulfilling its duty, perhaps only as a byproduct. Even in the case of void web method, some object is created that could serve a reporting function to its client. For instance, in the case of a recipe that sends out emails, a list of the emails sent could be returned to and consumed by the client.</p><p>By their inherently modular architecture, not only can related recipes be easily combined, but also disparate recipes can talk to each other, promoting maximum code reuse opportunities.</p><h3>Structure</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*05MhCR7bxSeqEaL4YL4WLw.png" /></figure><h3>Consequences</h3><p>The recipe pattern is a gateway to other patterns, in particular GOF patterns The GOF book is not accessible for the average deliver Using the recipe pattern, however, a developer could more easily recognize design pattern opportunities.</p><p>I have found that it’s much easier to remember and comprehend the names of the classes than the names of the methods in a big class</p><p>I evolved this over years. I implemented a tree, but Ivdidn’t quite use composite. Finally, I realized that sticking to established patterns were the answer, what I was really trying to accomplish. You can’t really outdo the patterns.</p><p>The composite pattern provides the structure and overall plan and yet flexibility. The command attern provides the specifics on the actions and activities there are to be accomplished. There is a ying and yang quality to this relationship.</p><h3>Implementation</h3><p>Recipes are particularly germane to database activitiesw</p><p>Here are some likely, descriptive words that might be included in recipe names.</p><ul><li>Flow (for WorkFlow)</li><li>Fetch</li><li>Filter</li><li>Populate</li><li>Send (email)</li></ul><p>Static method? This would be the bast way to call the recipe</p><p>T Recipe.FinishedProduct(Recipe recipe)</p><p>2 ways to pass data (context object) between commands</p><ul><li>Put one command inside another</li><li>With sibling commands, they share a constructor parameter, and data is set in the first sibling’s constructor</li><li>(A hand me down)</li></ul><p>Recipes are particularly germane to database tasks</p><h3><strong>Sample Code</strong></h3><p><strong>C#</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8953b2eb733af6e129505c4cecb7bbba/href">https://medium.com/media/8953b2eb733af6e129505c4cecb7bbba/href</a></iframe><p>Here is the output.</p><pre>Hello World!+StringRecipe1+StringRecipe2</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e924ce8ab1c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Entity Framework Query Caching and Automation]]></title>
            <link>https://medium.com/@perrytribolet/entity-framework-query-caching-and-automation-ff00fd41c59?source=rss-6f3fac704710------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff00fd41c59</guid>
            <dc:creator><![CDATA[Perry Tribolet]]></dc:creator>
            <pubDate>Sun, 12 Mar 2017 01:09:00 GMT</pubDate>
            <atom:updated>2017-03-12T01:12:32.038Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Entity Framework Query Caching and Automation</strong></p><p>There are two ways in which automation can help you maximize Entity Framework’s performance when backing an ASP.NET website.</p><p>If you’ve modeled complex data with EF, particularly with extensive inheritance, you know that the first time a query is called there’s a delayed response, which can be up to several minutes. The reason for the initial delay is the time taken to generate and cache the SQL code that matches the query’s LINQ IQuerable code. Future requests for that query draw on the already cached SQL, allowing for a speedy response.</p><p>Letting your ASP.NET users experience a several minute delay for a single query, maybe five or more minutes of delay on a page that has a couple of queries, is definitely unacceptable, and maybe even a little cruel. Fortunately, it’s also unnecessary.</p><p>A much better approach to is to automate the generation of the cached SQL.</p><p>To do this I write a small app that loads web pages exercising any slow-caching EF queries. Some of these pages are simply the same ones that users see. Others are manufactured specifically to pre-cache queries involved in AJAX requests., but is of no interest to users. The app is run periodically as a scheduled task or job, virtually insuring that each slow-caching query is stored in cache before a user comes in contact with it.</p><p>A second way automation can used to improve EF performance is to auto generate code that time-logs each statement.</p><p>The biggest hurdle to developing cashing is to find the lines of code there are time consuming.</p><p>Finding EF bottlenecks can be troublesome, buried in pages of code. Rarely are the locations of slow-caching queries intuitively obvious. The only practical approach I have found is to track broad-swaths of code, maximizing the likelihood of ensnaring the slow-caching in the act. I written a script that allows me to quickly add logging in each line of classes I suspect are involved in the bottleneck with great success.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff00fd41c59" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>