<?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: Mark Kozel</title>
    <description>The latest articles on DEV Community by Mark Kozel (@markkozel).</description>
    <link>https://dev.to/markkozel</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%2F751332%2F620808e0-495f-4b0f-a3a1-a58ca3f81fb1.jpg</url>
      <title>DEV Community: Mark Kozel</title>
      <link>https://dev.to/markkozel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/markkozel"/>
    <language>en</language>
    <item>
      <title>Mutability of JavaScript</title>
      <dc:creator>Mark Kozel</dc:creator>
      <pubDate>Sun, 14 Nov 2021 19:46:02 +0000</pubDate>
      <link>https://dev.to/markkozel/mutability-of-javascript-19ma</link>
      <guid>https://dev.to/markkozel/mutability-of-javascript-19ma</guid>
      <description>&lt;p&gt;I love the way JavaScript code has a dynamic aspect that allows for on-the-fly changes&lt;/p&gt;

&lt;p&gt;Coming from a &lt;em&gt;Safety-Critical Software&lt;/em&gt; background, any dynamic construct, like inheritance, was discourages&lt;/p&gt;

&lt;p&gt;Now, learning web programming I am loving the freedom JavaScript includes. Some are likely an effect of being interpreted, but others are just plain cool&lt;/p&gt;

&lt;h2&gt;
  
  
  Object Bracket Notation
&lt;/h2&gt;

&lt;p&gt;ability to reference object elements as an array, somewhat like PHP's &lt;em&gt;associative arrays&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;myObj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;prop1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nx"&gt;myObj&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;prop1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;41&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Adding Object Elements on-the-fly
&lt;/h2&gt;

&lt;p&gt;Coming from C/C++ OOD/P, everything is fixed and unbending&lt;/p&gt;

&lt;p&gt;With JS Object, you can tack on a new element, including functions&lt;/p&gt;

&lt;p&gt;I had some fun with this in an NPM module &lt;a href="https://www.npmjs.com/package/quickjsonconfig"&gt;Quick JSON Config&lt;/a&gt; I wrote a while back&lt;/p&gt;

&lt;p&gt;As the node app reads in each top-level element of the JSON file, it adds get/set function to it's class instance&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="cm"&gt;/**
   * Embeds each json element into this class. Creates a simple get/set method for each
   * @param {object} el - json key-value pair for embedding
   */&lt;/span&gt;
  &lt;span class="nx"&gt;_embedElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;getName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`get&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;getName&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_jsonData&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;setName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`set&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;setName&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;newVal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;newVal&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="k"&gt;typeof&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;_jsonData&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_jsonData&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;newVal&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here I create the functions to get/set the element, then tack it on to the instance using the Bracket Notation&lt;/p&gt;

&lt;h2&gt;
  
  
  Promisify Functions
&lt;/h2&gt;

&lt;p&gt;Working in Node and using some older (well, actually, it is more like &lt;em&gt;not maintained packages&lt;/em&gt;), the mutations are used to wrap function is async/await and Promise constructs&lt;/p&gt;

&lt;p&gt;I have not looked into how packages like &lt;a href="https://www.npmjs.com/package/bluebird"&gt;bluebird&lt;/a&gt; does this, but I expect it is similar to the above items I expressed&lt;/p&gt;

&lt;h2&gt;
  
  
  Of Course...
&lt;/h2&gt;

&lt;p&gt;This means developers must understand these constructs so they do not shoot themselves (or their customers) in the foot&lt;/p&gt;

&lt;p&gt;While safety-critical software has rules and limitations, many are to prevent letting the runtime environment make decisions and change how your code executes&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>mutability</category>
    </item>
    <item>
      <title>My NPM Modules</title>
      <dc:creator>Mark Kozel</dc:creator>
      <pubDate>Sat, 13 Nov 2021 17:13:37 +0000</pubDate>
      <link>https://dev.to/markkozel/my-npm-modules-3l62</link>
      <guid>https://dev.to/markkozel/my-npm-modules-3l62</guid>
      <description>&lt;p&gt;I created a few NPM modules to help with work and personal projects&lt;/p&gt;

&lt;p&gt;I tried a few existing packages, but found that all had many other dependencies...creating large project repos&lt;/p&gt;

&lt;p&gt;Since I needed simple functionality, I decided to make my own without dependencies&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/quickgitjs"&gt;QuickGitJs&lt;/a&gt;: a simple node tool to interact with local repo for status and updates&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/quickjsonconfig"&gt;QuickJSONConfig&lt;/a&gt;: a silly package that reads a JSON (such as package.json) and allows accessing and updating of the file. I say &lt;em&gt;silly&lt;/em&gt; because it does a silly thing as it reads in each element...it creates get/set functions for each top-level JSON element. I did this for fun and realize is it not really practical&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/quickask"&gt;QuickAsk&lt;/a&gt;: a simple prompt function that gets and returns user responses&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/quicktextcolor"&gt;QuickTextColor&lt;/a&gt;: a library of ansi color codes to make cli node apps a little nicer&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/quickhttpd"&gt;QuickHTTPD&lt;/a&gt;: simple node server using the http built-in module. Supports http and https. I built this to help me understand server-side certificate usage&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Computer Organization Textbook</title>
      <dc:creator>Mark Kozel</dc:creator>
      <pubDate>Sat, 13 Nov 2021 16:49:58 +0000</pubDate>
      <link>https://dev.to/markkozel/computer-organization-textbook-31ok</link>
      <guid>https://dev.to/markkozel/computer-organization-textbook-31ok</guid>
      <description>&lt;p&gt;I am in the midst of creating a free, &lt;a href="https://en.wikipedia.org/wiki/Open_educational_resources"&gt;OER&lt;/a&gt; textbook for my computer science course&lt;/p&gt;

&lt;p&gt;Using &lt;a href="https://vuepress.vuejs.org/"&gt;VuePress&lt;/a&gt; to organize and include interactive elements. Currently the site is built on GitHub and deployed to Netlify&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Init Commit</title>
      <dc:creator>Mark Kozel</dc:creator>
      <pubDate>Fri, 12 Nov 2021 13:58:50 +0000</pubDate>
      <link>https://dev.to/markkozel/init-commit-e1h</link>
      <guid>https://dev.to/markkozel/init-commit-e1h</guid>
      <description>&lt;p&gt;&lt;em&gt;obligatory first post&lt;/em&gt;&lt;br&gt;
Interested to see how active this community is. Tried following dev tags and folks on Twitter, but mostly saw posts like:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Top 10 NodeJS Features You MUST Start Using Today!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So hoping algorithms here are a little less dramatic&lt;/p&gt;

&lt;p&gt;Anyway, I love learning new things related to web programming. I love the NodeJs ecosystem and all the capabilities it provides&lt;/p&gt;

&lt;p&gt;Currently learning ExpressJs as an add-on for my team's Launch Support display system&lt;/p&gt;

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