<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Dave van Herten</title>
		<description>Stylish Jekyll Theme</description>
		<link>/</link>
		<atom:link href="/feed.xml" rel="self" type="application/rss+xml" />
		
			<item>
				<title>2018 Year in Review</title>
				<description>&lt;p&gt;As it is customary to do in January, lets look back at 2018. It was a very big year for me. You rarely achieve all the things you hope for in a year, but this year was definitely one to remember.&lt;/p&gt;

&lt;h2 id=&quot;zoey&quot;&gt;ZOEY!&lt;/h2&gt;

&lt;p&gt;First and foremost, in May my wife and I welcomed our first born Zoey into this world. She is an incredible baby and we couldn’t have hoped for more. I love being a father and it has really brought some perspective in my life. You really can’t understand what being a parent will feel like until you are one and you really can’t put it into words for some one who isn’t already a parent.&lt;/p&gt;

&lt;h2 id=&quot;event-sourcing&quot;&gt;Event Sourcing!&lt;/h2&gt;

&lt;p&gt;I had the opportunity to introduce event sourcing at work to solve a multi-directional integration sync between some systems we use. We leveraged &lt;a href=&quot;https://github.com/SQLStreamStore/SQLStreamStore&quot;&gt;SqlStreamStore&lt;/a&gt; and it has been working great.&lt;/p&gt;

&lt;p&gt;There will be more on this topic later as I re-implement some lessons learned into some demo applications and blog posts.&lt;/p&gt;

&lt;h2 id=&quot;javascriptfront-end&quot;&gt;Javascript/Front-end&lt;/h2&gt;

&lt;p&gt;I spent a ton more time working with React and Javascript in general as it has been a weak spot for me. To improve I’ve started up a Warhammer 40k Math Calculator to better learn javascript and react. Currently I’m hosting it in an Azure static site.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.mathhammer.fun/&quot;&gt;Mathhammer&lt;/a&gt; doesn’t have the best UI as I’m using a drop-in Material library and haven’t spent any time on the mobile experience. I have some ideas for improving it and will implement them as I develop the project further.&lt;/p&gt;

&lt;h2 id=&quot;reading&quot;&gt;Reading!&lt;/h2&gt;

&lt;p&gt;While I was hoping to hit 12 books for the year, I ended at 9 for the year. Considering I spend a decent amount picking up new things on Pluralsight and Egghead I’m pretty happy with the result as it is much more than I’ve done any other year.&lt;/p&gt;

&lt;p&gt;Topics varied all over the place from &lt;a href=&quot;https://www.eventstorming.com/book/&quot;&gt;Introducing Event Storming&lt;/a&gt; and &lt;a href=&quot;https://www.amazon.ca/Domain-Driven-Design-Distilled-Vaughn-Vernon/dp/0134434420/ref=sr_1_1?ie=UTF8&amp;amp;qid=1547255844&amp;amp;sr=8-1&amp;amp;keywords=ddd+distilled&quot;&gt;DDD Distilled&lt;/a&gt; to a &lt;a href=&quot;https://www.blacklibrary.com/all-products/ragnar-blackmane-ebook.html&quot;&gt;40k novel&lt;/a&gt; and of course some baby books.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;There’s a lot I’m leaving out, but the short of it is I’m pretty happy with what I accomplished over the year. Did I want to do more, sure, who doesn’t, but all in all I am pretty happy with the above list.&lt;/p&gt;

&lt;p&gt;I’m looking forward to 2019 being a great year as well.&lt;/p&gt;
</description>
				<pubDate>Fri, 11 Jan 2019 00:00:00 +0000</pubDate>
				<link>/2019/01/year-in-review/</link>
				<guid isPermaLink="true">/2019/01/year-in-review/</guid>
			</item>
		
			<item>
				<title>CI/CD with Azure Storage Static Sites</title>
				<description>&lt;p&gt;&lt;a href=&quot;https://azure.microsoft.com/en-us/blog/azure-storage-static-web-hosting-public-preview/&quot;&gt;Static web hosting&lt;/a&gt; is now a thing in Azure Storage and is pretty easy to setup. There’s a small caveat with the CI/CD solution they’ve provided though.&lt;/p&gt;

