<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Masih Abjadi</title>
    <description>The latest articles on Forem by Masih Abjadi (@masihtak).</description>
    <link>https://forem.com/masihtak</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%2F224606%2F3303ad42-22f2-4f76-b432-8986ba99b30f.png</url>
      <title>Forem: Masih Abjadi</title>
      <link>https://forem.com/masihtak</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/masihtak"/>
    <language>en</language>
    <item>
      <title>Initialize the scaffolding of a web project</title>
      <dc:creator>Masih Abjadi</dc:creator>
      <pubDate>Tue, 21 Jan 2020 17:30:08 +0000</pubDate>
      <link>https://forem.com/masihtak/initialize-the-scaffolding-of-a-web-project-208e</link>
      <guid>https://forem.com/masihtak/initialize-the-scaffolding-of-a-web-project-208e</guid>
      <description>&lt;p&gt;So, you are a little tired of setting up and configuring a project?&lt;br&gt;
I understand, It happens even to the best of us. Programming can be quite frustrating and time-wasting, to say the least. Not to mention the many distractions you may encounter when programming your project. In this article, I will discuss the front-end web development.&lt;/p&gt;

&lt;p&gt;When you begin setting up your first solid web application, settling on how to begin can be a bit hard. One tool that is your best bet at this stage is my scaffolding tool for modern websites. As you may already know, when developing a website, you need to set up a few files, folders, frameworks, and libraries. This process can be painstakingly long and tiring, especially when you have to do it multiple times. Even the most straightforward website will still require you to have at least two files and basic template to get started. This is where I come in! I can help you save time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://camo.githubusercontent.com/4a56b9b4ca3da24a1214e8c8d50ed917b6e05312/68747470733a2f2f6d6173696874616b2e636f6d2f706f7274666f6c696f2f70726f6a656374732f776562696e69742f64656d6f2e676966" class="article-body-image-wrapper"&gt;&lt;img src="https://camo.githubusercontent.com/4a56b9b4ca3da24a1214e8c8d50ed917b6e05312/68747470733a2f2f6d6173696874616b2e636f6d2f706f7274666f6c696f2f70726f6a656374732f776562696e69742f64656d6f2e676966" alt="webinit"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/masihtak/webinit"&gt;Webinit&lt;/a&gt; is a scaffolding tool used to automate project creation. This tool will automate several monotonous tasks so that you can promptly get your project up and ready with the framework, libraries and configurations you wish. It will create assets folder as well as a blank CSS file, JavaScript file, and an index.html with a basic setup, configured how you choose, including CSS frameworks and some CSS libraries, as well as jQuery.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--71httleQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://masihtak.com/blog/file/2020/01/webinit-html-template-file-1024x803.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--71httleQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://masihtak.com/blog/file/2020/01/webinit-html-template-file-1024x803.png" alt="webinit-html-template-file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unfortunately, in most cases, every bit of JavaScript you add to a site is a possible way in for a hacker. This situation is especially true when another party on a public CDN hosts the JavaScript. As you can see, &lt;a href="https://github.com/masihtak/webinit"&gt;Webinit&lt;/a&gt; automatically generates a clean HTML file regarding our specifications and adds SRI hash to the CDN resources to ensure that the code being used is exactly what I intended. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p6g8fG7T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.keycdn.com/img/support/subresource-integrity-lg.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p6g8fG7T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.keycdn.com/img/support/subresource-integrity-lg.webp" alt="subresource-integrity-lg.webp"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is subresource integrit ?
&lt;/h2&gt;

&lt;p&gt;A common practice in modern web development is to use third party resources from CDNs or different services (analytics, ads, etc.). However, doing so can increase the attack surface of your web site/app, if a hacker gains control of a CDN, the hacker can implant random malicious content into files on the CDN or replace them entirely. This process, in turn, gives an attacker the ability to attack all sites fetching files from that CDN.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://w3c.github.io/webappsec-subresource-integrity/"&gt;Subresource integrity &lt;/a&gt; (SRI) enables you to moderate some of the risks of attacks by ensuring the files from your web application and those of a third party CDN are delivered without interference. It works by giving you the power to provide a cryptographic hash that needs to be identical to a fetched file. With &lt;a href="https://github.com/masihtak/webinit"&gt;Webinit&lt;/a&gt;, you can address this security issue right from the start. All these tools are integrated as part of our prescribed workflow to keep you productive. &lt;/p&gt;

