<?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: Royce</title>
    <description>The latest articles on DEV Community by Royce (@royce_reed).</description>
    <link>https://dev.to/royce_reed</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%2F816771%2F7a597b75-a2b6-4090-a9d4-ced9a227ebd6.jpeg</url>
      <title>DEV Community: Royce</title>
      <link>https://dev.to/royce_reed</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/royce_reed"/>
    <language>en</language>
    <item>
      <title>Java as a Second (or third) language</title>
      <dc:creator>Royce</dc:creator>
      <pubDate>Wed, 06 Jul 2022 19:42:53 +0000</pubDate>
      <link>https://dev.to/royce_reed/java-as-a-second-or-third-language-4knk</link>
      <guid>https://dev.to/royce_reed/java-as-a-second-or-third-language-4knk</guid>
      <description>&lt;p&gt;       I started my coding journey a little under a year ago and when I was deciding on which language I wanted to learn, several people stated, “It doesn’t really matter which language you pick; just pick one and stick with it”. Of course, others named specific languages for various reasons, “Choose Python because the syntax is the most beginner friendly” or “Choose C or C++ because learning those will give you a better understanding of programming as a whole”. Both are valid points. I happened to choose JavaScript (which is to be differentiated from Java) because I saw it as the pragmatic choice, that which could land me a job the quickest (being one of the most widely used programming languages out there). Recently, I began exploring other languages and tossing around the idea of which I’d like to take on as a second language. I’m not certain that I’d take on this challenge immediately but it exciting to poke around and see what’s out there. After exploring, the language that kept sparking my interest was Java. After doing some research I thought it might be nice to present my findings to other beginner/intermediate programmers curious about the Java programming language.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;History&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;       Java is a class-based (more in this later), object-oriented programming language, multithreaded programming language, designed to have as few implementation dependencies as possible. Considered a general-purpose language, it was created with the motto “write once, run anywhere”, meaning after compiled it can run one any platform that supports Java. Java was developed in the early 1990s by &lt;a href="https://www.javatpoint.com/james-gosling-father-of-java"&gt;James Gosling&lt;/a&gt;, and his team, at Sun Microsystems. It was originally designed for interactive television but was too advanced for the industry at the time, it was best suited for internet programming and later incorporated by Netscape. Java is largely inspired by the C language family and shares similar syntax so that programmers would recognize it more easily. It is architecture neutral and dynamic and runs on everything from laptops to data centers, game consoles, and supercomputers.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;Getting Started&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;       Writing your first Java program is relatively straight forward. If you use VSCode as your IDE, download the &lt;a href="//vscode:extension/vscjava.vscode-java-pack"&gt;&lt;code&gt;Java Extension Pack&lt;/code&gt;&lt;/a&gt;, open the command prompt &lt;code&gt;Ctrl + Shift + P&lt;/code&gt; and enter the command &lt;code&gt;Java: Tips for Beginners&lt;/code&gt; to download a Java Development Kit (JDK). I'm going to use &lt;a href="https://adoptium.net/"&gt;Eclipse Adoptium's Temurin&lt;/a&gt;. After it's installed, &lt;a href="https://code.visualstudio.com/docs/java/java-tutorial#_creating-a-source-code-file"&gt;create a source code file&lt;/a&gt;. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Create a folder for your Java program and open the folder with VS Code. Then in VS Code, create a new file and save it with the name Hello.java. When you open that file, the Java Language Server automatically starts loading, and you should see a language status item with a loading icon on the right side of the Status Bar showing the language status is busy. After it finishes loading, you can hover on the language status item and find the loading process has been finished successfully. You can also choose to pin the status item in the status bar.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;Class vs Prototypal Inheritance&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;       Before we get to the actual code, I pertinent to cover this topic quickly. Java is class-oriented language, which means that each object inherits the methods prom a previously defined class (either designed into the language or created by the programmer) to be used in subclasses. JavaScript on the other hand (prior to ES6) is prototype-oriented (and I'd argue, at it's core still prototypal but I'd need to personally look into the further). Back to Java-- as a class-oriented language, all Java source files must not only contain a public class (where all the coding happens), they must also take the same name of that public class. So if we wanted to create a Java program that prints "Hello World", we'd name it &lt;code&gt;HelloWorld.java&lt;/code&gt; and create a public class called HelloWorld ...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HelloWorld&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello World!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;&lt;span class="c1"&gt;//&amp;lt;- prints "Hello World"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;       And there we have our very first Java program. I definitely excited to continue learning about Java and I hope you've learned a little today as well. I'll keep you posted on my progress 🚀&lt;/p&gt;

&lt;p&gt;Further Reading: &lt;br&gt;
&lt;a href="https://www.javatpoint.com/java-tutorial"&gt;Java Point&lt;/a&gt;&lt;br&gt;
&lt;a href="https://java-programming.mooc.fi/"&gt;University of Helsinki’s free massive open online course&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>beginners</category>
      <category>programming</category>
      <category>oop</category>
    </item>
    <item>
      <title>A brief introduction to NestJS</title>
      <dc:creator>Royce</dc:creator>
      <pubDate>Tue, 28 Jun 2022 17:38:00 +0000</pubDate>
      <link>https://dev.to/royce_reed/a-brief-introduction-to-nestjs-4aea</link>
      <guid>https://dev.to/royce_reed/a-brief-introduction-to-nestjs-4aea</guid>
      <description>&lt;h4&gt;
  
  
  &lt;em&gt;What is NestJS and why you should choose it for your next project?&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;       NestJS is a Node.js framework intended to be used with TypeScript to build scalable and efficient server-side applications. It is open-source, progressive, easily extensible, and quickly gaining popularity among developers. Under the hood, Nest makes use of Express, another HTTP server framework, but can also be configured with Fastify. Nest can easily be integrated with any SQL or NoSQL database and provides integration with TypeORM (Object–relational mapping tool for Typescript) right out of the box for convenience. NestJS is noticeably influenced by Angular and the two would be a perfect pair for anyone’s next full-stack application. &lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;Kickstarting your next project&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;       Getting started with NestJS simple. You can either scaffold the project using the Nest CLI or clone a starter project. I am going to initiate a project using the CLI (documentation is linked below for additional details).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npm i &lt;span class="nt"&gt;-g&lt;/span&gt; @nestjs/cli 