&lt;h2 id=&quot;getting-setup&quot;&gt;Getting setup&lt;/h2&gt;

&lt;p&gt;I’m not going to go into it here because there a perfectly fine tutorial on &lt;a href=&quot;https://code.visualstudio.com/tutorials/static-website/getting-started&quot;&gt;how to setup the static site initially&lt;/a&gt; and also how to take that site and &lt;a href=&quot;https://code.visualstudio.com/tutorials/static-website/deploy-VSTS&quot;&gt;enable a CICD build around it&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is what I followed and I recommend the same.&lt;/p&gt;

&lt;h1 id=&quot;the-gotcha&quot;&gt;The Gotcha&lt;/h1&gt;

&lt;p&gt;In the CICD process suggested, they use an Upload Batch command. And this does exactly what you expect it to, uploads all of the files. So what could be wrong with that?&lt;/p&gt;

&lt;p&gt;Well it’s subtle. Each time you run the build, it’s going to bundle everything up into a neat little JS file and change a little hash number so that if someone goes to your new site, it will pull down the new JS file and avoid caching.&lt;/p&gt;

&lt;p&gt;What the default CI/CD process is doing is ignoring that clean up.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://dave.vanherten.ca/assets/media/static-site-no-cleanup.jpg&quot; alt=&quot;static-site-no-cleanup&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The HTML was uploaded to use the right one, so the site will work exactly as you expect and be properly updated. The downside is now you are filling up your storage with useless JS files. This is worse if you are including the mapping files as those are much larger.&lt;/p&gt;

&lt;h1 id=&quot;cleaning-up&quot;&gt;Cleaning up&lt;/h1&gt;

&lt;p&gt;Regards to how I went about it, your mileage may vary. In my case, I was prefectly content to clear out the container before putting the new static site up. I’m not concerned with the type of site I’m making that theoretically someone might get a 404 for an extremely small moment in time.&lt;/p&gt;

&lt;p&gt;If that sounds like your scenario, then the following task might work for you:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://dave.vanherten.ca/assets/media/static-site-cleanup-task.png&quot; alt=&quot;static-site-no-cleanup&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Put this task between the NPM build and the Upload site tasks in the VSTS build process and it’ll clean out the storage and you’ll only end up uploading your nice and fresh files.&lt;/p&gt;
</description>
				<pubDate>Sun, 09 Sep 2018 00:00:00 +0000</pubDate>
				<link>/2018/09/azure-static-sites-cleanup/</link>
				<guid isPermaLink="true">/2018/09/azure-static-sites-cleanup/</guid>
			</item>
		
			<item>
				<title>Blog ported and next steps</title>
				<description>&lt;p&gt;Seems every time I logged into WordPress I’d have some kind of update to do and I had the bare minimum of plug-ins. Enough is enough.&lt;/p&gt;

&lt;p&gt;I’d heard blogs with &lt;a href=&quot;https://pages.github.com/&quot;&gt;GitHub pages&lt;/a&gt; were pretty easy to setup and really it was! Github has even figured it out to the point that you can enable HTTPS and it works out all the details even when using a custom domain. Solid stuff. If you haven’t looked into it, you should. A lot of folks like D&lt;/p&gt;

&lt;h2 id=&quot;upcoming-posts&quot;&gt;Upcoming Posts&lt;/h2&gt;

&lt;p&gt;Comments were not retained during the port and as you can see I’ve moved to Disqus. There were some requests related to updating the Swagger Identity Server posts. I haven’t been playing in that space much lately, but since it seems to be a popular post I may look at updating it to the newest versions of Identity Server, Swagger &amp;amp; Asp.Net Core.&lt;/p&gt;

&lt;p&gt;Current interests have me playing more in the front-end with React, Redux, Apollo and GraphQL so I’ll probably hit up some posts in that area.&lt;/p&gt;

&lt;h2 id=&quot;big-news&quot;&gt;Big News!&lt;/h2&gt;

&lt;p&gt;Anyways, thought I’d drop a short post to say I’m still around. Just had a little creature keeping me busy lately! Her name is Zoey and she was born on May 15th! This was taken 10 days later. ;)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://dave.vanherten.ca/assets/media/zoey.jpg&quot; alt=&quot;zoey&quot; /&gt;&lt;/p&gt;

