FPish.net - All blog entriesAll blog entries shared on FPish.net by our members.uuid:fcaa324f-a7b1-4274-a022-44ae3d24effb;id=2892024-03-28T14:36:04Zhttp://codeblog.jonskeet.uk/2023/11/25/variations-in-the-visca-protocol/Variations in the VISCA protocol2023-11-25T17:09:00Z2024-03-28T14:36:04ZNearly three years ago, I posted about some fun I’d been having with VISCA using C#. As a reminder, VISCA is a camera control protocol, originally used over dedicated serial ports, but more recently over IP. Until this week, all the cameras I’d worked with were very similar – PTZOptics, Minrray and ZowieTek all produce … <a href="https://codeblog.jonskeet.uk/2023/11/25/variations-in-the-visca-protocol/" class="more-link">Continue reading <span class="screen-reader-text">Variations in the VISCA protocol</span> <span class="meta-nav">→</span></a>http://sergeytihon.com/?p=10338F# Weekly #47, 2023 – G-Research FSharp Analyzers2023-11-25T11:45:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News Videos Blogs Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  http://sergeytihon.com/?p=10310F# Weekly #46, 2023 – F# 8 and .NET Conf Announcement2023-11-18T14:47:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News .NET Conf Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  https://assertfail.gewalli.se/2023/11/14/Patch-net7-dev-container-for-net8Patch net7 dev container for net82023-11-14T20:17:00Z2024-03-28T14:36:04Z<p>Since there isn’t an official dev container for net8 yet, you can use the net7 dev container and the setup scripts mention on <a href="https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install">Microsoft Learn</a>.</p>
<p>Instead of the base image:</p>
<div class="language-dockerfile highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">FROM</span><span class="s"> mcr.microsoft.com/devcontainers/dotnet:0-7.0</span>
</code></pre></div></div>
<p>You can add the following to ensure that net8 is installed:</p>
<div class="language-dockerfile highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">RUN </span>wget https://dot.net/v1/dotnet-install.sh <span class="nt">-O</span> dotnet-install.sh
<span class="k">RUN </span><span class="nb">chmod</span> +x ./dotnet-install.sh
<span class="k">RUN </span><span class="nb">sudo</span> ./dotnet-install.sh <span class="nt">--channel</span> 8.0 <span class="nt">--install-dir</span> /usr/share/dotnet
</code></pre></div></div>
http://sergeytihon.com/?p=10284F# Weekly #45, 2023 – Second life for FsEye and FsSnip.net2023-11-11T14:12:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  https://theburningmonk.com/?p=13013How I implemented web analytics reporting with Timestream2023-11-06T01:04:00Z2024-03-28T14:36:04Z<p>A month ago, I shared how I built an affiliate tracking system in a weekend [1]. Since then, I’ve enhanced the system by integrating analytics reporting, enabling affiliates to gauge the performance of their URLs. In this post, I will describe how the system works and why I chose Amazon Timestream over DynamoDB.   How …</p>
<p class="read-more"> <a class="" href="https://theburningmonk.com/2023/11/how-i-implemented-web-analytics-reporting-with-timestream/"> <span class="screen-reader-text">How I implemented web analytics reporting with Timestream</span> Read More »</a></p>
<p>The post <a rel="nofollow" href="https://theburningmonk.com/2023/11/how-i-implemented-web-analytics-reporting-with-timestream/">How I implemented web analytics reporting with Timestream</a> appeared first on <a rel="nofollow" href="https://theburningmonk.com">theburningmonk.com</a>.</p>
http://sergeytihon.com/?p=10262F# Weekly #44, 2023 – F# graph-based type checking2023-11-05T18:00:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  https://theburningmonk.com/?p=12992Monthly roundup – October 20232023-11-01T23:08:00Z2024-03-28T14:36:04Z<p>Hi, here’s a quick round-up of everything I have done in October 2023. Podcast We aired three episodes on the Real-World Serverless podcast: #84 – Charity Majors on Observability, OTEL, AI ops, DevOps and Friday deploys #85 – AWS CDK dos and don’ts with Matthew Bonig #86 – AWS Serverless Hero on adopting CDK in …</p>
<p class="read-more"> <a class="" href="https://theburningmonk.com/2023/11/monthly-roundup-october-2023/"> <span class="screen-reader-text">Monthly roundup – October 2023</span> Read More »</a></p>
<p>The post <a rel="nofollow" href="https://theburningmonk.com/2023/11/monthly-roundup-october-2023/">Monthly roundup – October 2023</a> appeared first on <a rel="nofollow" href="https://theburningmonk.com">theburningmonk.com</a>.</p>
https://theburningmonk.com/?p=12955Serverless v4 will start charging users, but that’s a good thing2023-10-28T23:18:00Z2024-03-28T14:36:04Z<p>The Serverless Framework remains a top choice for serverless development, as evidenced by the recent State of Serverless report [1]. Yet, its appeal has waned over time due to the lack of innovation in recent years, prompting users to explore other options. Recently, they announced [2] significant updates for Serverless v4: Fees will be introduced …</p>
<p class="read-more"> <a class="" href="https://theburningmonk.com/2023/10/serverless-v4-will-start-charging-users-but-thats-a-good-thing/"> <span class="screen-reader-text">Serverless v4 will start charging users, but that’s a good thing</span> Read More »</a></p>
<p>The post <a rel="nofollow" href="https://theburningmonk.com/2023/10/serverless-v4-will-start-charging-users-but-thats-a-good-thing/">Serverless v4 will start charging users, but that’s a good thing</a> appeared first on <a rel="nofollow" href="https://theburningmonk.com">theburningmonk.com</a>.</p>
http://sergeytihon.com/?p=10209F# Weekly #43, 2023 – 11 year of F# Weekly and #FsAdvent 20232023-10-28T19:49:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, Time flies by (an impressive 11 years already!), and yet, F# Weekly continues to be a steadfast presence, arriving like clockwork. Thank you to all the loyal readers of F# Weekly, whether you’ve been with me from the very beginning or joined recently. Please join this year’s #FsAdvent, book a slot, and…<p class="link-more"><a href="https://sergeytihon.com/2023/10/28/f-weekly-43-2023-11-year-of-f-weekly-and-fsadvent-2023/#more-10209" class="more-link">Continue reading ➞ <span class="screen-reader-text">F# Weekly #43, 2023 – 11 year of F# Weekly and #FsAdvent 2023</span></a></p>http://sergeytihon.com/?p=10202F# Advent Calendar in English 20232023-10-28T19:26:00Z2024-03-28T14:36:04ZChristmas is approaching again 🎅🏻. It’s almost unbelievable that we’re celebrating the 10th annual F# Advent in English! Our journey began back in 2014, and since then, every year has seen us come together during the Advent season to share our F# stories, experiences, and unbridled passion. This year is not an exception, but we…<p class="link-more"><a href="https://sergeytihon.com/2023/10/28/f-advent-calendar-in-english-2023/#more-10202" class="more-link">Continue reading ➞ <span class="screen-reader-text">F# Advent Calendar in English 2023</span></a></p>http://sergeytihon.com/?p=10182F# Weekly #42, 2023 – What’s new in F# 82023-10-21T13:27:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  https://theburningmonk.com/?p=12816Amplify: how to share code without Lambda Layers or private NPM2023-10-21T00:08:00Z2024-03-28T14:36:04Z<p>Sharing code efficiently across different parts of an application can be challenging with AWS Lambda, especially when using Amplify. Today, I’ll walk you through a solution to this common problem, without relying on Lambda Layers or private NPM repositories. The Context In my previous post about Lambda Layers [1], I delved into its limitations, especially …</p>
<p class="read-more"> <a class="" href="https://theburningmonk.com/2023/10/amplify-how-to-share-code-without-lambda-layers-or-private-npm/"> <span class="screen-reader-text">Amplify: how to share code without Lambda Layers or private NPM</span> Read More »</a></p>
<p>The post <a rel="nofollow" href="https://theburningmonk.com/2023/10/amplify-how-to-share-code-without-lambda-layers-or-private-npm/">Amplify: how to share code without Lambda Layers or private NPM</a> appeared first on <a rel="nofollow" href="https://theburningmonk.com">theburningmonk.com</a>.</p>
http://sergeytihon.com/?p=10166F# Weekly #41, 2023 – Overhauled F# code fixes and .NET 8 RC22023-10-14T09:23:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  https://theburningmonk.com/?p=12772How I built an affiliate tracking system in a weekend with serverless2023-10-12T14:56:00Z2024-03-28T14:36:04Z<p>Having taught thousands of students to build serverless applications via my online courses and workshops, I felt it was time to kick-start an affiliate program to boost sales. Affiliates would receive 50% of the revenue and get a 15% discount code for their audience. It feels like a good deal but I would need a …</p>
<p class="read-more"> <a class="" href="https://theburningmonk.com/2023/10/how-i-built-an-affiliate-tracking-system-in-a-weekend-with-serverless/"> <span class="screen-reader-text">How I built an affiliate tracking system in a weekend with serverless</span> Read More »</a></p>
<p>The post <a rel="nofollow" href="https://theburningmonk.com/2023/10/how-i-built-an-affiliate-tracking-system-in-a-weekend-with-serverless/">How I built an affiliate tracking system in a weekend with serverless</a> appeared first on <a rel="nofollow" href="https://theburningmonk.com">theburningmonk.com</a>.</p>
http://sergeytihon.com/?p=10145F# Weekly #40, 2023 – F# is not slow and used by Pulumi2023-10-06T20:08:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  https://theburningmonk.com/?p=12710Help! How do I set DeletionPolicy to Retain for production only?2023-10-06T12:24:00Z2024-03-28T14:36:04Z<p>It’s a good practice to use CloudFormation’s DeletionPolicy to protect stateful resources such as DynamoDB tables or RDS databases from accidental deletions. Such as when someone accidentally deletes a CloudFormation stack! As I discussed previously [1], this is a much better way to guard against these accidental data losses than separating stateful and stateless resources …</p>
<p class="read-more"> <a class="" href="https://theburningmonk.com/2023/10/help-how-do-i-set-deletionpolicy-to-retain-for-production-only/"> <span class="screen-reader-text">Help! How do I set DeletionPolicy to Retain for production only?</span> Read More »</a></p>
<p>The post <a rel="nofollow" href="https://theburningmonk.com/2023/10/help-how-do-i-set-deletionpolicy-to-retain-for-production-only/">Help! How do I set DeletionPolicy to Retain for production only?</a> appeared first on <a rel="nofollow" href="https://theburningmonk.com">theburningmonk.com</a>.</p>
https://theburningmonk.com/?p=12688Monthly roundup – September 20232023-10-01T12:15:00Z2024-03-28T14:36:04Z<p>Hi, here’s a quick round-up of everything I have done in September 2023. Podcast The first two episodes of this new format are available already: #82 – Big things are coming Lambda Powertools [Heitor Lessa] #83 – Unpacking Google’s latest AI announcements [Gerard Sans] The next episode with Charity Majors is airing on Oct 3rd …</p>
<p class="read-more"> <a class="" href="https://theburningmonk.com/2023/10/monthly-roundup-september-2023/"> <span class="screen-reader-text">Monthly roundup – September 2023</span> Read More »</a></p>
<p>The post <a rel="nofollow" href="https://theburningmonk.com/2023/10/monthly-roundup-september-2023/">Monthly roundup – September 2023</a> appeared first on <a rel="nofollow" href="https://theburningmonk.com">theburningmonk.com</a>.</p>
http://sergeytihon.com/?p=10126F# Weekly #39, 2023 – New Fable Release!2023-09-30T13:37:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  http://sergeytihon.com/?p=10109F# Weekly #38, 2023 – F# computations with the new ‘while!’ keyword2023-09-22T18:53:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  http://sergeytihon.com/?p=10085F# Weekly #37, 2023 – .NET 8 RC1, StereoDB and F# Tools is VS2023-09-16T18:10:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  http://sergeytihon.com/?p=10062F# Weekly #36, 2023 – F# Code Fixes2023-09-10T06:19:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  https://theburningmonk.com/?p=12584Static IP for Lambda: ingress, egress and bypassing the dreaded NAT Gateway2023-09-09T13:10:00Z2024-03-28T14:36:04Z<p>Many vendors require you to have a static IP address for your application. Such that all requests to their API must originate from an allow-list of IP addresses. In some cases, they even mandate that you use a static IP address for ingress traffic too. So they can communicate with your system through a trusted …</p>
<p class="read-more"> <a class="" href="https://theburningmonk.com/2023/09/static-ip-for-lambda-ingress-egress-and-bypassing-the-dreaded-nat-gateway/"> <span class="screen-reader-text">Static IP for Lambda: ingress, egress and bypassing the dreaded NAT Gateway</span> Read More »</a></p>
<p>The post <a rel="nofollow" href="https://theburningmonk.com/2023/09/static-ip-for-lambda-ingress-egress-and-bypassing-the-dreaded-nat-gateway/">Static IP for Lambda: ingress, egress and bypassing the dreaded NAT Gateway</a> appeared first on <a rel="nofollow" href="https://theburningmonk.com">theburningmonk.com</a>.</p>
https://theburningmonk.com/?p=12517Step Functions: combine Standard and Express workflows for fun & profit2023-09-04T06:45:00Z2024-03-28T14:36:04Z<p>Step Functions’ state machines come in two flavours. By understanding their strengths and limitations, you can harness the combined power of both to optimize your processes for efficiency and cost. Standard Workflows Optimal for: Business-critical operations like payment processing. Strengths: Suitable for low-throughput scenarios. High maximum duration ensures enough time for retries using exponential backoff. …</p>
<p class="read-more"> <a class="" href="https://theburningmonk.com/2023/09/combine-standard-and-express-workflows-for-fun-profit/"> <span class="screen-reader-text">Step Functions: combine Standard and Express workflows for fun & profit</span> Read More »</a></p>
<p>The post <a rel="nofollow" href="https://theburningmonk.com/2023/09/combine-standard-and-express-workflows-for-fun-profit/">Step Functions: combine Standard and Express workflows for fun & profit</a> appeared first on <a rel="nofollow" href="https://theburningmonk.com">theburningmonk.com</a>.</p>
http://sergeytihon.com/?p=10039F# Weekly #35, 2023 – 65% Off for Rider and VS4Mac Retirement.2023-09-02T13:53:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  http://sergeytihon.com/?p=10023F# Weekly #34, 2023 –.NET 8.0 GC feature called DATAS2023-08-26T12:30:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  http://sergeytihon.com/?p=10008F# Weekly #33, 2023 – SponsorLink & Rider F# features2023-08-20T11:01:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News .NET Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  https://assertfail.gewalli.se/2023/08/19/What-does-SOLID-meanWhat does SOLID mean2023-08-19T08:32:00Z2024-03-28T14:36:04Z<h2 id="sources">Sources</h2>
<ul>
<li><a href="https://speakerdeck.com/tastapod/why-every-element-of-solid-is-wrong">Dan North: Why Every Element of SOLID is Wrong</a></li>
<li><a href="https://en.wikipedia.org/wiki/SOLID#SOLID_Principles">Wikipedia</a></li>
<li><a href="https://stackoverflow.com/questions/5577054/solid-for-functional-programming">SOLID for functional programming</a></li>
<li><a href="https://softwareengineering.stackexchange.com/questions/165356/equivalent-of-solid-principles-for-functional-programming">Equivalent of SOLID principles for functional programming</a></li>
<li><a href="https://blog.cleancoder.com/uncle-bob/2020/10/18/Solid-Relevance.html">Solid Relevance</a></li>
</ul>
<h2 id="principles">Principles</h2>
<h3 id="single-responsibility-principle">Single responsibility principle</h3>
<p>Let us start with <a href="https://blog.cleancoder.com/uncle-bob/2014/05/08/SingleReponsibilityPrinciple.html">The single responsibility principle</a>:</p>
<blockquote>
<p>Gather together the things that change for the same reasons. Separate things that change for different reasons.</p>
</blockquote>
<p>some see it as:</p>
<blockquote>
<p>do one thing and do it well</p>
</blockquote>
<p>The problem with this principle is that the definition is open for interpretation. The principle assumes sufficient experience around what kind of changes in requirements we can expect (something that depends on the people involved). I’ve worked with people that have a good grasp on how large a class/module or function should be, but the problem is that people have different expectations around what kind responsibility/concern code should have. It is a good thing to keep code focused on one thing, so the principle should be more of a reminder to break out or move code that does not fit. As <a href="https://sklivvz.com/posts/i-dont-love-the-single-responsibility-principle">Marco Cecconi in ‘I don’t love the single responsibility principle’</a> mentions, to avoid making a mess you need balance coupling and cohesion (not something you would expect a developer that has only worked for a few years to know). It can still be good to have it in mind.</p>
<h3 id="open-closed-principle">Open-Closed principle</h3>
<blockquote>
<p>A Module should be open for extension but closed for modification.</p>
</blockquote>
<p>Mentioned in <a href="https://web.archive.org/web/20060822033314/http://www.objectmentor.com/resources/articles/ocp.pdf">The Open-Closed Principle</a>.
This is another principle that you need to have experience in order to apply in a good way. The risk is that it becomes as Dan North says</p>
<blockquote>
<p>Cruft Accretion Principle</p>
</blockquote>
<p>I don’t agree with Dan North. If you have smaller code blocks as mentioned in single responsibility principle you can garbage collect old code.</p>
<p>Perhaps some of the issues around this principle is that it becomes overly ambitious scope if taken out of context. If we pull back on the ambition and instead focus on some of the things he talks about in the article we can summarize as following:</p>
<p>The reason for the principle is that you want to avoid cascade of changes due to a single change of one code unit. That is</p>
<blockquote>
<p>Allowing you to change behaviors without modifying code</p>
</blockquote>
<p>An example is given how it is brittle to write code that uses “runtime type identification”. Why is that brittle? The reason it is brittle is because if you have a class that is not <code class="language-plaintext highlighter-rouge">sealed</code> in C# or <code class="language-plaintext highlighter-rouge">final</code> in Java or C++, someone can easily inherit and break old assumptions.</p>
<p>My take on the case of OCP is that you either make code:</p>
<ul>
<li>closed: i.e. make sure that you cannot inherit by making the class sealed/final having an algebraic datatype</li>
<li>open: open for inheritance but have property/method to the class/type so that the you force child classes to take a decision</li>
</ul>
<p>My feeling is that this principle makes most sense when talking about</p>
<ul>
<li>Clear single responsibility principle violations</li>
<li>Inheritance in your business code. Many developers follow <a href="https://en.wikipedia.org/wiki/Composition_over_inheritance">Composition over inheritance</a> why you do not need to worry about open and closed in relation to inheritance in such code bases.</li>
<li>When you are developing framework/infrastructure code. It makes more sense to freeze framework/infrastructure behavior than it does to freeze business behavior (since businesses and people change).</li>
</ul>
<h3 id="liskov-substitution-principle">Liskov substitution principle</h3>
<p>The <a href="https://en.wikipedia.org/wiki/Liskov_substitution_principle">Liskov substitution principle</a> is not formulated mostly by Uncle Bob, why it has a slightly different feel to it.</p>
<blockquote>
<p>An implementation of an abstraction should be replaceable with other implementations of the same abstraction</p>
</blockquote>
<p>or formulated in a different way</p>
<blockquote>
<p>Code unit that publishes conformance to contract should conform to the contract</p>
</blockquote>
<p>or in this way</p>
<blockquote>
<p>A program that uses an interface must not be confused by an implementation of that interface.</p>
</blockquote>
<p><a href="https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlycollection-1?view=net-7.0#definition">IReadOnlyCollection</a> suffers from a violation of Liskov principle as can be seen on <a href="https://stackoverflow.com/questions/13819058/readonlycollection-vs-liskov-how-to-correctly-model-immutable-representations">Stackoverflow: ReadOnlyCollection vs Liskov</a>.</p>
<p>We note that IReadOnlyCollection is more about what Dan North says:</p>
<blockquote>
<p>acts-like-a, can-be-used-as-a</p>
</blockquote>
<p>That is, if we send in a list to a method that accepts a read-only collection then we assume that the method wont mutate the list and the method assumes that we won’t mutate that list (during the execution of the method). This means that we are back at a more fuzzy interpretation rather than a strict principle. My feeling is that even though it is benign to let lists act like readonly, you are opening yourself up to trouble in the long run since it is a detail that is easy to miss.</p>
<h3 id="interface-segregation-principle">Interface segregation principle</h3>
<p>From <a href="https://docs.google.com/a/cleancoder.com/viewer?a=v&pid=explorer&chrome=true&srcid=0BwhCYaYDn8EgOTViYjJhYzMtMzYxMC00MzFjLWJjMzYtOGJiMDc5N2JkYmJi&hl=en">object mentor article ISP</a>.</p>
<blockquote>
<p>Clients should not be forced to depend upon interfaces that they do not use.</p>
</blockquote>
<p>or also formulated as</p>
<blockquote>
<p>Keep interfaces small so that users don’t end up depending on things they don’t need.</p>
</blockquote>
<p>The intention of this principle is that you should not require your code to depends on “fat” interfaces (or collection of unrelated interfaces).</p>
<ul>
<li>Having to implement more methods requires more work. Introduces unnecessary work.</li>
<li>It is harder to know what parts of a larger interface is relevant to mock/fake when you are doing unit testing. Having smaller interfaces simplifies testing.</li>
</ul>
<p>The problem with this principle is that there isn’t a sufficiently clear definition of when to apply this principle. In many cases depending on C# <code class="language-plaintext highlighter-rouge">ICollection<></code> is better instead of a specialized interface with only the methods that you use. You rarely implement your own collections, rather you usually depend on existing framework implemented collections. If you instead try to limit this principle to business code (instead of infrastructure) you can end up with infrastructure code that makes your code hard to test when there isn’t any provided testing tools for the infrastructure.</p>
<h3 id="dependency-inversion-principle">Dependency inversion principle</h3>
<p>From <a href="https://web.archive.org/web/20110714224327/http://www.objectmentor.com/resources/articles/dip.pdf">object mentor article DIP</a>:</p>
<blockquote>
<p>modules that encapsulate high level policy should not depend upon modules that implement details. Rather, both kinds of modules should depend upon abstractions.</p>
</blockquote>
<p>or also formulated as</p>
<blockquote>
<p>Depend in the direction of abstraction. High level modules should not depend upon low level details.</p>
</blockquote>
<p>Why? My feeling is that he describes a situation with a solution with a mix of business logic and low level implementation logic. This principle makes most sense when you want to use an architecture such as <a href="https://blog.ploeh.dk/2016/03/18/functional-architecture-is-ports-and-adapters/">adapters/hexagonal/clean architecture</a>. Understanding that type of architecture requires you to be familiar with its culture and purpose.</p>
<p>If we are talking about two different things such as high level modules or detail being business code and low level modules being databases, integrations and hardware implementation. If we code directly against a specific database/integration/x86 architecture then we know that the code is less portable. Having infrastructure interfaces that includes business details means that the infrastructure is tied to that business domain. That is generally fine for solutions that only caters to one business domain but not fine for general purpose code such as say <a href="https://learn.microsoft.com/en-us/ef/core/">Entity Framework Core</a> or <a href="https://hibernate.org/">Hibernate</a>.</p>
<p>One of the big question I usually have around clean architecture is if you want to isolate yourself from the external infrastructure (such as Hibernate or Entity Framework Core) or if the usage of such frameworks can be seen as in line with the goal of having a way to isolate yourself from too much details about the database. The previous iteration of Entity Framework, called only Entity Framework instead with the “Core” tacked on, had a <a href="https://stackoverflow.com/questions/22690877/how-are-people-unit-testing-with-entity-framework-6-should-you-bother">higher coupling with the database</a>.</p>
<p>We should not design for reuse in our business domain, but rather if we are building software that is intended for many business domains. This means that by misunderstanding this principle it can lead you into writing “reusable” code that should never be reused.</p>
<h2 id="conclusion">Conclusion</h2>
<p>My feeling is that SOLID makes sense. It does however require you to have worked as a software developer/engineer enough in order to get the experience needed to understand them. Working on complicated code and gaining enough experience will net you a feeling of what is common sense aligned with SOLID. Working in other projects that do not have sufficient complexity and enough business logic may well give you another view. I’ve talked with coworkers that have seen the failure mode of teams trying to apply the principles in a mechanical way. SOLID experiences what what Eric Normand denotes <a href="https://ericnormand.me/podcast/the-christopher-alexander-effect">The Christopher Alexander Effect</a>.</p>
http://sergeytihon.com/?p=9988F# Weekly #32, 2023 – .NET 8 Preview 7 and VS 17.72023-08-13T12:33:00Z2024-03-28T14:36:04ZWelcome to F# Weekly, A roundup of F# content from this past week: News F# Videos and Slides .NET Videos Blogs F# vNext Highlighted projects New Releases That’s all for now. Have a great week. If you want to help keep F# Weekly going, click here to jazz me with Coffee!  http://viralfsharp.com/?p=1495HuggingFace. Models. Spaces. Part 22023-08-06T23:26:00Z2024-03-28T14:36:04ZThis concludes the two-part blog entry on turning HuggingFace into a deep learning playground (and we have not even talked about all the LMs they host!). Mostly it will be about Spaces, but we are starting with models. Models We train tons of models as we experiment with hyperparameters or redesign model structures and do … <a href="https://viralfsharp.com/2023/08/06/huggingface-models-spaces-part-2/" class="more-link">Continue reading <span class="screen-reader-text">HuggingFace. Models. Spaces. Part 2</span> <span class="meta-nav">→</span></a>