<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dane Balia</title>
    <description>The latest articles on DEV Community by Dane Balia (@daneb).</description>
    <link>https://dev.to/daneb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F172549%2F85352b55-585a-4da8-8b81-6ac93075f170.jpeg</url>
      <title>DEV Community: Dane Balia</title>
      <link>https://dev.to/daneb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/daneb"/>
    <language>en</language>
    <item>
      <title>AI Harness Simplified</title>
      <dc:creator>Dane Balia</dc:creator>
      <pubDate>Fri, 31 Jul 2026 10:49:43 +0000</pubDate>
      <link>https://dev.to/daneb/harness-engineering-16ip</link>
      <guid>https://dev.to/daneb/harness-engineering-16ip</guid>
      <description>&lt;p&gt;&lt;strong&gt;Two terms&lt;/strong&gt; are rapidly entering the software vocabulary and they describe two very different answers to the same question: if AI agents write our code, what do we build around them to ensure quality, consistency and reliability?&lt;/p&gt;

&lt;h2&gt;
  
  
  Harness Engineering
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftq7cma0qlgyizbaguetg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftq7cma0qlgyizbaguetg.png" alt="Harness Engineering" width="800" height="607"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A harness is defined as a piece of equipment with straps and belts, used to control or hold in place a person, animal or object. Some examples are a safety harness if you are doing bungee. Or a baby's harness. Historically, a harness was very much associated with draft animals such as horses, oxen, mules and cattle. An ox pulling a plow is typically yoked with a harness. The intent was to harness something effectively. That is: to direct, control, and use its power effectively for a purpose.&lt;/p&gt;

&lt;p&gt;A harness in AI, is everything you put around an AI agent to shape how it works and to check what it produces. The discipline is broken into 3 parts. Guides steer the work forward. These are (a) rules and context files, (b) specs and prompts (c) skills and examples and (d) tools the agent may leverage. The second part is Boundaries - constraints for effective execution. These include sandboxes for isolation, permissions and token budgets. This ensures that the agent is constrained to run safely, but also run in a loop within some predefined resource limitations. The&lt;br&gt;
final part is Sensors. These verify the result. This is done with compilers, linters, tests, security scans and increasingly AI reviewers.&lt;/p&gt;

&lt;p&gt;Harness engineering is the craft of combining these deliberately. Early evidence suggests it reduces token consumption, makes output markedly more consistent, and that specific named instructions dramatically outperform general guidance. But there's a catch: the most effective harnesses appear to be those co-developed with their backing models. Harness and model trained and tested together. That's part of why Claude Code punches above its weight, and it raises an uncomfortable question for us around our own.&lt;/p&gt;

&lt;h2&gt;
  
  
  Software Factory
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnpgwh77ai5huhdu2kskp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnpgwh77ai5huhdu2kskp.png" alt="Software Factory" width="800" height="543"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A factory is a set of buildings where large amounts of goods are made using machines. A software factory is the same idea, where a set of systems are integrated to build, verify and release software repeatedly and at scale, with AI agents as machinery.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;software factory&lt;/strong&gt; is the harness taken to its logical extreme: remove the humans. A backlog of work items feeds an orchestrator. An orchestrator dispatches an agent swarm to do the various parts of the work. Automated checks gate the output - AI reviews the AI's work and merges it. Deployment is continuous. And telemetry or feedback generates the next tickets. The loop runs and closes without a person standing anywhere on the line of production. Its promise is throughput. Code generation around the clock at near-zero marginal human cost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Harness engineering&lt;/strong&gt; will mature into a discipline - from individual craft to team practice and then platform capability, with shared harness components governed centrally and judgement federated back to the teams on the ground. Two problems will define these steps forward, sensor integrity. That is, how accurate, useful and reliable are the sensors we build. The second is, calibration - AI judges are proliferating faster than anyone is measuring them, and the harnesses that endure will be the ones that score their automated reviewers (AI) against human decisions over time and improve through it.&lt;/p&gt;