&lt;p&gt;It really is amazing how fast they grow! It’s been a little over three months now and she’s apparently super tall for her age, but that shouldn’t be surprising as my wife and I aren’t exactly short. :)&lt;/p&gt;

&lt;p&gt;More soon!&lt;/p&gt;
</description>
				<pubDate>Wed, 22 Aug 2018 00:00:00 +0000</pubDate>
				<link>/2018/22/github-pages/</link>
				<guid isPermaLink="true">/2018/22/github-pages/</guid>
			</item>
		
			<item>
				<title>Whirlwind of a Month</title>
				<description>&lt;p&gt;What a busy month! Taking a break from talking about the DieRoller (which I did put onto NuGet now), but so many other fun things have happened!&lt;/p&gt;

&lt;p&gt;In the last 2 weeks I’ve been to 3 Meetups and a conference!&lt;/p&gt;

&lt;h4 id=&quot;mississauga-net-user-group&quot;&gt;&lt;a href=&quot;https://www.meetup.com/MississaugaNETUG/&quot;&gt;Mississauga .Net User Group&lt;/a&gt;&lt;/h4&gt;

&lt;p&gt;This was a lightning talk event where I was one of the speakers. It was super fun to get up in front of everyone and do a quick talk on using Swagger to make building dev tools for internal use even easier without having to worry about a UI. Very receptive crowd and the other speakers were on point and did great jobs. All in all a great event!&lt;/p&gt;

&lt;h4 id=&quot;burlington-php-user-group&quot;&gt;&lt;a href=&quot;https://www.meetup.com/Burlington-PHP-Meetup/&quot;&gt;Burlington Php User Group&lt;/a&gt;&lt;/h4&gt;

&lt;p&gt;Not a Php guy, but topics these days are often cross language so I thought I’d check it out because it was held really close to home. I’m really happy I did as I got to meet &lt;a href=&quot;https://twitter.com/grmpyprogrammer&quot;&gt;Chris Hartjes&lt;/a&gt; who did a fantastic talk on the realities of trying to push testing into an organization. The talk is available on YouTube &lt;a href=&quot;https://www.youtube.com/watch?v=rmezVJ6sqk0&quot;&gt;here&lt;/a&gt; and I recommend checking it out.&lt;/p&gt;

&lt;h4 id=&quot;silicon-halton-software-peer-to-peer&quot;&gt;&lt;a href=&quot;https://www.meetup.com/Siliconhaltonsoftwarepeer2peer/&quot;&gt;Silicon Halton Software Peer to Peer&lt;/a&gt;&lt;/h4&gt;

&lt;p&gt;I’ve been attending the Peer to Peer events put on by Silicon Halton for a few months now and the discussions have always been very informative that come out of it. This month we dove into Docker. None of us were overly familiar with it, albeit very interested in it, so it was a fun exercise to have the room breaking down what we found and saw within the &lt;a href=&quot;https://github.com/dotnet-architecture/eShopOnContainers&quot;&gt;eShopOnContainers&lt;/a&gt; example that MS has available.&lt;/p&gt;

&lt;h4 id=&quot;hamontjs-conference-by-software-hamilton&quot;&gt;HamOntJS Conference by &lt;a href=&quot;https://www.softwarehamilton.com/hamont/&quot;&gt;Software Hamilton&lt;/a&gt;&lt;/h4&gt;

&lt;p&gt;This conference was an amazing event. It was a mere $20 to go to. I’ll say it again, $20. That’s amazing. The focus of the conference was on Javascript and I learned about some new things I hadn’t come across yet. Most importantly though I really need to start looking at JS more. While I’ve been mostly in .Net for my career so far I like to use the right tool for the job and sometimes JS and what I saw today feels like it might actually fit better in some ways. Definitely need to dig some more and bump the priority on some of these things that were already on my ever growing list of things to learn about.&lt;/p&gt;

&lt;h4 id=&quot;summing-up&quot;&gt;Summing up&lt;/h4&gt;