&lt;span class="nv"&gt;$ &lt;/span&gt;nest new project-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;       After running these commands, the Nest CLI will scaffold your new project, create a new project directory, and populate the directory with the initial core files and supporting modules. Alternatively, you can install the core dependencies found in the docs (linked below) and build your project from the ground up.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  src
   ├── app.controller.spec.ts
   ├── app.controller.ts
   ├── app.module.ts
   ├── app.service.ts
   ├── main.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;em&gt;Building Blocks&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;       If you've used Angular before this should look familiar and you'll probably feel right at home using Nest. To get our feet wet using NestJS, we're going to build a basic REST API using Nest. We'll also use a basic &lt;a href="https://www.mongodb.com/"&gt;MongoDB&lt;/a&gt; database and &lt;a href="https://www.postman.com/"&gt;Postman&lt;/a&gt; to test our endpoints.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Controllers&lt;/em&gt;&lt;br&gt;
       The Controller is the routing mechanism responsible for handling incoming &lt;strong&gt;requests&lt;/strong&gt; and returning &lt;strong&gt;responses&lt;/strong&gt; to the client. Well start by defining our DTO (data transfer object) since we're using Typescript. The DTO defines how the data will be sent over the network.&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="c1"&gt;// create-item.dto.ts&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;CreateItemDto&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;qty&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="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&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;We'll also throw together our interface and Mongo Schema while we're at it..&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="c1"&gt;// item.interface.ts&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;Item&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;id&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;qty&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;description&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;string&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;The id and description in the interface is optional because mongo will provide an &lt;code&gt;id&lt;/code&gt; us and not every item may have a &lt;code&gt;description&lt;/code&gt;.&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="c1"&gt;// item.schema.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;mongoose&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mongoose&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ItemSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;mongoose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Schema&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&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;Now, we'll build out our controller then discuss what everything means.. (To use the CLI to generate a controller template, execute &lt;code&gt;$ nest g controller items&lt;/code&gt; )&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="c1"&gt;// items.controller.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Controller&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Put&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Delete&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Param&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@nestjs/common&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;CreateItemDto&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./dto/create-item.dto&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ItemsService&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./items.service&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Item&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./interfaces/item.interface&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="nd"&gt;Controller&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;items&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;ItemsController&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;itemsService&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ItemsService&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="nd"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="nx"&gt;findAll&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Item&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="o"&gt;&amp;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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;itemsService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;findAll&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="nd"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;:id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nx"&gt;findOne&lt;/span&gt;&lt;span class="p"&gt;(@&lt;/span&gt;&lt;span class="nd"&gt;Param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Item&lt;/span&gt;&lt;span class="o"&gt;&amp;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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;itemsService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;findOne&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&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="nd"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(@&lt;/span&gt;&lt;span class="nd"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="nx"&gt;createItemDto&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;CreateItemDto&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Item&lt;/span&gt;&lt;span class="o"&gt;&amp;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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;itemsService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;createItemDto&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="nd"&gt;Delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;:id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(@&lt;/span&gt;&lt;span class="nd"&gt;Param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Item&lt;/span&gt;&lt;span class="o"&gt;&amp;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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;itemsService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&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="nd"&gt;Put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;:id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nx"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(@&lt;/span&gt;&lt;span class="nd"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="nx"&gt;updateItemDto&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;CreateItemDto&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Item&lt;/span&gt;&lt;span class="o"&gt;&amp;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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;itemsService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;updateItemDto&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At the top we have our imports, all of which should look familiar except &lt;code&gt;ItemsService&lt;/code&gt; which we'll build and discuss next. Then we have our &lt;code&gt;@Controller()&lt;/code&gt; decorator, which defines our controller, establishes our endpoint &lt;code&gt;/items&lt;/code&gt; and conveniently allows us to group our related routes. The &lt;code&gt;@Get()&lt;/code&gt; HTTP decorator tells Nest to create a handler for a specific endpoint for HTTP requests. The &lt;code&gt;@Body&lt;/code&gt; and &lt;code&gt;@Param&lt;/code&gt; decorators are equivalent to &lt;code&gt;req.body&lt;/code&gt; and &lt;code&gt;req.param&lt;/code&gt; in Express. Nest handles that for us under the hood. &lt;code&gt;findAll()&lt;/code&gt;, &lt;code&gt;findOne(id)&lt;/code&gt;, &lt;code&gt;create(createItemDto)&lt;/code&gt;, &lt;code&gt;delete(id)&lt;/code&gt;, and &lt;code&gt;update(id, updateItemDto)&lt;/code&gt; are service methods we'll define in our Provider.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Providers&lt;/em&gt;&lt;br&gt;
       In Nest, Providers can be injected as dependencies into other components and create various relationships with each other, basically "wiring up" instances of objects. Controllers handle the HTTP requests and we can delegate the more complex tasks to the Provides. There are different types of providers— services, repositories, factories, helpers, and so on. We're going to build a basic service to allow us to interact with our database. After, we'll incorporate everything in our Module.&lt;br&gt;
