<?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: Hossam Mourad</title>
    <description>The latest articles on DEV Community by Hossam Mourad (@hossammourad).</description>
    <link>https://dev.to/hossammourad</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%2F173272%2F38410f3e-53b8-486e-9a04-f245bd72b7ff.png</url>
      <title>DEV Community: Hossam Mourad</title>
      <link>https://dev.to/hossammourad</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hossammourad"/>
    <language>en</language>
    <item>
      <title>What terminal do you use?</title>
      <dc:creator>Hossam Mourad</dc:creator>
      <pubDate>Wed, 08 Jul 2020 10:11:06 +0000</pubDate>
      <link>https://dev.to/hossammourad/what-terminal-do-you-use-50g2</link>
      <guid>https://dev.to/hossammourad/what-terminal-do-you-use-50g2</guid>
      <description>&lt;p&gt;I was a long term user of iTerm but recently made the switch to Hyper.&lt;/p&gt;

&lt;p&gt;What terminal do you use and what kind of extensions/tricks/aliases that you use frequently?&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>productivity</category>
    </item>
    <item>
      <title>What I have learned about Deno so far</title>
      <dc:creator>Hossam Mourad</dc:creator>
      <pubDate>Mon, 01 Jun 2020 15:39:13 +0000</pubDate>
      <link>https://dev.to/hossammourad/what-i-have-learned-about-deno-so-far-n3h</link>
      <guid>https://dev.to/hossammourad/what-i-have-learned-about-deno-so-far-n3h</guid>
      <description>&lt;p&gt;I'm sure most of us by this time know what &lt;a href="https://deno.land/"&gt;Deno&lt;/a&gt; is. For those who don't know it is a runtime for JavaScript and TypeScript. It is similar to Node.js but yet different, it is created by the same &lt;a href="https://en.wikipedia.org/wiki/Ryan_Dahl"&gt;programmer&lt;/a&gt; but it is not here to replace Node.js by any means disregarding how alike they may appear.&lt;/p&gt;

&lt;p&gt;For the last couple of days I've been reading Deno's documentation, reading blog posts and watching tutorials about Deno and in this post I will try to explain what I've learned so far about Deno and also my thoughts about some of its principles.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. It is secure by default
&lt;/h3&gt;

&lt;p&gt;In Deno, you have to grant your program permissions to perform certain tasks. For example if you have a program that will need network access, you have to run your program with the &lt;code&gt;--allow-net&lt;/code&gt; flag or the program will fail. You can check out &lt;a href="https://deno.land/manual/getting_started/permissions"&gt;this page&lt;/a&gt; to know more about this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My thoughts&lt;/strong&gt;:&lt;br&gt;
I like this feature. It is always a mysterious thing for me to know if a given program is accessing my disk or the network internally without my knowledge which left me cautious about using any third-party module especially in sensitive contexts. With this feature I can definitely tell what the program I'm running is accessing. This feature reminds me of the &lt;a href="https://www.xda-developers.com/files/2014/06/style-typography15_large_xhdpi.png"&gt;permission prompt&lt;/a&gt; we receive on mobile phones when an app is trying to access any of the device's resources. I remember vividly deleting mobile phone applications immediately delete after opening them for the first time because they are trying to access a resource that I don't find essential for the app to function normally.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. It doesn't save external modules inside your project
&lt;/h3&gt;

&lt;p&gt;This is one of the most controversial features of Deno. In simple words you don't install a third-party module or keep a packages file (like &lt;code&gt;package.json&lt;/code&gt; in Node.js) inside your project. In Deno you import modules like the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { App } from "https://deno.land/x/attain/mod.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you run your program for the first time, the module is downloaded and cached on your desk for future usage. And if you are worried about code editors support for that, I've tried the &lt;a href="https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno"&gt;Deno VSCode extension&lt;/a&gt; and it is working as what you would expect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My thoughts&lt;/strong&gt;:&lt;br&gt;
I'm not sure if I like this feature or not. On one hand I don't like how packages are handled currently in JavaScript with NPM. There are certain problems with the &lt;code&gt;package.json&lt;/code&gt; and &lt;code&gt;node_modules&lt;/code&gt; philosophy that needs its own post but I have always felt that it is an area with a lot of improvement room. On the other hand I'm not sure how secure/reliable it is to fetch code from a link. I think this is one of the huge changes in the whole industry not only in Deno that we need to experiment with and monitor in production applications before we can label it with good or bad.&lt;/p&gt;
&lt;h3&gt;
  
  
  3. Supports TypeScript out of the box