&lt;p&gt;In next version I plan to add Sass and SEO option as well. Please let me know your suggestions and ideas so that we can improve the tool for the community. &lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How to Write Efficient Code</title>
      <dc:creator>Masih Abjadi</dc:creator>
      <pubDate>Sat, 14 Sep 2019 18:16:11 +0000</pubDate>
      <link>https://forem.com/masihtak/how-to-write-efficient-code-5h95</link>
      <guid>https://forem.com/masihtak/how-to-write-efficient-code-5h95</guid>
      <description>&lt;p&gt;This article is provided from the research and experience of full-stack developer and alumni &lt;a href="https://twitter.com/masihtak"&gt;Masih Abjadi&lt;/a&gt;&lt;br&gt;
While this article focuses mainly on web technologies, the same concepts can be applied to any programming language.&lt;/p&gt;
&lt;h2&gt;
  
  
  DRY
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vlLXeWhb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1480506132288-68f7705954bd%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D1393%26q%3D80" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vlLXeWhb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1480506132288-68f7705954bd%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D1393%26q%3D80" alt=""&gt;&lt;/a&gt;&lt;br&gt;
(Image credit: Anas Alshanti)&lt;/p&gt;

&lt;p&gt;According to Wikipedia, Don't repeat yourself (DRY), is a principle of software development aimed at reducing repetition of software patterns by replacing it with abstractions or using data normalization to avoid redundancy.&lt;/p&gt;

&lt;p&gt;Often in web development, I have seen many developers repeating themselves, most commonly when using UI libraries such as Bootstrap and Foundation. In this case, developers end up using the full library (not the customized version), rather than the selected parts they need.&lt;br&gt;
For example, unfortunately, many developers will only use the grid system or some component of that library and when they start to customize the UI they start to write their own stylesheet while many of them already exist! And what they are doing is duplicating the code and increase the file size and load time.&lt;/p&gt;

&lt;p&gt;Lets take a look at an example of centering a &lt;code&gt;div&lt;/code&gt; element both horizontally and vertically.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;index.html&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"utf-8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Center the div&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- Styles --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
      &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/css/bootstrap.min.css"&lt;/span&gt;
      &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;
    &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"style.css"&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"row"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;h5&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-header"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Featured&lt;span class="nt"&gt;&amp;lt;/h5&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-body"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;h5&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-title"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Special title treatment&lt;span class="nt"&gt;&amp;lt;/h5&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-text"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
              With supporting text below as a natural lead-in to additional
              content.
            &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"btn btn-primary"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Go somewhere&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;code&gt;style.css&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;html&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.card&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;400px&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;These are the initial setup files.&lt;/p&gt;

&lt;p&gt;Now we want to center the &lt;code&gt;div&lt;/code&gt; element, there are many methods available to achieve this. You may have noticed we are using the Bootstrap 4 library, this means we can use a utility class to do this for us:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"utf-8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Center the div&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- Styles --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
      &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/css/bootstrap.min.css"&lt;/span&gt;
      &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;
    &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"style.css"&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"container h-100"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"row h-100 justify-content-center align-items-center"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"col-md-6"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;h5&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-header"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Featured&lt;span class="nt"&gt;&amp;lt;/h5&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-body"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
              &lt;span class="nt"&gt;&amp;lt;h5&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-title"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Special title treatment&lt;span class="nt"&gt;&amp;lt;/h5&amp;gt;&lt;/span&gt;
              &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-text"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                With supporting text below as a natural lead-in to additional
                content.
              &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
              &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"btn btn-primary"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Go somewhere&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The above example shows how easy this is, all we needed to do is make use of a few built in utility classes.&lt;/p&gt;