(To use the CLI, execute &lt;code&gt;$ nest g service items&lt;/code&gt; )&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="c1"&gt;// items.service.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Injectable&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@nestjs/common&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Item&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./interfaces/item.interface&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Model&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mongoose&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;InjectModel&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@nestjs/mongoose&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="nd"&gt;Injectable&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;ItemsService&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(@&lt;/span&gt;&lt;span class="nd"&gt;InjectModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Item&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;itemModel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Model&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Item&lt;/span&gt;&lt;span class="o"&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="k"&gt;async&lt;/span&gt; &lt;span class="nx"&gt;findAll&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Item&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="o"&gt;&amp;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;await&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;itemModel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;find&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nx"&gt;findOne&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Item&lt;/span&gt;&lt;span class="o"&gt;&amp;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;await&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;itemModel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;findOne&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Item&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Item&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newItem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&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;itemModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&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;await&lt;/span&gt; &lt;span class="nx"&gt;newItem&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;save&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Item&lt;/span&gt;&lt;span class="o"&gt;&amp;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;await&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;itemModel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;findByIdAndRemove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nx"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Item&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Item&lt;/span&gt;&lt;span class="o"&gt;&amp;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;await&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;itemModel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;findByIdAndUpdate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;new&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Following the imports, we notice the &lt;code&gt;@Injectable&lt;/code&gt; decorator. The &lt;code&gt;@Injectable&lt;/code&gt; decorator attahces metadata which declares that &lt;code&gt;ItemsService&lt;/code&gt; is a class that can be managed by the Nest inversion of control (IoC) container. The rest of the code is pretty straightforward, using Mongoose methods to query our database. Going back to our controller quickly we inject it inside our constructor (if we haven't already, which generally we wouldn't have until we created it).&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="c1"&gt;// items.controller.ts&lt;/span&gt;
&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Controller&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;items&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;ItemsController&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;itemsService&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ItemsService&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;We take note of the &lt;code&gt;private&lt;/code&gt; syntax which allows us to both declare and initialize &lt;code&gt;ItemsServer&lt;/code&gt; immediately in the same location.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Modules&lt;/em&gt;&lt;br&gt;
A Module is denoted with the &lt;code&gt;@Module&lt;/code&gt; decorator and provides metadata that Nest uses to organize the application structure. Each application at least one module, a root module, usually &lt;code&gt;app.module.ts&lt;/code&gt;, and serves as a start point Nest uses to build the application graph - the internal data structure Nest uses to resolve module and provider relationships and dependencies. In our case we will have one feature module, &lt;code&gt;ItemsModule&lt;/code&gt;, and our root module &lt;code&gt;AppModule&lt;/code&gt;.&lt;br&gt;
(To use the CLI, execute &lt;code&gt;$ nest g module items&lt;/code&gt; )&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="c1"&gt;// items.module.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Module&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@nestjs/common&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;MongooseModule&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@nestjs/mongoose&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ItemsController&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./items.controller&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ItemsService&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./items.service&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ItemSchema&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./schemas/item.schema&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="nd"&gt;Module&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;imports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;MongooseModule&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forFeature&lt;/span&gt;&lt;span class="p"&gt;([{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Item&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ItemSchema&lt;/span&gt; &lt;span class="p"&gt;}])],&lt;/span&gt;
  &lt;span class="na"&gt;controllers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;ItemsController&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;providers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;ItemsService&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;ItemsModule&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app.module.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Module&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@nestjs/common&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ItemsModule&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./items/items.module&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;MongooseModule&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@nestjs/mongoose&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./config/keys&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;MONGO_URI&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Module&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;imports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;ItemsModule&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;MongooseModule&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forRoot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MONGO_URI&lt;/span&gt;&lt;span class="p"&gt;)],&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;AppModule&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Assuming you have your database set up and have a URI in your config directory, you should be able to fire up the app with &lt;code&gt;$ npm start&lt;/code&gt; and use Postman (or your preferred API testing software) to test out your first NestJS server side application.&lt;br&gt;
I hope you give NestJS a try on you next project. I know I will. 🚀&lt;/p&gt;

&lt;p&gt;Links: &lt;br&gt;
&lt;a href="https://docs.nestjs.com/"&gt;NestJS Documentation&lt;/a&gt;&lt;br&gt;
&lt;a href="https://viktor-kukurba.medium.com/dependency-injection-and-inversion-of-control-in-javascript-303e07e7f43f"&gt;Dependency Injection and Inversion of Control in JavaScript&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>angular</category>
      <category>typescript</category>
      <category>opensource</category>
    </item>
    <item>
      <title>What is GraphQL</title>
      <dc:creator>Royce</dc:creator>
      <pubDate>Thu, 23 Jun 2022 20:04:44 +0000</pubDate>
      <link>https://dev.to/royce_reed/what-is-graphql-4g5i</link>
      <guid>https://dev.to/royce_reed/what-is-graphql-4g5i</guid>
      <description>&lt;p&gt;       How you ever wondered, “I wish there was a way I could query an API without getting a bunch of unnecessary data?” Well, you might be interested in GraphQL. “What is it?”, you ask. &lt;br&gt;
I've seen heard it mentioned on blogs and videos (it should be mentioned that I'm an intermediate learner and my course-load until recently was chosen for me), never really giving it much thought. Then I decided to investigated. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;GraphQL is a query language for your API, and a server-side runtime for executing queries using a type system you define for your data. GraphQL isn't tied to any specific database or storage engine and is instead backed by your existing code and data. A GraphQL service is created by defining types and fields on those types, then providing functions for each field on each type.&lt;br&gt;
 – &lt;a href="https://graphql.org/learn/" rel="noopener noreferrer"&gt;Introduction to GraphQL&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;       I've seen heard it mentioned on blogs and videos (it should be mentioned that I'm an intermediate learner and my course-load until recently was chosen for me), never really giving it much thought. Then I decided to investigate. &lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Comparing to REST API&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;       So, I can use GraphQL to query the data from an API. How is that different from the standard http methods like &lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;POST&lt;/code&gt;, &lt;code&gt;PATCH&lt;/code&gt;, &lt;code&gt;PUT&lt;/code&gt;, and &lt;code&gt;DELETE&lt;/code&gt;? GraphQL uses different methods called Query, Mutation, and Subscriptions. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Query&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;       In GraphQL, query is used to fetch data from the data store like a &lt;code&gt;GET&lt;/code&gt; request in a REST API. The difference is how GraphQL is set up and how much of the data to request from the endpoint. In the dataset below, we have a dataset of &lt;code&gt;customers&lt;/code&gt; which could potentially be very large. &lt;/p&gt;

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

&lt;p&gt;We, however, only need their names and ages in this case, so that's all we query. That's the appeal of GraphQL. Like everything, there's usually a drawback but we'll get to that in a bit.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Mutations&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;       Mutations are ways to change data using GraphQL, like &lt;code&gt;POST&lt;/code&gt;, &lt;code&gt;PUT&lt;/code&gt;, &lt;code&gt;PATCH&lt;/code&gt;, and &lt;code&gt;DELETE&lt;/code&gt;. If we wanted to add, change, or remove from our data we would use a mutation.&lt;/p&gt;

&lt;p&gt;Notice here we are adding "Harry" to our customer list by specifying which fields to add (and only those will get added).&lt;/p&gt;

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

&lt;p&gt;But then we decide to remove to remove Harry for whatever reason (sorry Harry). We only need to provide his Id.&lt;/p&gt;

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

&lt;h5&gt;
  
  
  &lt;em&gt;Getting Started&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;       Getting setup to use GraphQL is straightforward. Below is just a basic server setup with express. But GraphQL is compatible with many different &lt;br&gt;
architectures and languages. If we went to &lt;code&gt;localhost:400/graphql&lt;/code&gt; in our browser, we would get to the "GraphiQL" UI we saw above &lt;br&gt;
because we set it in our instance &lt;code&gt;graphiql:true&lt;/code&gt;.&lt;/p&gt;

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