&lt;p&gt;What a great couple of weeks. Participating in these events has been something I am finding I look very forward to each month. I hope to do more speaking in the future and will likely work on some longer topics to build talks around in the coming months. Event Sourcing maybe? It’s been a fantastic growth opportunity for me and everyone I’ve met have been really quality people. If you haven’t gone to a meetup before, I highly recommend checking out if there are some that are local for you. It will invigorate and motivate you! I promise!&lt;/p&gt;
</description>
				<pubDate>Sat, 30 Sep 2017 00:00:00 +0000</pubDate>
				<link>/2017/09/whirlwind-of-a-month/</link>
				<guid isPermaLink="true">/2017/09/whirlwind-of-a-month/</guid>
			</item>
		
			<item>
				<title>Die Roller - Abstracting dependencies on Random</title>
				<description>&lt;p&gt;When building the Die Roller, I had two main use cases for it. Determine the probability of a given roll configuration and provide a simulation of the roll with all the information about what took place. When it comes to unit testing, probability calculations are more straight forward. They make sure that the code returns the expected result. Simulations are much more difficult to test because rolling a die is inherently random. Which means of course that you have to abstract the randomness away for the purposes of the tests.&lt;/p&gt;

&lt;p&gt;My goals were:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Provide a mechanism to pass the exact numbers to use from tests to validate expected results.&lt;/li&gt;
  &lt;li&gt;Avoid having to know how many sides a die may have within the random abstraction&lt;/li&gt;
  &lt;li&gt;Attempt to make it as non-invasive as possible.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I ended up settling on the following interface.&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;INumberGenerator&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;GetNumber&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note how I don’t pass in any sort of condition to drive the number like the number of sides that the die may have. I didn’t want to become needlessly complex in the abstraction where knowledge would need to be passed around. I merely want any single integer number back because that’s what Random is going to do for me. I leave it up to the Die class to handle its concern that involves the number of sides the die has.&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Die&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Sides&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SingleRollResult&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Simulate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;INumberGenerator&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numberGenerator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numberGenerator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetNumber&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

        &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;remainder&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Sides&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;SingleRollResult&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;remainder&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Sides&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;remainder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If we were always generating numbers that were less than the total sides of the die we would have a problem, but we have to remember the intent here. At run time we will always be using a random generator interface which will provide a positive integer. This will return lots of really big numbers and the Die class will handle it fine. Remember that our intention is to make testing easier, not make this harder than necessary to work with.&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;RandomNumberGenerator&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;INumberGenerator&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Random&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Random&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;GetNumber&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So how do we get our own implementation in the tests? I’ve left this up to the RollBuilder. Yet another benefit of having this fluent creation pattern. Here is an example of the construction from one of the tests. If I leave out the WithNumbers call then it will fall back to the default of random numbers.&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;roll&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;RollBuilder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WithDie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Die&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;D6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WithNumbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ForcedNumberGenerator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;initialRoll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reroll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Targeting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ValueAndAbove&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;targeting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WithReroll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Reroll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Ones&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Build&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;As you can see I pass the numbers I want directly into it. There is a little bit of internal knowledge that the tester needs to be aware of. The first number will be used by the initial roll. The second number will be used for the reroll. The ForcedNumberGenerator implementation returns the numbers in the order they are passed in so this knowledge is required when building a test. I was okay with this trade-off because in any single die roll that is exactly what happens in life. You make your first roll and you may or not make your second. It feels natural so it should not be overly confusing.&lt;/p&gt;

&lt;p&gt;Anyways, that’s my little story about how I abstracted a system dependency on Random. It’s a common enough practice to handle this in some fashion for testing and often also comes up for DateTime.Now as many applications have a dependency on dates.&lt;/p&gt;

&lt;p&gt;I’m well on my way with implementing the modifier requirement of the Die Roller (tests first!) which has me wondering what best practices are when it comes to validating and testing complex calculations. I’ll be writing something up about that experience soon. As always you can check out the project as it is coming along over on &lt;a href=&quot;https://github.com/dvanherten/DieRoller&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;
</description>
				<pubDate>Sun, 27 Aug 2017 00:00:00 +0000</pubDate>
				<link>/2017/08/dieroller-part-4/</link>
				<guid isPermaLink="true">/2017/08/dieroller-part-4/</guid>
			</item>
		
			<item>
				<title>Die Roller - Outside In</title>
				<description>&lt;p&gt;So I went and did it again. Not too long after writing the last post did I realize I started from an angle I shouldn’t have. Again.&lt;/p&gt;