&lt;p&gt;Software factories will find their niche and their ceiling. Factories are genuinely viable when correctness is cheap to verify, and errors are cheap to reverse - transactional back-ends, legacy rewrites governed by strong conformance test suites and internal tooling. The ceiling is structural. Today's models are trained against fast signals - does it compile, do tests pass, and are lint checks clean. However, what they do not cater for is design, maintainability, fidelity to intent and these things will surface over the months for which no automation checks. A factory has no station for slow signals, so it doesn't fail loudly. It instead accrues debt silently behind green checkmarks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
The two concepts are not rivals so much as two settings of one dial: how much do we let an agent decide, and how we stay confident in what it does? The answer depends on the situation. If you can check the result cheaply and trust the check, the agent can be given more freedom. If checking is hard or mistakes are expensive, keep the leash short. We need to place human judgement where it matters most - saying what correct means at the start, and making the final call at the end. But we must also regularly test whether the automated judges in between can still be trusted.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>discuss</category>
    </item>
    <item>
      <title>The Human Is Not the Bottleneck. The Human Is the Missing Oracle</title>
      <dc:creator>Dane Balia</dc:creator>
      <pubDate>Fri, 31 Jul 2026 10:39:30 +0000</pubDate>
      <link>https://dev.to/daneb/the-human-is-not-the-bottleneck-the-human-is-the-missing-oracle-43lh</link>
      <guid>https://dev.to/daneb/the-human-is-not-the-bottleneck-the-human-is-the-missing-oracle-43lh</guid>
      <description>&lt;p&gt;We spent a year optimising the wrong bottleneck.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;harness discourse&lt;/strong&gt; has been relentless - blueprints, schematics, thought leadership. Impressive engineering, most of it. But read the designs closely and you notice what they're all quietly aiming at: getting the developer out of the pipeline.&lt;/p&gt;

&lt;p&gt;The logic seemed sound. Building dropped from days to minutes, and the human became the slow part. The bottleneck. So we designed the human out.&lt;/p&gt;

&lt;p&gt;Then the &lt;em&gt;telemetry arrived&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Faros AI instrumented 22,000 developers across 4,000+ teams. Moving from low to high AI adoption: task completion per developer up 34%, epics up 66%. Real gains. Also: bugs per developer up 54%, incidents per pull request up 243%, median review time up 5x, and 31% more PRs merging with no review at all.&lt;/p&gt;

&lt;p&gt;Nobody decided to stop reviewing. Reviewers simply couldn't keep pace, and unread merges became normal. We knew this failure before AI. The 2,000-line PR lands in your inbox, and what follows is frustration, cognitive overload, and a silent rubber stamp. The difference is that it used to be the exception. Now it's the throughput model.&lt;/p&gt;

&lt;p&gt;The bottleneck didn't disappear. It moved to review and integration - and we'd already removed the person who was supposed to be standing there when it arrived.&lt;/p&gt;

&lt;p&gt;Two things worth saying plainly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First:&lt;/strong&gt; the human was never the bottleneck. The human is the missing oracle.&lt;/p&gt;

&lt;p&gt;We have fast, cheap oracles for correctness. Do the tests pass? Does it lint? Machine-verifiable in seconds. We have no oracle at all for maintainability, intent, or design - and no benchmark I'm aware of currently measures them. GitClear's analysis of 623 million code changes shows what fills that gap: duplication up 81%, refactoring down 70%, error-masking constructs up 47%. Code that looks right and is structurally wrong.&lt;/p&gt;

&lt;p&gt;Designing the human out doesn't remove a cost. It removes the only sensor we have for the slowest and most expensive failure mode. "Humans first" isn't sentiment or ethics-washing. It's a claim about where verification capability actually resides right now.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Second:&lt;/strong&gt; we're borrowing against comprehension and calling it velocity.&lt;/p&gt;