&lt;p&gt;&lt;em&gt;Schema&lt;/em&gt;&lt;br&gt;
       Now that we have our server set up we can define a basic Schema and type out the fields in out data set. We start by instantiating a &lt;code&gt;GraphQLObjectType&lt;/code&gt; and define each field. In this case we're using basic types &lt;code&gt;GraphQLString&lt;/code&gt; and &lt;code&gt;GraphQLInt&lt;/code&gt; but there are others as well.&lt;/p&gt;

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

&lt;p&gt;After the types we'll set our &lt;code&gt;RootQuery&lt;/code&gt; and &lt;code&gt;Mutations&lt;/code&gt;. &lt;/p&gt;

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

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

&lt;p&gt;       There's a lot happening here so let's go over it quickly. We start with a &lt;code&gt;GraphQLObjectType&lt;/code&gt; like we did for &lt;code&gt;CustomerType&lt;/code&gt; and for each field, in this case of the &lt;code&gt;RootQuery&lt;/code&gt;, &lt;code&gt;customer&lt;/code&gt; and &lt;code&gt;customers&lt;/code&gt;, we'll have a resolver, which essentially does the heavy lifting. For the &lt;code&gt;Mutation&lt;/code&gt; we do basically the same thing with the &lt;code&gt;addCustomer&lt;/code&gt;, &lt;br&gt;
&lt;code&gt;deleteCustomer&lt;/code&gt;, and &lt;code&gt;editCustomer&lt;/code&gt; fields. If we want a value to be required, we wrap with the &lt;code&gt;GraphQLNonNull&lt;/code&gt; type. After we're done, we export inside  &lt;code&gt;GraphQLSchema&lt;/code&gt; and we're well on our way.&lt;/p&gt;

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

&lt;h5&gt;
  
  
  &lt;em&gt;To REST or not to REST&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;       When should you use GraphQL vs http? I would say it depends on the side of your project and &lt;br&gt;
the size of the data set you want to access. The benefit of GraphGL is that it tends to be faster because its return less data; Worth it if you want to scale your project and the data you want to access has a lot of info you don't need. Conversely, REST API are compatible with all browsers and have been around for longer, has better error handling, and built-in caching. GraphQL error handling is lacking, and caching must be set up manually. GraphQL is new and shiny and has real potential. REST is old and trusted. So, take your pick. Good hunting.&lt;/p&gt;

&lt;p&gt;Links: &lt;br&gt;
&lt;a href="https://graphql.org/" rel="noopener noreferrer"&gt;https://graphql.org/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/royce-reed/graphQL-demo" rel="noopener noreferrer"&gt;https://github.com/royce-reed/graphQL-demo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>graphql</category>
      <category>api</category>
      <category>beginners</category>
      <category>database</category>
    </item>
    <item>
      <title>Continuous Integration and Continuous Delivery</title>
      <dc:creator>Royce</dc:creator>
      <pubDate>Tue, 14 Jun 2022 14:09:51 +0000</pubDate>
      <link>https://dev.to/royce_reed/continuous-integration-and-continuous-delivery-ipc</link>
      <guid>https://dev.to/royce_reed/continuous-integration-and-continuous-delivery-ipc</guid>
      <description>&lt;p&gt;      "What is Continuous Integration and why is it important?" If you are novice programmer, you may be asking yourself these same questions. CI/CD stands for Continuous Integration and Continuous Delivery (or Deployment) used in DevOps (Software Development and IT Operations). CI/CD is a best practice where developers can frequently deploy code to production, without having to wait for manual approval, or worse waste a ton of time testing code manually. It allows developers to spend more time writing code and less time testing locally and manually deploying.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;The Pipeline&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;      If a developer is working on a feature and they want to make sure it is working correctly before they deploy it, without CI, they might have to run a series of tests locally or have print statements (console.logs) littered throughout their code base to ensure it's working. This process can take a lot of time and can be a lot of work. With CI, a developer can run a single command to check that the application is working correctly. This way the developer can spend more time writing code and less time testing. When merging or submitting a Pull request, the CI server will run the tests and if they pass, the code would be allowed to be merged into the master branch (or another branch).&lt;/p&gt;

&lt;p&gt;      Continuous delivery extends the idea of continuous integration to also include the process of deploying code and updating the live environment (or a staging area) after the build/testing stage. In addition to automated testing, you have an automated process that can deploy code with the click of a button. This can improve the deployment process so that develops can deploy code in small batches and test of debug more efficiently &lt;/p&gt;

&lt;p&gt;      Continuous deployment takes the process one step further, allowing every change that passes all the previous stages of the pipeline to be released to the live environment. Only a failed test would prevent the change to be deployed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wWTIZU_r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s9be5gt8dgqr5d0uvxc7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wWTIZU_r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s9be5gt8dgqr5d0uvxc7.png" alt="DevOps" width="612" height="289"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;GitHub Actions&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;      There are several different CI tools available to pick from. Popular ones include Jenkins, Travis, Gitlab and others. I will not go into too much detail about them, but they all have their pros and cons. Being that prefer to do as much as possible with the tools I use, I prefer GitHub Actions. It is easy to setup, and it is right in the browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--57EA3ALk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f9tgojh3dfa8swlejz95.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--57EA3ALk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f9tgojh3dfa8swlejz95.png" alt="github-action-1" width="800" height="361"&gt;&lt;/a&gt;&lt;br&gt;
Let us do a quick demonstration of how easy it is to set up GitHub Actions …&lt;br&gt;
Open the terminal and &lt;code&gt;cd&lt;/code&gt; into your repository’s root folder, then create a &lt;code&gt;.yml&lt;/code&gt; file &lt;code&gt;touch .github/workflows/action-demo.yml&lt;/code&gt;. In the &lt;code&gt;.yml&lt;/code&gt; file we're going to paste some boilerplate code we got from the &lt;a href="https://docs.github.com/en/actions/quickstart"&gt;GitHub Actions Documentation&lt;/a&gt;. We will also add a couple lines at the bottom to install our dependencies and run our tests.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: GitHub Actions Demo
on: [push]
jobs:
  Explore-GitHub-Actions:
    runs-on: ubuntu-latest
    steps:
      - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
      - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
      - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
      - name: Check out repository code
        uses: actions/checkout@v3
      - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
      - run: echo "🖥️ The workflow is now ready to test your code on the runner."
      - name: List files in the repository
        run: |
          ls ${{ github.workspace }}
      - run: echo "🍏 This job's status is ${{ job.status }}."
      - run: npm i
      - run: npm test

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