&lt;h2 id=&quot;fluent-syntax&quot;&gt;Fluent Syntax&lt;/h2&gt;

&lt;p&gt;I knew when I started this that I wanted to have a fluent syntax for setting up the roll scenarios. This will allow the user of the library (me) to determine the conditions of constructions more easily without worrying about the underlying dependencies and construction rules. I’ll also be free to leave things internal to make things easier to change later as long as I allow the RollBuilder to continue functioning the same way.&lt;/p&gt;

&lt;p&gt;Essentially something like this:&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;roll&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;RollBuilder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;DetermineDie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Targeting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetTarget&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WithRerolls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetRerolls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WithModifier&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetModifier&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
               &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Build&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Essentially it allows the consumer to build mechanisms around the components of a roll. The GetTarget() or GetRerolls() will likely be based on some kind of ruleset and I believe the fluent syntax caters well to how that would work.&lt;/p&gt;

&lt;p&gt;So great. I knew I wanted to do a fluent syntax so why didn’t I start here? Good question. I had intended to, but for one reason or another I started on the implementation of a Roll first when I should have been thinking about how it was going to be used. Which brought me to the tests and a much more TDD approach.&lt;/p&gt;

&lt;h2 id=&quot;the-tests&quot;&gt;The Tests&lt;/h2&gt;

&lt;p&gt;So I started by re-writing the tests. Here’s what the body of a simple test looked like with no reroll and no modifier.&lt;/p&gt;

&lt;p&gt;Before:&lt;/p&gt;
&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;die&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;D6Die&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;expectedProb&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;requiredRollOrHigher&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;roll&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Roll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;die&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;requiredRollOrHigher&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;_output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;$&quot;Probability: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;roll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Probability&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;roll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Probability&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Should&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Be&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;expectedProb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;After:&lt;/p&gt;
&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;roll&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;RollBuilder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WithDie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Die&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;D6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Targeting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ValueAndAbove&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;valueAndAboveTarget&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Build&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Calc - SuccessfulSideCount / Sides&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;expectedProbability&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;valueAndAboveTarget&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;CheckProbability&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;roll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;expectedProbability&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The initial test would break if I changed aspects of the constructor or other Roll concerns. There was no abstraction from the construction process and it required understanding the inner workings of the classes more than I liked. The test as it is now will only change if I actually change something about the public interface of the builder or the method to calculate the probability. As I plan to treat this as an API on Nuget with Semantic Versioning, I want to be aware of when I break the public interface. I do not expect as much churn on the builder side of things so the fluent syntax isn’t just nice to work with, it also serves as a separation from how the classes work. So it makes perfect sense for why the unit tests would want to be written the same way as the consumer would be using it.&lt;/p&gt;

&lt;h2 id=&quot;validation-of-feelings&quot;&gt;Validation of Feelings&lt;/h2&gt;

&lt;p&gt;Gregory Brown tweeted this out a few days ago and it really hit home on why this worked out for me. OUTSIDE-IN!&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
&lt;blockquote class=&quot;twitter-tweet&quot; data-lang=&quot;en&quot;&gt;
Outside-in thinking and an emphasis on avoiding incidental damage to systems is the main takeaway from &lt;a href=&quot;https://twitter.com/hashtag/TDD?src=hash&quot;&gt;#TDD&lt;/a&gt;. Automated testing isn't.
— Gregory Brown (@practicingdev) &lt;a href=&quot;https://twitter.com/practicingdev/status/897899045003382784&quot;&gt;August 16, 2017&lt;/a&gt;
&lt;/blockquote&gt;
&lt;script async=&quot;&quot; src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;This change was because I was thinking about my API from the outside. How I wanted to use my API was driving the decisions around the public API as it should. By knowing how I wanted to use the library it made filling in the implementation much easier. It also feels more domain driven since it matches what you would be thinking in 40k.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;I’m making a hit roll. I have to hit on a 3+, I get to reroll my ones, and then I’ll apply the -1 to hit because my enemy is in stealth&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Props to Gregory Brown for putting what I was feeling so succinctly into words.&lt;/p&gt;