&lt;p&gt;Anthropic ran a controlled trial in January. Two groups, same unfamiliar library. The AI-assisted group finished marginally faster and scored 50% on comprehension. The manual group scored 67%. Seventeen points, on code they had written minutes earlier (this is a vendor publishing a result against it's own commercial interest).&lt;/p&gt;

&lt;p&gt;That debt doesn't show up in your DORA metrics. It shows up at 2am when nobody on the call can reason about the system they shipped.&lt;/p&gt;

&lt;p&gt;The industry response is to build faster agents. So I built the opposite experiment. A harness that puts the human at the centre - not to slow things down, but to make judgment cheap, timely and measurable rather than optional. You can check out the harness &lt;a href="https://github.com/daneb/harness" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Plain bash. Deliberately crude. Built to learn, not to scale.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The rules:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Agents don't move artefacts through the SDLC. They hit mechanical gates.&lt;/li&gt;
&lt;li&gt;Humans state intent, write the spec, define acceptance criteria, and read the diff.&lt;/li&gt;
&lt;li&gt;Route every check to the cheapest reliable verifier - mechanical gates for what's machine-checkable, calibrated LLM judges only after validation against human labels with explicit thresholds, humans for intent and design.&lt;/li&gt;
&lt;li&gt;Diff budget: 200 lines. (Which became 400, excluding tests). If it's more than 400 lines, the feature was scoped wrong. The gate fails and the work gets split.&lt;/li&gt;
&lt;li&gt;Only iterate on the harness with confirmed evidence and root cause.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thirty minutes on an approved spec and a design sketch turns a six-hour adversarial review into a twenty-minute confirmation. The human isn't reviewing more. They're reviewing earlier, where a one-line correction prevents two thousand lines of rework.&lt;/p&gt;

&lt;p&gt;237 minutes. 12 features. One engineer, no control group - an experiment, not evidence. I'm publishing the method so it can be argued with. &lt;/p&gt;

&lt;p&gt;DORA's finding is that AI is an amplifier: it magnifies whatever your organisation already is. If your answer to a 243% rise in incidents per PR is to remove the last human who might have caught them, the amplifier is working exactly as designed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are you actually measuring?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
    </item>
    <item>
      <title>.NET Core: Deploy exe as Service</title>
      <dc:creator>Dane Balia</dc:creator>
      <pubDate>Fri, 04 Sep 2020 15:14:13 +0000</pubDate>
      <link>https://dev.to/daneb/net-core-deploy-exe-as-service-5eh3</link>
      <guid>https://dev.to/daneb/net-core-deploy-exe-as-service-5eh3</guid>
      <description>&lt;p&gt;So you've built a .NET core executable, it's long running (&lt;strong&gt;while(true)&lt;/strong&gt;) and is ready for deploy to your server. Your initial process involves a manual network copy and some wiring on the server to ensure it runs as a service. Maybe a service wrapper? 🐱‍🚀 After a few refactors and bug fixes with multiple deploys, the process starts to feel a bit like smuggling sand across the Kalahari Desert.&lt;/p&gt;

&lt;p&gt;We need a hero.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F72j56xsff1asxy0nei3v.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F72j56xsff1asxy0nei3v.jpg" alt="Alt Text" width="600" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So let's get to it. The hero of choice for this adventure movie is &lt;a href="https://github.com/ansible/ansible" rel="noopener noreferrer"&gt;Ansible&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Requirements:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;WSL2 (running Ubuntu)&lt;/li&gt;
&lt;li&gt;Visual Studio Code / Studio&lt;/li&gt;
&lt;li&gt;A Linux server  / localhost &lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html#action-check-your-ssh-connections" rel="noopener noreferrer"&gt;SSH access via authorized key&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is Ansible&lt;/li&gt;
&lt;li&gt;Install Ansible&lt;/li&gt;
&lt;li&gt;Setup our configuration structure&lt;/li&gt;
&lt;li&gt;Define our Recipe&lt;/li&gt;
&lt;li&gt;Deploy 🎇&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 1: What is Ansible?
&lt;/h2&gt;

&lt;p&gt;--snip snip--&lt;br&gt;
Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems&lt;/p&gt;

&lt;p&gt;In order words, it's our deploy tool.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 2: Installing Ansible
&lt;/h2&gt;

&lt;p&gt;Installation on your flavor of Linux is nothing more than,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# &amp;lt;your package manager&amp;gt; install ansible
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Ubuntu the following would work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apt update
$ sudo apt install software-properties-common
$ sudo apt-add-repository --yes --update ppa:ansible/ansible
$ sudo apt install ansible
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The installation is not a service but nothing more than a set of executables that you will use to feed a basic recipe to configure the deployment process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Setup our configuration structure
&lt;/h2&gt;

&lt;p&gt;For those who would like to follow on without writing any code I've included a &lt;a href="https://github.com/daneb/InfiniteHelloWorlds" rel="noopener noreferrer"&gt;Github repository&lt;/a&gt; with the sample.&lt;/p&gt;

&lt;p&gt;In my project I usually create a deploy folder as a form of separating concerns. Thereafter, I create my &lt;a href="https://wiki.debian.org/systemd/Services" rel="noopener noreferrer"&gt;SystemD&lt;/a&gt; service file that we will setup on our remote host so we can stop and start our service. You can find a sample service file &lt;a href="https://github.com/daneb/InfiniteHelloWorlds/blob/master/InfiniteHelloWorlds/Deploys/infinitehelloworlds.service" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fee7f21bsv22dv2vg4yug.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fee7f21bsv22dv2vg4yug.png" alt="Alt Text" width="799" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next we will create a playbook YAML file that will be our configuration, and a hosts YAML file that will represent the host/s we want to deploy too.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fayf3bfnmrlbm5xcz3kla.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fayf3bfnmrlbm5xcz3kla.png" alt="Alt Text" width="800" height="145"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Okay so now we have all we need, let's do the configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Define Our Recipe
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Host configuration
&lt;/h3&gt;

&lt;p&gt;Edit your &lt;a href="https://github.com/daneb/InfiniteHelloWorlds/blob/master/InfiniteHelloWorlds/Deploys/hosts.yml" rel="noopener noreferrer"&gt;hosts.yml&lt;/a&gt; in the Deploys folder to match the following. This basically supports a configuration of one or more hosts that we could deploy our service too.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fed53a84fp0ty1ftvs96p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fed53a84fp0ty1ftvs96p.png" alt="Alt Text" width="395" height="190"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Line 4 is probably the most important as it's the key cross reference (custom name) we leverage in our play book or recipe for the deployment. For more information on configuring your inventory, check out the &lt;a href="https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html" rel="noopener noreferrer"&gt;ansible documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;** Be advised you can do this cleanly with an Ansible task, but I haven't, so you will need to create the remote directory or production folder on the remote host.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deployment playbook
&lt;/h3&gt;

&lt;p&gt;Edit your &lt;a href="https://github.com/daneb/InfiniteHelloWorlds/blob/master/InfiniteHelloWorlds/infinitehelloworlds.yml" rel="noopener noreferrer"&gt;playbook file&lt;/a&gt; and lets add the following code. Anything related to "InfiniteHelloWorlds" can be replaced with your executable name. Just remember, Linux is case sensitive.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4i4l7kcjs9gtsawwk017.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4i4l7kcjs9gtsawwk017.png" alt="Alt Text" width="722" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;hosts&lt;/em&gt; - is that cross reference we mentioned earlier from the hosts.yml.&lt;br&gt;
&lt;em&gt;vars&lt;/em&gt; - represent our variables that will use within the configuration itself, the tasks. The production folder is the destination folder of the host to which you will deploy. The linux_release_path is the location of the executable after a dotnet publish as per below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ dotnet publish --framework netcoreapp3.1 --runtime linux-x64 -c Release
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next aspect are the actual &lt;em&gt;tasks&lt;/em&gt;. This configuration will drive the work of deployment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwcabz0mj4evhbp3tnht2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwcabz0mj4evhbp3tnht2.png" alt="Alt Text" width="799" height="238"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are many kinds of tasks in ansible that apply to deploys for  Windows and Linux, you can check that out &lt;a href="https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#tasks-list" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/daneb/InfiniteHelloWorlds/blob/master/InfiniteHelloWorlds/infinitehelloworlds.yml" rel="noopener noreferrer"&gt;tasks are broken&lt;/a&gt; down into the following functionality,&lt;/p&gt;

&lt;h4&gt;
  
  
  Task Steps by Name
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;Compress directory before send&lt;/em&gt;: Compress published directory found in working directory of .NET Core project.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Stop service&lt;/em&gt;: &lt;strong&gt;If the first deploy, you may want to comment this out as the service has not been setup on the host.&lt;/strong&gt; This is there for ongoing deployments. This can also be done via an Ansible task.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Copy release files to host&lt;/em&gt;: will then copy the archive/zip to the remove host to the production folder specified in the &lt;strong&gt;vars&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Unarchive the code&lt;/em&gt;: involves un-compressing the archive onto the local disk of the host.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Copy systemd file&lt;/em&gt;: will then copy from the local unarchived file contents the service file and configure the service by placing the .service file in the &lt;strong&gt;SystemD&lt;/strong&gt; configuration folder.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Restart the service&lt;/em&gt;: lastly, call restart on the service.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And there you have it. All configured and ready to deploy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Deploy
&lt;/h2&gt;

&lt;p&gt;Let's deploy in the project folder (not solution).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ansible-playbook infinitehelloworlds.yml -i Deploys/hosts.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That should lead to a fully deployed service, and this is what success will look like.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzi9tj8cic7ced5tmyii7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzi9tj8cic7ced5tmyii7.png" alt="Alt Text" width="800" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have just really touched on the basics today, and this is still pretty rudimentary and not resilient enough. But it's sufficient for a good start and a foundation for more advanced deploys.&lt;/p&gt;

&lt;h3&gt;
  
  
  Debugging
&lt;/h3&gt;

&lt;p&gt;To troubleshoot the running of your service, you can stop and start the service separately; run the deploy with verbose output, execute a specific step or even run test commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ansible-playbook --help
$ ansible-playbook InfiniteHelloWorlds/Deploys/infinitehelloworlds.yml -v
$ systemctl stop infinitehelloworlds
$ systemctl start infinitehelloworlds
$ journalctl --lines 100 
$ ansible all -m ping
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;HTH!&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>ansible</category>
      <category>dotnet</category>
      <category>deployment</category>
    </item>
    <item>
      <title>Research Methods At A Glance</title>
      <dc:creator>Dane Balia</dc:creator>
      <pubDate>Mon, 30 Dec 2019 08:54:44 +0000</pubDate>
      <link>https://dev.to/daneb/research-methods-distilled-hjm</link>
      <guid>https://dev.to/daneb/research-methods-distilled-hjm</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgs70z54yotgaokusau12.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgs70z54yotgaokusau12.jpg" alt="Research Methods " width="800" height="582"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>career</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Light bulbs of the week (Week 51 2019)</title>
      <dc:creator>Dane Balia</dc:creator>
      <pubDate>Fri, 20 Dec 2019 09:33:33 +0000</pubDate>
      <link>https://dev.to/daneb/light-bulbs-of-the-week-week-51-2019-ee5</link>
      <guid>https://dev.to/daneb/light-bulbs-of-the-week-week-51-2019-ee5</guid>
      <description>&lt;h2&gt;
  
  
  What did I learn this week?
&lt;/h2&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Monolith vs Micro-kernel&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5sxvfd9jpq43cvvsh8e5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5sxvfd9jpq43cvvsh8e5.jpg" alt="Comparison" width="800" height="1021"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Outcomes over Output&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=NfrxSOtUWqI&amp;amp;feature=youtu.be" rel="noopener noreferrer"&gt;How to reason about value&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdb6plsndumef8ffuh88m.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdb6plsndumef8ffuh88m.jpg" alt="Outcome" width="800" height="1024"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>agile</category>
      <category>kernel</category>
      <category>linux</category>
      <category>windows</category>
    </item>
    <item>
      <title>Quick Tour of C# Generic Type Constraints</title>
      <dc:creator>Dane Balia</dc:creator>
      <pubDate>Fri, 02 Aug 2019 14:41:10 +0000</pubDate>
      <link>https://dev.to/daneb/quick-tour-of-c-generic-type-constraints-3l5h</link>
      <guid>https://dev.to/daneb/quick-tour-of-c-generic-type-constraints-3l5h</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/daneb/quick-tour-of-generics-in-c-2fea"&gt;Last time&lt;/a&gt; we looked at some fundamentals to Generics. Let's peel a little more of the onion regarding Generics and consider Type Constraints.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A &lt;em&gt;Type Constraint&lt;/em&gt; is the restriction imposed on a type used by a generic.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AGenericClass&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IComparable&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UsingEnum&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Enum&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GenericList&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Constraints inform the compiler about the capabilities a type argument must have by restricting it. Without any constraints, the type argument could be any type. Imposing the constraint/s on the generic &lt;em&gt;increases the number of allowable operations and method calls to those supported by the constraining type and all types in its inheritance hierarchy&lt;/em&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Clarification
&lt;/h3&gt;

&lt;p&gt;So if I had a wooden drawer, it could pretty much take anything. In fact, it would most likely be very difficult to order things and keep things in their place. And with the continual opening and closing of the drawer, one is also unlikely to efficiently access their papers, pens, rulers, stapler etc.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fwww.stevesshelves.com%2Fwp-content%2Fuploads%2F2012%2F06%2FLogo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fwww.stevesshelves.com%2Fwp-content%2Fuploads%2F2012%2F06%2FLogo.png" alt="Drawer" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
But assume we have a drawer compartmentalized by inner linings of wood. All of a sudden, things have a place and are more structured in terms of access. And this is what Type constraints do. They impose restrictions to provide a more human and safe interface to the Generic type - &amp;lt;T&amp;gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqpt494u93geb4qsfef5z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqpt494u93geb4qsfef5z.png" alt="Seven Constraints" width="800" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are 7 constraints one could consider when using a Generic, so let's review a few to get an idea of how to use them.&lt;/p&gt;
&lt;h3&gt;
  
  
  Value Type Constraint
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This constrains the type argument to a value and not a reference type.&lt;br&gt;
Examples of what would be &lt;em&gt;valid&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Votes&amp;lt;int&amp;gt;&lt;/li&gt;
&lt;li&gt;UploadedFiles&amp;lt;FileMode&amp;gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Examples of what would be &lt;em&gt;invalid&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Swap&amp;lt;object&amp;gt;&lt;/li&gt;
&lt;li&gt;ReportContent&amp;lt;StringBuilder&amp;gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Reference Type Constraint
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This constrains the type argument to be a reference type and not a value type.&lt;br&gt;
Examples are simply the reverse of what we just saw in the &lt;strong&gt;Value Type Constraint&lt;/strong&gt;. That is, the type argument &amp;lt;T&amp;gt; can be any class, interface, array or delegate.&lt;/p&gt;
&lt;h3&gt;
  
  
  Constructor Type Constraint
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This constrains the type argument to have a public parameter-less constructor. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;snip taken from &lt;a href="https://csharpindepth.com/" rel="noopener noreferrer"&gt;C# in Depth&lt;/a&gt;&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="n"&gt;CreateInstance&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;()&lt;/span&gt; &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;T&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This methods returns a new instance of whatever type you specify, constrained of course by the fact that the type must have no parameters in its constructor. This is a useful constraint when working with the &lt;a href="https://sourcemaking.com/design_patterns/factory_method" rel="noopener noreferrer"&gt;Factory Method Design Pattern&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Sample Using Interface Constraint
&lt;/h3&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;In the sample above, we see the creation of a rudimentary &lt;a href="https://docs.microsoft.com/en-us/dotnet/csharp/tuples" rel="noopener noreferrer"&gt;Tuple&lt;/a&gt;. The type &lt;em&gt;MyTuple&lt;/em&gt; has an &lt;em&gt;interface type constraint&lt;/em&gt;. Thus the type argument must be or implement &lt;a href="https://docs.microsoft.com/en-us/dotnet/api/system.iequatable-1?view=netframework-4.8" rel="noopener noreferrer"&gt;IEquatable&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;When developing our &lt;em&gt;MyTyple&lt;/em&gt;; &lt;strong&gt;IEquatable&lt;/strong&gt; enforces the following constraints: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You must implement it's method - Equals(&amp;lt;T&amp;gt;)&lt;/li&gt;
&lt;li&gt;And you should override the base class implementations of Equals(Object) and GetHashCode() so that their behaviour is consistent with that of the Equals(&amp;lt;T&amp;gt;) method.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There are four main generic interfaces for comparisons, two of them &lt;strong&gt;IComparer&amp;lt;T&amp;gt;&lt;/strong&gt; and &lt;strong&gt;IComparable&amp;lt;T&amp;gt;&lt;/strong&gt; are about comparing values and for ordering. That is, one value &amp;lt;=, =&amp;gt; or == too another.&lt;/p&gt;

&lt;p&gt;The other two, &lt;strong&gt;IEqualityCompare&amp;lt;T&amp;gt;&lt;/strong&gt; and &lt;strong&gt;IEquatable&amp;lt;T&amp;gt;&lt;/strong&gt; are used for comparing two items for equality to some criteria and applying a hash of an item.&lt;/p&gt;

&lt;p&gt;The consumer of the code is constrained by a contract that describes the bounds of the generic. So while the generic is supportive of variations of a kind (or type) it is prescriptive around what it should do or be capable off.&lt;/p&gt;

&lt;h3&gt;
  
  
  Last words
&lt;/h3&gt;

&lt;p&gt;Generic type constraints are nothing more then the restrictions imposed on generic types preventing abuse, but also clearly communicating the constraints for its use and providing compile-time errors.&lt;/p&gt;

&lt;h4&gt;
  
  
  For more depth, please see the resource below:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.c-sharpcorner.com/article/story-of-equality-in-net-part-three/" rel="noopener noreferrer"&gt;Introduction to IEquatable&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blogs.msdn.microsoft.com/jaredpar/2009/01/15/if-you-implement-iequatablet-you-still-must-override-objects-equals-and-gethashcode/" rel="noopener noreferrer"&gt;You must implement Equal and HashCode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.iequalitycomparer-1?view=netframework-4.8" rel="noopener noreferrer"&gt;IEquality Interface&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/generics/constraints-on-type-parameters#why-use-constraints" rel="noopener noreferrer"&gt;Why use constraints?&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>csharp</category>
      <category>deepdive</category>
      <category>nuggets</category>
    </item>
    <item>
      <title>Quick Tour Of Generics In C#</title>
      <dc:creator>Dane Balia</dc:creator>
      <pubDate>Fri, 19 Jul 2019 10:30:09 +0000</pubDate>
      <link>https://dev.to/daneb/quick-tour-of-generics-in-c-2fea</link>
      <guid>https://dev.to/daneb/quick-tour-of-generics-in-c-2fea</guid>
      <description>&lt;p&gt;Generics have been around since C# 2.0 and has become a tool we leverage so naturally now in C# we almost don't even think about it. So let's change that...&lt;/p&gt;

&lt;h3&gt;
  
  
  Definitions
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Generics introduce to the .NET Framework the concept of type parameters, which make it possible to design classes and methods that defer the specification of one or more types until the class or method is declared and instantiated by client code&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;Essentially generics allow you parameterize types and methods. Just as normal methods have &lt;em&gt;parameters&lt;/em&gt; to tell them what &lt;em&gt;values&lt;/em&gt; to use, generic types and methods have &lt;em&gt;type parameters&lt;/em&gt; to tell them what &lt;em&gt;types&lt;/em&gt; to use. &lt;/p&gt;

&lt;h3&gt;
  
  
  Clarification
&lt;/h3&gt;

&lt;p&gt;Type parameters are placeholders for a type.&lt;/p&gt;

&lt;p&gt;There are &lt;em&gt;constructed types&lt;/em&gt; and &lt;em&gt;generic types&lt;/em&gt;.&lt;br&gt;
A constructed type is when the type arguments are specified. For example,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Dictionary&amp;lt;int, string&amp;gt;()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;A generic type is when the type arguments are not specified. For example,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Dictionary&amp;lt;TKey, TValue&amp;gt;()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;As per the code snippet below, writing a method to swap two &lt;em&gt;Integer&lt;/em&gt; values is pretty rudimentary. But what if later we needed to do the very same but with &lt;em&gt;Strings&lt;/em&gt;. This would result in two methods, or perhaps overloads.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;Generics to the rescue. We've isolated the type as a form of abstraction (&lt;code&gt;T&lt;/code&gt;) to act as a placeholder for the type we intend to use.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;When the method is actually called, that placeholder is replaced with the type of the values used.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The value of Generics here is that it grants you &lt;em&gt;productivity&lt;/em&gt; improvements, &lt;em&gt;expressiveness&lt;/em&gt; and moves some safety concerns from &lt;em&gt;execution time to compile time&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Note the two ways in which the &lt;em&gt;method&lt;/em&gt; can be called. One with the type explicit, and the other implicit through &lt;em&gt;type inference&lt;/em&gt;. The compiler is inferring the &lt;em&gt;type parameters&lt;/em&gt; based on the method arguments you pass.&lt;/p&gt;

&lt;p&gt;A &lt;em&gt;generic&lt;/em&gt; is simply a placeholder for a type.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>deepdive</category>
      <category>nuggets</category>
    </item>
    <item>
      <title>C# Value and Reference Types</title>
      <dc:creator>Dane Balia</dc:creator>
      <pubDate>Fri, 28 Jun 2019 08:43:50 +0000</pubDate>
      <link>https://dev.to/daneb/do-you-really-grok-value-and-reference-types-eck</link>
      <guid>https://dev.to/daneb/do-you-really-grok-value-and-reference-types-eck</guid>
      <description>&lt;p&gt;&lt;strong&gt;Value&lt;/strong&gt; and &lt;strong&gt;Reference&lt;/strong&gt; types are covered frequently all over the internet, in blog posts, technical articles and forums. Why? Because it's easy to develop software for a long time without stopping to 'smell the roses'. Or in this case, understand what they are and how they work. So here's a note to self, or you.  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A &lt;strong&gt;Value Type&lt;/strong&gt; is some object that is the information itself.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;Reference Type&lt;/strong&gt; is the details which points to an object containing the information. The details include things like type of object etc. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  An Analogy:
&lt;/h2&gt;

&lt;p&gt;Let's set the table with an analogy. Kim has just written a book. It's an auto-biography. She would like to get feedback so she prints a copy at home and gives it to her husband Kanya. Later that day she stumbles onto a publicist, who is intrigued and asks to read it. She fires up her Macbook and shares the link to the original via Google Drive.&lt;/p&gt;

&lt;p&gt;As time passes the publicist feeds back and is thoroughly impressed. She has highlighted a slew of spelling mistakes and a consideration for re-writing Chapter 4. Kim goes to work immediately and in a few days is done. Updating the original and requesting that the publicist review her changes. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So what's this got to do with value and reference types?&lt;/strong&gt;&lt;br&gt;
Well, when Kim made Kanya a physical copy of the original. She provided him with an independent version of the truth. In fact after all her changes during her engagement with the publicist, Kanya's copy has now become outdated and obsolete. He had a &lt;strong&gt;value type&lt;/strong&gt;. An independent copy of the source, that was detached and indifferent to modifications of the source.&lt;/p&gt;

&lt;p&gt;The publicist on the other hand, well she had a Google Drive URL, a &lt;strong&gt;reference&lt;/strong&gt; to the original. In fact as Kim made changes the publicist could see those changes in real time. The &lt;strong&gt;reference&lt;/strong&gt; provided access to the original but was not the original. &lt;/p&gt;

&lt;h2&gt;
  
  
  Some Examples
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Array types are reference types, even if the element type is a value type (so int[] is still a reference type, even though &lt;strong&gt;int&lt;/strong&gt; is a value type)&lt;/li&gt;
&lt;li&gt;Enumerations are value types.&lt;/li&gt;
&lt;li&gt;Delegates are reference types.&lt;/li&gt;
&lt;li&gt;Interfaces are reference types, but they can be implemented as values.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Stack vs Heap
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;References types live on the Heap.&lt;br&gt;
Value types lives where their declared. &lt;br&gt;
Local variables and method parameters live on the Stack.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A &lt;strong&gt;Stack&lt;/strong&gt; is a simple FIFO memory structure. When a method is invoked, the CLR bookmarks the top of the stack. The method then pushes data onto the stack as it executes. When the method completes the CLR just resets the stack to it's previous bookmark. &lt;/p&gt;

&lt;h3&gt;
  
  
  Stack offers:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;very fast access&lt;/li&gt;
&lt;li&gt;space is managed efficiently by CPU, memory will not be fragmented&lt;/li&gt;
&lt;li&gt;local variables only&lt;/li&gt;
&lt;li&gt;limit on memory size&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A &lt;strong&gt;Heap&lt;/strong&gt; is a random jumble of objects not managed by automatically for you. It is a free-floating region of memory (and is larger). In multi-threaded applications each thread will have its own stack. But all the different threads will share the heap.&lt;/p&gt;

&lt;h3&gt;
  
  
  Heap Offers:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;variables can be accessed globally&lt;/li&gt;
&lt;li&gt;no limit on memory size&lt;/li&gt;
&lt;li&gt;(relatively) slower access&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's critical to note, that a value type lives where it's declared, so if you have a class with an instance variable of float, a value type. It will live wherever the rest of the object is found and that is on the heap.&lt;/p&gt;

&lt;p&gt;A last point, is that a string in C# is a reference type. Why? Because strings can be grow quite large in size and thus have to stored on the heap. &lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://vegibit.com/reference-types-and-value-types-in-c/" rel="noopener noreferrer"&gt;Reference Types and Value Types in C - Vegitbit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://csharpindepth.com/" rel="noopener noreferrer"&gt;C# In Depth - Jon Skeet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.albahari.com/valuevsreftypes.aspx" rel="noopener noreferrer"&gt;Values vs Reference Types - Joseph Albahari&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.programmerinterview.com/data-structures/difference-between-stack-and-heap/" rel="noopener noreferrer"&gt;Difference between Stack and Heap&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>csharp</category>
      <category>deepdive</category>
    </item>
    <item>
      <title>C#'s Type System</title>
      <dc:creator>Dane Balia</dc:creator>
      <pubDate>Fri, 21 Jun 2019 12:53:56 +0000</pubDate>
      <link>https://dev.to/daneb/c-s-type-system-3cij</link>
      <guid>https://dev.to/daneb/c-s-type-system-3cij</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;Exploring the Terminology:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;C# 1's type system is static, explicit, and safe.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Statically&lt;/strong&gt; typed is where each variable is of a particular type, and that type is known at compile time. In other words, the compiler does type checking at compilation time.&lt;/p&gt;

&lt;p&gt;In the test method &lt;em&gt;StaticTypeWontCompile()&lt;/em&gt; you can see the string "Hello". But because we gave it the type Object, the compiler sees its type as Object and not String. Hence the &lt;em&gt;.Length&lt;/em&gt; method being unavailable. This test won't run because the compiler will state &lt;strong&gt;object does not contain a definition for 'Length'&lt;/strong&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Explicitly Typed&lt;/strong&gt; is where the type of every variables must be explicitly stated. Of course, explicit vs implicit types is only relevant in statically typed languages.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Safe Type System&lt;/strong&gt; is the characteristic of code that allows the developer to be certain that a value or object will exhibit certain properties so that he/she can use it in a specific way without fear of unexpected or undefined behavior. &lt;/p&gt;

&lt;p&gt;In the method &lt;em&gt;ThisIsSafe()&lt;/em&gt; the compiler will clearly state that an &lt;em&gt;Operator '+' cannot be applied to operands of type 'int' and 'bool'&lt;/em&gt;. This safety applies for the majority of C# up until we get to Collections, Inheritance, Overriding and Interfaces as witnessed in method &lt;em&gt;ThisIsUnsafe&lt;/em&gt; which compiles perfectly.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
 

&lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://csharpindepth.com/" rel="noopener noreferrer"&gt;C# In Depth - Jon Skeet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/859186/why-is-c-sharp-statically-typed" rel="noopener noreferrer"&gt;StackOverflow Why Is CSharp Statically Typed&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/2437469/what-is-type-safe-in-net" rel="noopener noreferrer"&gt;StackOverflow What is Type Safey in .NET&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/types/" rel="noopener noreferrer"&gt;C#s Type System - Microsoft Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>csharp</category>
      <category>deepdive</category>
    </item>
  </channel>
</rss>