&lt;/div&gt;



&lt;p&gt;After we've written our code (in this case a simple arithmetic &lt;br&gt;
function) and run our code locally, we're ready to push our code and open a pull request. from the terminal &lt;code&gt;git push --set-upstream origin test&lt;/code&gt; (we are on the &lt;code&gt;test&lt;/code&gt; branch). At GitHub we see an indication our code was pushed up and GitHub suggests a PR. How convenient 😎&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VT0RLD8R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1km2a99cxc4j1h4te2o0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VT0RLD8R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1km2a99cxc4j1h4te2o0.png" alt="gh-action-2" width="800" height="350"&gt;&lt;/a&gt;&lt;br&gt;
We can see the process in action&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8xDiep84--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/edsvwh1vzebd82zl0e5l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8xDiep84--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/edsvwh1vzebd82zl0e5l.png" alt="gh-action-3" width="800" height="246"&gt;&lt;/a&gt;&lt;br&gt;
And when it's done we can successfully merge our changes..&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--edGQ7Q0k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ms086y88xn3gqtnd4kq8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--edGQ7Q0k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ms086y88xn3gqtnd4kq8.png" alt="gh-action-4" width="800" height="216"&gt;&lt;/a&gt;&lt;br&gt;
Then delete our branch...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0Idas8g8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/awdojov2eq2hqo7inypk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0Idas8g8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/awdojov2eq2hqo7inypk.png" alt="gh-action-5" width="800" height="91"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that is all there is to getting started with GitHub Actions. See how easy it was? I hope this helps you include CI/CD in your next project. &lt;/p&gt;

</description>
      <category>devops</category>
      <category>cicd</category>
    </item>
    <item>
      <title>What is WebSocket?</title>
      <dc:creator>Royce</dc:creator>
      <pubDate>Tue, 07 Jun 2022 11:25:35 +0000</pubDate>
      <link>https://dev.to/royce_reed/what-is-websocket-29ik</link>
      <guid>https://dev.to/royce_reed/what-is-websocket-29ik</guid>
      <description>&lt;p&gt;      HTTP (Hypertext Transfer Protocol) and WebSockets are both TCP/IP (Transmission Control Protocol/Internet Protocol) based connections that are used to communicate from a client to a server or from one server to another. They are both used for different purposes and have different use cases.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;What is HTTP protocol?&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;      HTTP is a unidirectional TCP connection protocol that is used to send and receive data. When a client sends a request to a server, the server sends an appropriate response back to the client. After sending the response, the connection is closed. Each time a new request is made, a new connection is established and after the response is sent, the connection is closed. This is repeated every time a new request is made. This is known as stateless protocol.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;What is WebSocket?&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;      Unlike HTTP, a WebSocket connection is bidirectional, which means that the connection is open for both sending and receiving data. This is known as stateful protocol. WebSocket is a full duplex protocol, meaning that data can be sent and received at the same time. After closing the connection by either the client or the server, the connection is no longer open for data transmission. In contrast to HTTP, WebSocket starts with &lt;code&gt;ws://&lt;/code&gt; or &lt;code&gt;wss://&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rlgjdnSR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/md4oxyqp5kguqlmy0u32.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rlgjdnSR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/md4oxyqp5kguqlmy0u32.png" alt="WebSocket vs HTTP" width="800" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;When to use WebSocket&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;      There are a number of use cases where WebSocket can be used in favor of HTTP. Let’s take a look at a few of them. WebSocket is a great way to implement real-time applications, such as chat, games, and real-time data transfer. &lt;br&gt;
      A good example of one such real-time application is a stock ticker or stock trading website. A connection would need to remain open in order to send and receive data in real-time to get the latest price of a stock.&lt;br&gt;
      A gaming app is another good example of the need for real-time communication for seemingly obvious reasons. You wouldn't want to play a game that had to refresh the UI every time new information was sent or received. &lt;br&gt;
      And finally, the almost obvious example of real-time communication is a chat application. This is probably the most common use case for WebSocket. A chat application would need to remain open to send and receive messages in real-time.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;When NOT to use WebSocket&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;      WebSocket is best suited when we need real-time updates or continuous connection between client and server. If we simply need to fetch old data and send new data then HTTP is the way to go. Older data which isn't updated on a regular basis can be fetched using a simple GET request. Newer data can be sent using a simple POST request. This is a good example of when to use HTTP instead of WebSocket.&lt;/p&gt;

&lt;p&gt;      I hope this article has helped you understand the difference between HTTP and WebSocket and when to use each one. If you are interested in learning more about HTTP and WebSocket, I suggest you check out some of the following resources:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/14703627/websockets-protocol-vs-http/14711517#14711517"&gt;&lt;em&gt;Why is the WebSockets protocol better?&lt;/em&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API"&gt;&lt;em&gt;WebSocket - MDN&lt;/em&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/WebSocket"&gt;&lt;em&gt;WebSocket - Wiki&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>http</category>
      <category>websocket</category>
      <category>tcp</category>
    </item>
    <item>
      <title>A brief introduction to the R programming language</title>
      <dc:creator>Royce</dc:creator>
      <pubDate>Sun, 01 May 2022 19:31:31 +0000</pubDate>
      <link>https://dev.to/royce_reed/a-brief-introduction-to-the-r-programming-language-47on</link>
      <guid>https://dev.to/royce_reed/a-brief-introduction-to-the-r-programming-language-47on</guid>
      <description>&lt;h5&gt;
  
  
  &lt;em&gt;What is the ‘R’ programming language?&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;      R is a multi-paradigmatic (procedural, object-oriented, functional, and more) programming language used for statistical computing and graphics. It was created between 1991 - 1995, at the University of Auckland, by statisticians, Ross Ihaka and Robert Gentleman. R is used among data scientists and statisticians for data analysis and developing statistical software. It also possesses and intensive catalog of statistical and graphical methods, which include machine learning algorithms, linear progressions, and statistical inference to name a few.&lt;sup&gt;&lt;a href="https://en.wikipedia.org/wiki/R_(programming_language)"&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;br&gt;
      R is open-source, free software, within the GNU package (notable software packages developed by the Free Software Foundation as part of the &lt;a href="https://www.gnu.org/home.en.html"&gt;GNU Project&lt;/a&gt;). R is used not only by academics but by a variety of other industry including healthcare, government, insurance, and finance. Some notable large companies include Uber, Facebook, Google, and many more.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Use Cases&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;      R offers a variety of statistics-related libraries and an environment favorable for statistical computing and design. In 2021, R ranked in the &lt;a href="https://statisticstimes.com/tech/top-computer-languages.php"&gt;top five programming languages&lt;/a&gt; for data analysists and research programmers. Some real-world applications of R being used could be optimizing a financial portfolio, processing marking data, or even analyzing outcomes of clinical trials. R is more than just a programming language; R’s official software environment has built in visualization capabilities making it easy to plot data. It has an extensive community of useRs that have created an extensive set of packages that can be used for almost any data processing task.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Pros and Cons&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;      What are some of the &lt;strong&gt;pros&lt;/strong&gt; of using R versus other languages?&lt;br&gt;