&lt;p&gt;The main mistake developers make when using UI frameworks is not using all of the features, this is an example of one of the more underrated features of Bootstrap 4. By using the utility classes we save ourselves from having to write our own CSS, reducing the code required for the application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of DRY
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Maintainability:&lt;/strong&gt;&lt;br&gt;
The biggest benefit of using DRY is maintainability. If the logic of checking permissions is repeated all over the codebase, it becomes difficult to fix issues that arise in the repeated code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Readability:&lt;/strong&gt;&lt;br&gt;
More often than not, DRY code is more readable. This is not because of the DRY principle itself, but rather because of the extra effort the developer put into the code to make it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reuse:&lt;/strong&gt;&lt;br&gt;
DRY inherently promotes reuse of code because we are merging 2 or more instances of repeating code into a single block. Reusable code pays off in the long run as it speeds up development time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cost:&lt;/strong&gt;&lt;br&gt;
If management needs to be convinced to spend more time on improving the quality of code, this is it. More code costs more. More code takes more people more time to maintain and to address bugs. More time to develop and more bugs leads to a very unhappy customer. Enough said!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing:&lt;/strong&gt;&lt;br&gt;
We are talking about unit tests and integration tests here, not manual testing. The more paths and functions you have to cover using the tests, the more code you have to write for tests. If code is not repeated, you just have to test one main path. Of course, different behaviors still need to be tested.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dzone.com/articles/is-your-code-dry-or-wet"&gt;Is Your Code DRY or WET? - DZone DevOps&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Writing Semantic Code
&lt;/h2&gt;

&lt;p&gt;Speaking about the semantic code in HTML, many developers think this only means using HTML5 semantic elements (header, nav, section, article, aside, footer) instead of &lt;code&gt;div&lt;/code&gt; elements but that's not true! Semantic code means to write code that describes the content rather than how that content should look.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T5FQsojH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/3RkRFwq4/team.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T5FQsojH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/3RkRFwq4/team.png" alt="team.png"&gt;&lt;/a&gt;&lt;br&gt;
I got this image from a real website but for privacy reasons, I changed names and pictures.&lt;br&gt;
the code for each team is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"col-md-4 bottommargin"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"team"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"team-image"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"images/team1.jpg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Josh Clark"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"team-overlay"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        ..........
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"team-desc team-desc-bg"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"team-title"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;h4&amp;gt;&lt;/span&gt;JOHN DOE&lt;span class="nt"&gt;&amp;lt;/h4&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;Co-Founder&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Lots of &lt;code&gt;div&lt;/code&gt;, right?&lt;/p&gt;

&lt;p&gt;We can reach the same outcome by using &lt;a href="http://www.w3schools.com/tags/tag_figure.asp"&gt;figure Tag&lt;/a&gt;, to better understand this concept I will show you one of my projects:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iTwgo4XO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/KjtX7xNY/Annotation-2019-04-16-053851.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iTwgo4XO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/KjtX7xNY/Annotation-2019-04-16-053851.png" alt="events"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"col-sm-4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;figure&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"event"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt;
      &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"assets/img/event1.jpg"&lt;/span&gt;
      &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt;
      &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"animated pulse"&lt;/span&gt;
      &lt;span class="na"&gt;data-animated=&lt;/span&gt;&lt;span class="s"&gt;"pulse"&lt;/span&gt;
    &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;figcaption&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;time&lt;/span&gt; &lt;span class="na"&gt;datetime=&lt;/span&gt;&lt;span class="s"&gt;"2017-11-12"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;12 November 2017&lt;span class="nt"&gt;&amp;lt;/time&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"lead"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Moscow Never Slip Party&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Read more&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/figcaption&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/figure&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In this example I used semantic code, which is very neat and easy to understand just from looking at the markup.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why semantic code matters
&lt;/h3&gt;

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