&lt;h2 id=&quot;moving-on&quot;&gt;Moving on&lt;/h2&gt;

&lt;p&gt;I’ll likely post next about an abstraction that was necessary when it came to testing the roll simulations. That’ll give me some time to figure out how roll modifiers will work. Here goes!&lt;/p&gt;
</description>
				<pubDate>Sun, 20 Aug 2017 00:00:00 +0000</pubDate>
				<link>/2017/08/dieroller-part-3/</link>
				<guid isPermaLink="true">/2017/08/dieroller-part-3/</guid>
			</item>
		
			<item>
				<title>Die Roller - Starting off on the wrong foot</title>
				<description>&lt;p&gt;So as I alluded to in the first post, I wasn’t happy with the tiny bit of code that I had done so far. I literally had one class and one test just to get some probability calculations going. But there were two things that I didn’t like.&lt;/p&gt;

&lt;h2 id=&quot;problem-1-it-was-wrong&quot;&gt;Problem #1: It was wrong&lt;/h2&gt;

&lt;p&gt;You’ve probably heard it a million times. Don’t write your test after your implementation or you’ll just end up writing a passing test for a failing implementation. Yep. That’s exactly what I did. The test simply used the same calculation I used in the implementation to vet the calculation was correct. But of course it wasn’t.&lt;/p&gt;

&lt;p&gt;That test wasn’t supposed to serve much of a purpose initially, but I knew I was going to be changing this code to be a little more involved and wanted the backing test. However, I totally had the calculation backwards.&lt;/p&gt;

&lt;p&gt;So word to the wise, write your test first, ensure it is actually validating what you want it to, and then implemented it. A face palm moment for sure.&lt;/p&gt;

&lt;p&gt;For the curious, &lt;a href=&quot;&amp;quot;https://github.com/dvanherten/DieRoller/commit/ac319e3f66f0b0447b15441d9f053d838c3df6a2#diff-1088ba0e8955643e802c3fad696e5857&amp;quot;&quot;&gt;here’s the commit.&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;problem-2-wrong-responsibilities&quot;&gt;Problem #2: Wrong responsibilities&lt;/h2&gt;

&lt;p&gt;The moment I had finished writing the first Die class I realized I’d goofed. There were two responsibilities in the 6-sided die class. One was the fact that the class was intended to be a representation of a THING. A die and a die does not have a probability on its own.&lt;/p&gt;

&lt;p&gt;What I had introduced was a second consideration of a scenario. Passing in the desired roll to calculate probability shouldn’t have been a responsibility of a die. So as a first order of business I’ve gone and addressed that by shifting some of the code around. The main change I made was introduced the concept of a scenario and called it a Roll. When you Roll a Die, you have a desired result in mind. We’ll see if that sticks.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/dvanherten/155fb8f01194474c5d26df9385498225.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;I knew I was going to have at least two types of dice for my situation (D3/D6) so I went ahead and created an abstraction for it. I hummed and hawed a little bit over interface vs abstract class, but as I didn’t have any base behaviour I decided to move ahead as an interface. Easy enough to change later.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;So as you can tell, I’ve already made some bumps along the way. That’s totally normal. The only difference here is that I’m telling the world about it. This all took place in a very short amount of time. Thinking about how I was going to write this up and then actually writing it was considerably longer, but it was fun to do and a good exercise for documenting my thought process.&lt;/p&gt;

&lt;p&gt;More soon!&lt;/p&gt;
</description>
				<pubDate>Wed, 26 Jul 2017 00:00:00 +0000</pubDate>
				<link>/2017/07/dieroller-part-2/</link>
				<guid isPermaLink="true">/2017/07/dieroller-part-2/</guid>
			</item>
		
			<item>
				<title>Die Roller – A Github Nuget Experiment</title>
				<description>&lt;p&gt;So a few friends of mine recently decided to take up collecting and playing the table-top miniature game Warhammer 40k. I collected a bunch of this stuff when I was a kid and I’m excited to finally have a reason to unpack it from storage and give it another go. Why is this relevant to a development blog? Simply because I now have a reason to make a small little library that would be useful for doing some number crunching related to the die rolls that take place in the game.&lt;/p&gt;