&lt;u&gt;&lt;em&gt;Open-Source:&lt;/em&gt;&lt;/u&gt; It is open-source and free, which means useRs can contribute to the development of R by optimizing packages, develop new ones, and resolve issues therein.&lt;br&gt;
&lt;u&gt;&lt;em&gt;Analysis:&lt;/em&gt;&lt;/u&gt; R was specifically designed for statistical analysis which means it can perform a variety of machine learning algorithms such as classification and regression. &lt;br&gt;
&lt;u&gt;&lt;em&gt;Packages:&lt;/em&gt;&lt;/u&gt; R provides packages and feature for developing neural networks. Its data visualization capabilities are quite capable as well. There are various libraries, such as ggplot2 and plotly, which allow for visually appealing graphs which set R apart from other languages.&lt;/p&gt;

&lt;p&gt;      What are some of the &lt;strong&gt;cons&lt;/strong&gt; of using R versus other languages? &lt;br&gt;
&lt;u&gt;&lt;em&gt;Learning Curve:&lt;/em&gt;&lt;/u&gt;  R is a complicated language and has a steep learning curve and could be difficult for those to pick up without prior programming experience. &lt;br&gt;
&lt;u&gt;&lt;em&gt;Security:&lt;/em&gt;&lt;/u&gt; R lacks basic security found in other languages. As a result, there are restrictions on R as it cannot be embedded into web applications. &lt;br&gt;
&lt;u&gt;&lt;em&gt;Speed and Memory:&lt;/em&gt;&lt;/u&gt; in R, objects are stored in physical memory and utilizes more than other languages. It requires data to a single place which is in the memory. Algorithms in R are spread across packages, which makes it slower than other languages more contribute to its difficulty to implement algorithms.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;R vs Python&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;As this is primarily an article about R, I will not do a proper comparison between the two languages, but simply point out some key differences.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;R is difficult to learn in the beginning but has more specific applications for statistical analysis, while Python Is more beginner friendly but that in and of itself limits what it can do regarding analysis. &lt;/li&gt;
&lt;li&gt;The primary objective of R is data analysis and statistics whereas the primary objective of Python is development and production.&lt;/li&gt;
&lt;li&gt;R is integrated to run locally whilst Python is well-integrated into apps 
This is just to name a few but there might be several reasons to pick one language over another, depending on each projects’ needs.
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>datascience</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Version control – ‘Git’ with the program</title>
      <dc:creator>Royce</dc:creator>
      <pubDate>Mon, 25 Apr 2022 12:56:59 +0000</pubDate>
      <link>https://dev.to/royce_reed/version-control-git-with-the-program-14ne</link>
      <guid>https://dev.to/royce_reed/version-control-git-with-the-program-14ne</guid>
      <description>&lt;p&gt;&lt;em&gt;History&lt;/em&gt;&lt;br&gt;
If you have done any work with computers or on a computer file, at some point you had to save a file in some form or another. Most people might simply press ctrl+s to save work. But what if you need to keep track of the changes made to certain files or projects? Or better still, what if multiple people ore working on the same project, file, or collection of files and need to keep track of who changed what and when, and what the specific changes were? Version Control Systems (or revision control system) is the answer.&lt;br&gt;
    What is a version control system? A version control system or VCS is a system that records changes to your files or projects that can be used individually or share with members of a team (as you might have guessed). Prior to 2005 there were various VCSs all vying for a seat the preverbal table. Each had unique features, but most were closed-sourced and ran on client servers. This might work for a cooperate environment of a couple dozen or so people working on a single repository, but what of hundreds or even thousands working on a massive project? Enter Linus Torvalds.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Out of many… One&lt;/em&gt;&lt;br&gt;
  In the late 1990s Torvalds and various contributors were developing the Linux Kernel (the part of the operating system that acts as an intermediary between the computer hardware and the applications) and were struggling with revision management. Given the scale of such a project, one can only imagine. In 2002, the team adopted a VCS called BitKeeper, a commercial product, was free under certain conditions. For assorted reasons, the company behind BitKeeper decided to discontinue the free version. There were also grumblings from proponents of open-source software about using a proprietary tool to develop open source. &lt;sup&gt;&lt;a href="https://www.gnu.org/philosophy/linux-gnu-freedom.en.html"&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;br&gt;