&lt;/h3&gt;

&lt;p&gt;You can start writing TypeScript code right away, no need to install &lt;code&gt;ts-node&lt;/code&gt; or &lt;code&gt;babel&lt;/code&gt;. Just use the &lt;code&gt;.ts&lt;/code&gt; extension and Deno runtime will compile the file before running it. You can create &lt;code&gt;.js&lt;/code&gt; files and Deno will run them right away.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My thoughts&lt;/strong&gt;:&lt;br&gt;
One thing to note here is that the file extension is essential in import statements. Because in Deno you can write &lt;code&gt;.js&lt;/code&gt; or &lt;code&gt;.ts&lt;/code&gt; modules, in imports statements you have to explicitly mention the file extension&lt;/p&gt;

&lt;p&gt;This will work fine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;p&gt;But this will throw an error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { assertEquals } from "https://deno.land/std/testing/asserts";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is different from the situation in Node.js so I assume people will find this laborious initially.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Has a built-in test runner
&lt;/h3&gt;

&lt;p&gt;There is a built-in testing runner already implemented in Deno's namespace. It can be accessed from &lt;code&gt;Deno.test&lt;/code&gt;. How does it look?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

Deno.test("hello world", () =&amp;gt; {
  const x = 1 + 2;
  assertEquals(x, 3);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;My thoughts&lt;/strong&gt;:&lt;br&gt;
I definitely like this feature. Not because the test runner is powerful or because it contains features that don't exist in other test runners. I like it because it paves the way of standardization in the JavaScript realm. It has been always a problem in the JavaScript community that there is no standard for anything. There is tenths of libraries that do the same thing and all of them are popular. Adding a built-in test runner will -hopefully- make it the standard library to write tests in Deno and then all the efforts will -hopefully- go into improving it. I'm sure that it is not powerful as any other test runner that Node.js has but with time I think it will be.&lt;/p&gt;
&lt;h3&gt;
  
  
  5. It is browser-compatible
&lt;/h3&gt;

&lt;p&gt;Deno is trying to be as browser-compatible as possible, for example &lt;code&gt;fetch&lt;/code&gt; and the global &lt;code&gt;window&lt;/code&gt; object are built-in. Also, it supports top-level &lt;code&gt;await&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This line will work fine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;await fetch(url)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;without a need for calling an await function inside of an async function but that doesn't work in all other cases. In this example you have to define the parent function as an async before using await:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const addEntry = async ({ request }) =&amp;gt; {
  const body = await request.body()
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example is using the &lt;a href="https://deno.land/x/oak"&gt;Oak third part library&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Misc
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Deno uses ES Modules, you can use import/export VS require in Node.js&lt;/li&gt;
&lt;li&gt;It has &lt;a href="https://deno.land/std"&gt;standard modules&lt;/a&gt; and &lt;a href="https://deno.land/x"&gt;third-party modules&lt;/a&gt;. The standard modules are built by the core team of Deno are they are responsible for maintaining them. Another step towards standardization in the community.&lt;/li&gt;
&lt;li&gt;Deno has the same letters as Node&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This post was originally posted at &lt;a href="https://hossammourad.com/learned-about-deno-so-far/"&gt;https://hossammourad.com/learned-about-deno-so-far/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>deno</category>
      <category>typescript</category>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>Get Color Name Extension</title>
      <dc:creator>Hossam Mourad</dc:creator>
      <pubDate>Wed, 29 May 2019 19:03:56 +0000</pubDate>
      <link>https://dev.to/hossammourad/get-color-name-extension-338p</link>
      <guid>https://dev.to/hossammourad/get-color-name-extension-338p</guid>
      <description>&lt;p&gt;A VSCode extension to get the name of the color from its HEX value&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--M2tt70m6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/qixnlt315rhodsh29wiu.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--M2tt70m6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/qixnlt315rhodsh29wiu.gif" alt="" width="600" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=HossamMourad.vscode-get-color-name"&gt;https://marketplace.visualstudio.com/items?itemName=HossamMourad.vscode-get-color-name&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vscode</category>
    </item>
  </channel>
</rss>