&lt;h2 id=&quot;enter-dieroller&quot;&gt;Enter DieRoller&lt;/h2&gt;

&lt;p&gt;I’ve been looking for an excuse to make something open source and push it to Nuget. Having a simple generic dice rolling library would be a perfect trial run. It gets my feet wet in the building, packing, and pushing process using GitHub and NuGet so it’s a win on both those fronts. If I happen to take it farther and actually utilize it in an app then bonus, but this is more of a learning experience.&lt;/p&gt;

&lt;p&gt;Throughout the process I’ll document my thinking around the implementations of the various required features. I’m certain I’ll end up changing my mind a bunch and refactoring as I go. Who knows how usable it will be when we are done, but it should be a fun journey.&lt;/p&gt;

&lt;h2 id=&quot;requirements&quot;&gt;Requirements?&lt;/h2&gt;

&lt;p&gt;I threw together some basic requirements around what this little library would need to do. The Die Roller library should:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;For a given roll, provide the probability and a simulation of the roll.
    &lt;ul&gt;
      &lt;li&gt;Consider D6 and D3 as those are the main things used in 40k even though 40k references will not be present in this library specifically.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Apply options to the roll such as re-rolling fails or just ones. You can only re-roll once.
    &lt;ul&gt;
      &lt;li&gt;This is an influenced rule from 40k. It is common to be able to re-roll any failed roll or just the ones.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Apply a modifier to the roll such as +1 or -1.&lt;/li&gt;
  &lt;li&gt;By default a roll modifier would come AFTER a re-roll, but ideally this would have an ability to toggle&lt;/li&gt;
  &lt;li&gt;Simulation should provide a roll result of exactly what happened.
    &lt;ul&gt;
      &lt;li&gt;Rolled 5 dice targeting a 3+&lt;/li&gt;
      &lt;li&gt;Roll results 3, 5, 2, 1, 6. Re-rolling 2 &amp;amp; 1. Reroll was 2 &amp;amp; 4.&lt;/li&gt;
      &lt;li&gt;Modifier applied of +1.&lt;/li&gt;
      &lt;li&gt;Final result is 4, 6, 3, 5, 7 meaning all 5 pass the requirement of 3+.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;follow-along&quot;&gt;Follow along&lt;/h2&gt;

&lt;p&gt;If you actually care to I have pushed the first commit up to GitHub here so you can track the progress as we go along. The first commit has almost nothing in it and it already has something I’d like to change in it. I wasn’t kidding when I said I’d probably change my mind a bunch. I’ll write more about that shortly.&lt;/p&gt;

&lt;p&gt;Away we go!&lt;/p&gt;
</description>
				<pubDate>Wed, 12 Jul 2017 00:00:00 +0000</pubDate>
				<link>/2017/07/dieroller-part-1/</link>
				<guid isPermaLink="true">/2017/07/dieroller-part-1/</guid>
			</item>
		
			<item>
				<title>Dev Talks at Work</title>
				<description>&lt;p&gt;&lt;a href=&quot;http://ardalis.com/share-what-you-learn-even-if-youre-not-an-expert&quot;&gt;Steve Smith blogged&lt;/a&gt; a while back about how one of the best times to teach something is while you are learning the topic or right after. You will still remember the steps it took to reach your conclusions and the hardships you found along the way. These are important for those who are also learning and easily forgotten when you’ve been involved in the subject matter for a while. I don’t plan to re-blog his blog, but rather share an experience.&lt;/p&gt;

&lt;h2 id=&quot;sharing-knowledge&quot;&gt;Sharing Knowledge&lt;/h2&gt;

&lt;p&gt;In recent months I have been giving user group style talks at work to share things that I have been learning. I’ve been using the Lunch &amp;amp; Learn style format as to not take too much away from our work day. The first I did was a brief talk to just go over the Solid Principles, but relating it to code we had been writing. Where we were practicing them well and where we could use them to better structure our code.  Most of this wasn’t news for people, but it was nice to put a spotlight on some areas and it sparked some good conversation around improving the code.&lt;/p&gt;

