<?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>Forem: Michael</title>
    <description>The latest articles on Forem by Michael (@codingchuck).</description>
    <link>https://forem.com/codingchuck</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F682759%2Feaf18a43-eb3a-432a-bb54-a299746eef13.jpg</url>
      <title>Forem: Michael</title>
      <link>https://forem.com/codingchuck</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/codingchuck"/>
    <language>en</language>
    <item>
      <title>Docker vs Rancher</title>
      <dc:creator>Michael</dc:creator>
      <pubDate>Mon, 19 Dec 2022 14:49:15 +0000</pubDate>
      <link>https://forem.com/codingchuck/docker-vs-rancher-1blh</link>
      <guid>https://forem.com/codingchuck/docker-vs-rancher-1blh</guid>
      <description>&lt;p&gt;Docker Desktop and Rancher Desktop are both popular tools that allow users to easily deploy and manage containerized applications. Both tools have their own unique features and benefits, but which one is right for you? In this article, we will compare Docker Desktop and Rancher Desktop and provide a list of their pros and cons to help you decide.&lt;/p&gt;

&lt;p&gt;Docker Desktop is a tool designed to make it easy for developers to build and deploy containerized applications. It comes with a variety of features, including the ability to create and manage containers, build and share container images, and run containerized applications on local or remote servers. One of the main benefits of Docker Desktop is its simplicity and ease of use, making it a great tool for developers who are new to containerization.&lt;/p&gt;

&lt;p&gt;On the other hand, Rancher Desktop is a more powerful and feature-rich tool that is designed for larger organizations and enterprise environments. It allows users to easily manage and deploy containerized applications across multiple servers, making it a great tool for teams that need to scale their containerized applications. Rancher Desktop also comes with a variety of features, including the ability to monitor and troubleshoot containerized applications, create and manage multiple environments, and set up automated workflows.&lt;/p&gt;

&lt;p&gt;So, which tool is right for you? Here is a list of the pros and cons of each tool to help you decide:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Docker Desktop:&lt;/strong&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Easy to use and learn, making it great for developers who are new to containerization&lt;/li&gt;
&lt;li&gt;Comes with a variety of features that allow users to create and manage containers and build container images&lt;/li&gt;
&lt;li&gt;Can be used to run containerized applications on local or remote servers&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;May not be as powerful or feature-rich as Rancher Desktop&lt;/li&gt;
&lt;li&gt;May not be suitable for larger organizations or enterprise environments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Rancher Desktop:&lt;/strong&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Powerful and feature-rich tool that is great for larger organizations and enterprise environments&lt;/li&gt;
&lt;li&gt;Allows users to easily manage and deploy containerized applications across multiple servers&lt;/li&gt;
&lt;li&gt;Comes with a variety of features that allow users to monitor and troubleshoot containerized applications, create and manage multiple environments, and set up automated workflows&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;May be more complex and harder to learn for developers who are new to containerization&lt;/li&gt;
&lt;li&gt;May not be suitable for smaller organizations or individual developers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In conclusion, both Docker Desktop and Rancher Desktop are great tools that can be used to manage and deploy containerized applications. If you are a developer who is new to containerization or are working in a small organization, Docker Desktop may be the right choice for you. On the other hand, if you are working in a larger organization or enterprise environment, Rancher Desktop may be the better option due to its power and features. Ultimately, the decision will depend on your specific needs and requirements.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>programming</category>
      <category>devops</category>
    </item>
    <item>
      <title>TypeGuards in TypeScript</title>
      <dc:creator>Michael</dc:creator>
      <pubDate>Mon, 19 Dec 2022 14:30:58 +0000</pubDate>
      <link>https://forem.com/codingchuck/typeguards-in-typescript-2c0g</link>
      <guid>https://forem.com/codingchuck/typeguards-in-typescript-2c0g</guid>
      <description>&lt;p&gt;One useful feature in TypeScript is type guards, which allow you to narrow down the type of a value within a type hierarchy. This can be especially useful when working with complex data structures or when interacting with external libraries.&lt;/p&gt;

&lt;p&gt;To create a type guard in TypeScript, you can use the typeof operator or the instanceof operator. The typeof operator allows you to check if a value is of a certain primitive type, such as number, string, or boolean. The instanceof operator, on the other hand, allows you to check if a value is an instance of a particular class or constructor function.&lt;/p&gt;

&lt;p&gt;Here is an example of using the typeof operator to create a type guard:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;isNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kr"&gt;number&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;typeof&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;number&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;isNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// 4.00&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the isNumber function is a type guard that checks if the value passed to it is of type number. If it is, the function returns true, and the type of x within the if block is narrowed down to number. This allows us to use the toFixed method on x, which is only available on number values.&lt;/p&gt;

&lt;p&gt;Here is an example of using the instanceof operator to create a type guard:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Point&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;y&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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;isPoint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;Point&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nx"&gt;Point&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Point&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;isPoint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`(&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;)`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// (0, 0)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the isPoint function is a type guard that checks if the value passed to it is an instance of the Point class. If it is, the function returns true, and the type of x within the if block is narrowed down to Point. This allows us to access the x and y properties on x, which are only available on Point instances.&lt;/p&gt;

&lt;p&gt;Type guards are a powerful tool in TypeScript that can help you write safer and more reliable code. By narrowing down the type of a value within a type hierarchy, you can avoid runtime errors and take advantage of the type-checking features of TypeScript.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>node</category>
    </item>
  </channel>
</rss>