After searching for another off-the-shelf solution to his problem yielded few options, Torvalds developed the first version of Git in 2005 (it is said) in a matter of days while taking a working holiday. His cited reasons for creating a new VCS were that he needed that could manage the number of contributions in a reasonable amount of time. Since then, Git has grown into the premier version control system with over 85% of developers using the software (according to this recent &lt;a href="https://insights.stackoverflow.com/survey/"&gt;survey&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Further Reading: &lt;a href="https://hackaday.com/2017/05/11/history-of-git/"&gt;History of Git&lt;/a&gt;,  &lt;a href="https://www.welcometothejungle.com/en/articles/btc-history-git"&gt;The Road to Domination in Software Version Control&lt;/a&gt;, &lt;a href="https://medium.com/@mehran.hrajabi98/a-brief-history-of-version-control-systems-vcss-5881f07ba0e1"&gt;A Brief history of Version Control Systems&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Git Basics&lt;/em&gt;&lt;br&gt;
As a young student of programming, I have only ever used Git for revision control and, until recently, only heard the existence of others as whispers in the wind. So, I thought I might go over some of the basic and intermediate commands of Git for those just discovering version control yourself or even for those who want to expand upon the foundations they have already built. *For the remainder of the article, I will be operating under the assumption the reading has basic knowledge of terminal commands. If you need a refresher, check out this MDN &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Command_line"&gt;article&lt;/a&gt;.  &lt;/p&gt;

&lt;p&gt;If you have done any work with Git/GitHub at all, even on solo projects, you know about the commands listed below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// adds file to staging area (or index)
git add &amp;lt;filename&amp;gt;
// commits file to local repository 
git commit -m “Commit Message”
// pushes commit to remote repository  
git push &amp;lt;remote&amp;gt; &amp;lt;branch&amp;gt; (or...)
git push origin main 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8spv0hJq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0p1xi292pwzzehqh7ntq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8spv0hJq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0p1xi292pwzzehqh7ntq.png" alt="Basic Workflow" width="417" height="121"&gt;&lt;/a&gt;&lt;br&gt;
Let us quickly define some basic concepts: &lt;br&gt;
    main: default development branch&lt;br&gt;
    origin: default upstream repository&lt;br&gt;
    HEAD: pointer to the current branch reference &lt;br&gt;
    HEAD^: parent of HEAD &lt;br&gt;
    HEAD~4: great-great grandparent of HEAD&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Practice makes &lt;del&gt;perfect&lt;/del&gt; better&lt;/em&gt;&lt;br&gt;
When I first started using version control, I saw all these commands (and a few others) and it was intimidating, but I soon realized the thing that makes Git so great is its simplicity. On the outside looking in, it may seem daunting, but the more you use it, the more people you collaborate with, and the more projects you work on the more practice you will get (no pun intended). Before proceeding further, one thing I would like to mention is that one of the things that better helped me get a grasp on this topic was a visual reference. I strongly recommend &lt;a href="https://learngitbranching.js.org/"&gt;Learn Git Branching&lt;/a&gt; for this very reason. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mcAEliON--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgaru1g8w0yvckx5anzq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mcAEliON--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgaru1g8w0yvckx5anzq.png" alt="Git Branches" width="297" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Intermediate git&lt;/em&gt; &lt;br&gt;
Let us now touch on a few more intermediate aspects of the Git workflow. Let us say you have created an app that automates some menial tasks and a few people started using your app because, like you, they also do not find joy in menial tasks. One of your end users notices a minor bug you may have overlooked. This bug does not break the app but nonetheless needs to be fixed. You do not want to take the app offline to fix it, so what do you do? Well, you might create a branch in your local repository called ‘bug-fix’ &lt;code&gt;git branch bug-fix&lt;/code&gt; or &lt;code&gt;git checkout -b bug-fix&lt;/code&gt; (the latter will create the new branch move into it with one command). Now you can fix the bug while working on this branch while your end users continue using the app. After you fix the bug you would want to merge bug-fix back into your main branch &lt;code&gt;git merge main&lt;/code&gt; or you might want to organize your commits before you merge you might consider rebasing (this is an example of interactive rebasing) &lt;code&gt;git rebase -i main&lt;/code&gt; which just gives you a more tidy commit history (*it’s important to note that rebasing should only be done while in local repo). These are just a few commands to do with Git. If you are still interested in learning more about Git, I have taken the liberty of providing additional resources below. &lt;/p&gt;

&lt;h5&gt;
  
  
  Resources
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://think-like-a-git.net/sections/about-this-site.html"&gt;Think Like (a) Git&lt;/a&gt;&lt;br&gt;
&lt;a href="http://sethrobertson.github.io/GitBestPractices/"&gt;Commit Often, Perfect Later, Publish Once: Git Best Practices&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.lullabot.com/articles/git-best-practices-workflow-guidelines"&gt;Git Best Practices: Workflow Guidelines&lt;/a&gt;&lt;br&gt;
&lt;a href="https://learngitbranching.js.org/"&gt;Learn Git Branching&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
    </item>
    <item>
      <title>What is Machine Learning?</title>
      <dc:creator>Royce</dc:creator>
      <pubDate>Mon, 18 Apr 2022 13:54:51 +0000</pubDate>
      <link>https://dev.to/royce_reed/what-is-machine-learning-2fl0</link>
      <guid>https://dev.to/royce_reed/what-is-machine-learning-2fl0</guid>
      <description>&lt;p&gt;The term “Machine Learning” was coined by Arthur Samuel (1959), a pioneer of artificial intelligence, and defined it as a &lt;em&gt;“Field of study that gives computers the ability to learn without being explicitly programmed.”&lt;/em&gt; Machine learning is the study of computer algorithms that improve with the use of data. Machine Learning and Data Science are sometimes, inaccurately, used interchangeably but they are considered distinct fields of study, despite overlapping in some areas. Data Science conducts operations over various data sources to prove or disprove a hypothesis, and Machine Learning use various data sources to develop software that learns as it extracts meaning from the data. Machine Learning is a branch of the field of Artificial Intelligence. Machine Learning uses statistical methods to train algorithms to make predictions, or classifications, through data mining projects. These insight drive decisions made businesses and continues to grow. Machine Learning has many real-world applications, such as medical diagnosis, traffic prediction, product recommendations and others.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Machine Learning vs Deep Learning&lt;/strong&gt;&lt;br&gt;
    Machine Learning and Deep Learning are both subfields of Artificial Intelligence but often the terms are used interchangeably, so let us briefly point out some of the differences between them. The way they differ is in how the algorithm learns. Deep learning automates much of the feature, or an individual measurable property, extraction process and eliminating some of the human intervention part of the process therefore allowing use of larger data sets. Machine Learning is more dependent of human intervention to determine the set of features to understand differences in data inputs. Deep Learning does not need human interaction to process the information allowing Machine Learning to scale in interesting ways.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Machines Learn&lt;/strong&gt;&lt;br&gt;
    &lt;a href="https://ischoolonline.berkeley.edu/blog/what-is-machine-learning/"&gt;UC Berkeley&lt;/a&gt; divides the Machine Learning process into three main parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; A Decision Process: Machine Learning algorithms are used to make predictions, given a data set, which will predict patterns in the data.&lt;/li&gt;
&lt;li&gt; An Error Function: An error function evaluates the prediction model to access the accuracy of the model.&lt;/li&gt;
&lt;li&gt; A Model Optimization Process: If the model can better fit the data points in the training set, the weights are adjusted to improve the algorithm to better fit the training data and model estimate. This process is repeated until a certain level of accuracy is met.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Machine Learning Methods&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Supervised Learning&lt;/em&gt;&lt;br&gt;
    In supervised learning, you would feed in an input-output pair and the algorithm would determine a pattern between the two. As you feed in new inputs, the algorithm would predict which output the input would belong to. The key to the accuracy, as is the case with all machine learning, is that the largest the training data the more accurate the model will be. Real-world examples of supervised learning are product recommendation (when a streaming service suggests a new movie or song you might like based on previous choices) and image classification (when someone is tagged in photos on social media and the app suggest other photos they might be in). &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Unsupervised Learning&lt;/em&gt;&lt;br&gt;
    In unsupervised learning, you would feed an input (without the associated output) and as you repeat process the algorithm would group, or cluster, like values together to determine a pattern. As noted previously, the key to accurate modeling is the size of the initial data set. A real-world example would be bank fraud detection (since credit-card charges do not come with a “fraud” or “not fraud” tag fixed to them).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Reinforcement Learning&lt;/em&gt; &lt;br&gt;
    In Reinforcement learning, an input is feed to the algorithm and based on previous data, the algorithm would determine an output. The process would be refined using a “rewards/punishment” system and the program would learn from trial and error.&lt;/p&gt;

&lt;p&gt;Machine Learning is an ever-growing field of research and continues to influence our lives as we continue to push the bounds of artificial intelligence. I, myself, am excited to learn more about it to gain more insight. &lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>datascience</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Higher-Order Functions</title>
      <dc:creator>Royce</dc:creator>
      <pubDate>Fri, 18 Feb 2022 21:54:48 +0000</pubDate>
      <link>https://dev.to/royce_reed/higher-order-functions-4djf</link>
      <guid>https://dev.to/royce_reed/higher-order-functions-4djf</guid>
      <description>&lt;p&gt;When I first encounter most things when learning programing, it seems like an alien language. There are unfamiliar words to learn, syntax, and initially everything is a bit confusing. The same was true when I first stumbled upon Higher-Order Functions, even more so. My goal in writing this is to possibly demystify Higher-Order Functions and come to a better understanding myself. Let’s dive right in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;First Class Functions&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
In JavaScript, functions are first class citizens. JavaScript is an object-oriented programming language (with functional paradigm structures as well). A function in JavaScript is an instance of an object type. Like an object, functions have properties and methods.&lt;br&gt;
A first-class function is a feature in JavaScript where functions are treated like any other variable. A first-class function can be assigned as a value to a variable, can be passed as an argument into other functions, and can be returned by another function.&lt;br&gt;
Consider this simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1  // Function definition and invocation 
2  function add(a,b) {
3    return a + b;
4  }
5  add(5, 6) // returns 11
6
7  // Stored in a variable
8  const sum = add;
9  sum(6,7) // returns 13
10 
11 // Passed as an argument to a function
12 function functionReturner(fn){
13   return fn;
14 }
15 const total = functionReturner(sum)
16 total(5,5) // returns 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Stored as variable&lt;/em&gt;&lt;br&gt;
On line 2 we declare the function and call it on line 5. On line 9 we’ve created a variable called “sum” and assigned it the value of the “add” function, so that “add”, and “sum” are equal, and if we were to call “sum” with arguments it would return their sum.&lt;br&gt;
One important thing to note, however, is that “add” is a function declaration and “sum” is a function expression. The reason for noting this is that function declarations are hoisted, and function expressions are not. Therefore, if you were to invoke “add” before the program reaches that line of code, it would return a value based on the arguments passed. However, “sum” would throw a reference error.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Passed as argument&lt;/em&gt;&lt;br&gt;
Another feature of first-class functions is something known as a callback function. A callback function is passed a parameter in another function as shown on lines 11 through 16. You’ve probably seen this before in native functions like map() and filter() (which we’ll discuss later).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Returned by another Function&lt;/em&gt; &lt;br&gt;
Something else you may have seen happen is another function returning a function. We can do this because functions are types of objects. This is particularly useful when writing larger programs that use similar functions repeatedly. You can use one function as a template to call inside another function. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Higher-Order Functions: Defined&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
What does any of this have to do with higher-order functions? Well, the bit about functions stored about variable isn’t particularly applicable, but functions passed as arguments and functions returned by other functions are the bread and butter of Higher-Order Functions. In fact, Higher-Order Functions ARE functions that either have another function passed in as an argument and/or return a function. In fact, Eloquent JavaScript, 3rd Edition (Haverbeke, 2018:86) defines it like this, &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Functions that operate on other functions, either by taking them as arguments or by returning them, are called higher-order functions. Since we have already seen that functions are regular values, there is nothing particularly remarkable about the fact that such functions exist. The term comes from mathematics, where the distinction between functions and other values is taken more seriously.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Simple as that. Note: a function that doesn’t take a function as an argument and/or returns a function is called a first-order function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Native Higher-Order Functions&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
JavaScript features several native higher-order functions to make programming life slightly easier. (There are also other libraries like Lodash and Underscore which offer many more). I’ll discuss two native higher-order functions that are used regularly (at least, by me).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;map()&lt;/em&gt;&lt;br&gt;
    The first of the native higher-order function I’d like to discuss is the map() function (which is technically a method). The map() function, or method, is used to iterate over an array (it works on all collections, but for simplicity’s sake, we’ll stick to arrays for today), perform an action on each individual element in the original array and return a new array. It takes one argument, the callback function, which performs an action on the elements of the first array and “maps,” or designs new elements based on the callback function. Let’s look at how map() works.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let myArray = [1,2,3,4,5]
function square(number){
  return number*number;
}
let squaredArray = myArray.map(square);
console.log(squaredArray); // logs [1,4,9,16,25]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice we have a callback function called “square” which takes in each element in “myArray” (and has the option of taking in the index and the array as a whole), performs an action, of multiplying it to itself, and pushes the value into a new array. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;filter()&lt;/em&gt;&lt;br&gt;
Another function in the arsenal of native higher-order JavaScript functions is filter(). This method iterates over an array and creates a new array for each element of the original array that meet certain criteria. So, a callback function would look something like…&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let myArray = [1,2,3,4,5]
function isEven(number) {
  return number % 2 === 0; 
}
console.log(myArray.filter(isEven)) // logs [2,4]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Conclusion&lt;/em&gt;&lt;/strong&gt; &lt;br&gt;
In summation, I discussed how functions are treated in JavaScript. Next, how functions can be passed in as arguments to other functions and functions can be returned by functions, as well. We learned this is the very definition of a Higher-Order function. Finally, we looked at two commonly used built-in Higher-Order functions featured by JavaScript. &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