&lt;p&gt;The second one I did this month was on the topic of Swagger and Identity Server. I essentially took my recent &lt;a href=&quot;/2017/02/swagger-identityserver4-part1/&quot;&gt;blog posts&lt;/a&gt; and put it into Demo form. The demo took about 30 min to run through all the steps I had in the blog posts and then I finished with demonstrating how Swagger could make for a mini-UI for an internal tool for developers that we later could throw a real UI around if we cared enough to. This topic also sparked conversation around where we could leverage the API docs that Swagger could generate for us. It was a good session even though I have only scratched the surface on Swagger.&lt;/p&gt;

&lt;h2 id=&quot;practice&quot;&gt;Practice&lt;/h2&gt;

&lt;p&gt;Speaking well takes practice and it is something I’d like to learn to do better. This is one of the reasons I’ve decided to do these internal talks at work. I also have been regularly attending a .NET User group near me and hope to do a short talk there in the near future so this practice is valuable to me. The talk I’m planning for that group is the Swagger one I mentioned above so having a dry run at work to test length of the talk with a group and get a sense for the value people got from it helped me get perspective for how I’d change it up for the User Group version. I definitely have to shorten it up as I went into much more detail at work.&lt;/p&gt;

&lt;h2 id=&quot;just-do-it&quot;&gt;Just Do It!&lt;/h2&gt;

&lt;p&gt;People like to learn and I find it helps to do it in a setting people can ask clarifying questions. Sometimes you’ll know the answer, other times you wont. That’s OK! The things you don’t know the answer to provides potential topics for more learning! Embrace it.&lt;/p&gt;

&lt;h2 id=&quot;final-note&quot;&gt;Final Note&lt;/h2&gt;

&lt;p&gt;Don’t go off and organize this without getting some approval first. Get the OK from your boss as you will be sapping some time away from those that attend if you end up going a little longer. If your topics are on point with sharing knowledge around the direction your boss wants the team to start heading then I doubt you’ll run into problems. I’d lean more towards they’ll appreciate the initiative.&lt;/p&gt;
</description>
				<pubDate>Mon, 26 Jun 2017 00:00:00 +0000</pubDate>
				<link>/2017/06/dev-talks-at-work/</link>
				<guid isPermaLink="true">/2017/06/dev-talks-at-work/</guid>
			</item>
		
			<item>
				<title>Configuring Swagger to handle MediatR Commands and Queries</title>
				<description>&lt;p&gt;If you are following Jimmy Bogard’s style of MediatR commands and queries that he did within his Contoso University example you’ll find that Swagger does not play nice by default with that type of class nesting.&lt;/p&gt;

&lt;p&gt;Snippet Example:
&lt;script src=&quot;https://gist.github.com/dvanherten/d202b1633561639a40ff3d46dc4b799c.js&quot;&gt;&lt;/script&gt;&lt;/p&gt;

&lt;p&gt;Thankfully there is a solution!&lt;/p&gt;

&lt;p&gt;Lets say I have two commands. One called &lt;em&gt;DeleteAllTheThings.cs&lt;/em&gt; and another called &lt;em&gt;DeleteAllTheOtherThings.cs&lt;/em&gt; and both have a nested class called &lt;em&gt;Command&lt;/em&gt;. By default Swagger will start to complain with an error about duplicate schema ids because it is only looking at the Command class of which there are now two. We need something a little more robust than that in how we generate a name. Thankfully when registering Swagger in the Startup.cs we can add an option to customize how Schema Ids get generated.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/dvanherten/fed5f9b0a2a474c05c3417f5bb4f2a71.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;This bit of code is simply using the full name of the type instead and gluing the wrapping class type name with the nested Command or Query. The result is you get a nicely named class in your documentation too!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://dave.vanherten.ca/assets/media/swagger-mediatr3-modeling.png&quot; alt=&quot;swagger-mediatr3-modeling&quot; /&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 27 Mar 2017 00:00:00 +0000</pubDate>
				<link>/2017/03/configuring-swagger-to-handle-mediatr-commands-and-queries/</link>
				<guid isPermaLink="true">/2017/03/configuring-swagger-to-handle-mediatr-commands-and-queries/</guid>
			</item>
		
	</channel>
</rss>