&lt;ul&gt;
&lt;li&gt;Many visually impaired people rely on text to speech browsers to read pages back to them. These programs cannot interpret pages very well unless they are clearly explained by semantic markup.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Search engines need to understand what your content is about in order to rank you properly on search engines. Semantic code tends to improve your placement on search engines, as it is easier for the "search engine spiders" to understand.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Semantic code makes site updates easier because you can apply design style to headings across an entire site instead of on a per page basis.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Semantic code is much more expressive and easier for people to understand, so if a new web designer picks up the code they can understand it much faster.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Because semantic code does not contain design elements it is possible to change the look and feel of your site without recoding all of the HTML.&lt;/li&gt;
&lt;li&gt;Once again, because design is held separately from your content, semantic code allows anybody to add or edit pages without having to have a good eye for design. You simply describe the content and the cascading style sheet defines what that content looks like.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;"Any fool can write code that a computer can understand. good programmers write code that humans can understand" - Martin Fowler&lt;/p&gt;




&lt;h2&gt;
  
  
  Accessibility
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0CTn_PBA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.newtarget.com/sites/default/files/styles/hero-image/public/webaccessibility2.jpg%3Fitok%3DRKiSkBoW" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0CTn_PBA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.newtarget.com/sites/default/files/styles/hero-image/public/webaccessibility2.jpg%3Fitok%3DRKiSkBoW" alt="webaccessibility2.jpg?itok=RKiSkBoW"&gt;&lt;/a&gt;&lt;br&gt;
(Image credit: "newtarget")&lt;/p&gt;

&lt;p&gt;"The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect."&lt;br&gt;
-Tim Berners-Lee, W3C Director and inventor of the World Wide Web&lt;/p&gt;

&lt;p&gt;Accessibility by itself is a huge topic and I'm not going to cover it all.&lt;/p&gt;

&lt;p&gt;Even if your website is well coded and well designed, you are still targeting a limited amount of users.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.practicalecommerce.com/Accessibility-How-Many-Disabled-Web-Users-Are-There"&gt;How Many Disabled Web Users Are There? &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Accessibility is essential for developers and organizations that want to create high-quality websites and web tools, and not exclude people from using their products and services.&lt;/p&gt;

&lt;p&gt;The Web is fundamentally designed to work for all people, whatever their hardware, software, language, location, or ability. When the Web meets this goal, it is accessible to people with a diverse range of hearing, movement, sight, and cognitive ability.&lt;/p&gt;

&lt;p&gt;Unfortunately, when we are talking about Accessibility we will think about people with disabilities but it doesn't mean that exactly! For example, the color combination choice might work well on large screens and indoors but be more difficult to see on smaller screens or outside with the glare of the sun, or the color &lt;a href="https://a11yproject.com/posts/what-is-color-contrast/"&gt;Color Contrast&lt;/a&gt; during the day and night.&lt;/p&gt;

&lt;p&gt;Here I just pointed to a small part of accessibility, I highly encourage you to use the links below and gain more information about this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.w3.org/TR/WCAG20/"&gt;Web Content Accessibility Guidelines (WCAG) 2.0&lt;/a&gt;&lt;br&gt;
&lt;a href="https://developers.google.com/web/fundamentals/accessibility/"&gt;https://developers.google.com/web/fundamentals/accessibility/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/"&gt;Introduction to Web Accessibility | Web Accessibility Initiative (WAI) | W3C&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;"The sooner you start to code, the longer the program will take" - Roy Carlson&lt;br&gt;
"There's a big difference between knowing how to code and understanding it! " - Masih Abjadi&lt;/p&gt;

&lt;p&gt;Before writing code always try to think about it, I'm not talking about making a design or wireframe before you start coding, I mean when you are ready for the coding stage take some time and think about the elements you want to build.&lt;/p&gt;

&lt;p&gt;If you want to use a framework, make sure you spend a little time reading the documentation, next see if you can build that element a better way using semantic code or with regards to accessibility, even if it's a simple project make a habit of writing efficient code!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>codequality</category>
    </item>
  </channel>
</rss>
