<?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: Sakis bal</title>
    <description>The latest articles on DEV Community by Sakis bal (@thanasismpalatsoukas).</description>
    <link>https://dev.to/thanasismpalatsoukas</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%2F305200%2F7ed4afd1-9263-47ab-967e-86a45c0b7b3f.jpg</url>
      <title>DEV Community: Sakis bal</title>
      <link>https://dev.to/thanasismpalatsoukas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thanasismpalatsoukas"/>
    <language>en</language>
    <item>
      <title>A Game-Changer for SEO: Harnessing the Power of Google Rich Content results</title>
      <dc:creator>Sakis bal</dc:creator>
      <pubDate>Sun, 25 Jun 2023 17:53:51 +0000</pubDate>
      <link>https://dev.to/thanasismpalatsoukas/a-game-changer-for-seo-harnessing-the-power-of-google-rich-content-results-1ak2</link>
      <guid>https://dev.to/thanasismpalatsoukas/a-game-changer-for-seo-harnessing-the-power-of-google-rich-content-results-1ak2</guid>
      <description>&lt;p&gt;SEO is pretty important these days and the more tools we utilize to gain more visibility the better. That is why we are going to look at Google Rich Content today and how to implement it on our websites.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is Google Rich contents results?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In simple terms Google is basically a crawling machine that reads URLs and its contents and tries to understand how to query this content so its visible for everyone on the web. &lt;/p&gt;

&lt;p&gt;To help google understand our content better and show it to the end user in a more presentable way we can &lt;strong&gt;provide google with structured markup data that describes certain features of our website&lt;/strong&gt;. This structured data is then used by google to create Rich content results &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%2Fu8ecipyha1jkq6a0g8zs.png" 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%2Fu8ecipyha1jkq6a0g8zs.png" alt="Google rich results articles"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;center&gt;&lt;small&gt; &lt;a href="https://developers.google.com/search/docs/appearance/structured-data/article" rel="noopener noreferrer"&gt;&lt;strong&gt;Google rich results articles&lt;/strong&gt;&lt;/a&gt; &lt;/small&gt;&lt;/center&gt;
&lt;br&gt;

&lt;p&gt;&lt;strong&gt;Research has show that using Google Rich Content has increased the CTR of many big companies. According to Google one of those is Nestlé&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
Nestlé has measured pages that show as rich results in search have an 82% higher click through rate than non-rich result pages.
&lt;/blockquote&gt;

&lt;p&gt;&lt;small&gt;&lt;center&gt;&lt;a href="https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data" rel="noopener noreferrer"&gt;Case studies of websites that have implemented structured data for their site&lt;/a&gt;&lt;/center&gt;&lt;/small&gt;&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Types of supported rich content
&lt;/h2&gt;

&lt;p&gt;Google supports a variety of markup data that generates rich content results. Some of my favourite are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://developers.google.com/search/docs/appearance/structured-data/article" rel="noopener noreferrer"&gt;Article&lt;/a&gt; 📚&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developers.google.com/search/docs/appearance/structured-data/event" rel="noopener noreferrer"&gt;Event&lt;/a&gt; 🎫&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developers.google.com/search/docs/appearance/structured-data/faqpage" rel="noopener noreferrer"&gt;FAQ&lt;/a&gt; 🤔&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developers.google.com/search/docs/appearance/structured-data/local-business" rel="noopener noreferrer"&gt;Local Business&lt;/a&gt; 👨‍💼&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developers.google.com/search/docs/appearance/structured-data/logo" rel="noopener noreferrer"&gt;Logo&lt;/a&gt; 🏢&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developers.google.com/search/docs/appearance/structured-data/product" rel="noopener noreferrer"&gt;Product&lt;/a&gt; 📦&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developers.google.com/search/docs/appearance/structured-data/qapage" rel="noopener noreferrer"&gt;Q&amp;amp;A&lt;/a&gt; ❓&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developers.google.com/search/docs/appearance/structured-data/recipe" rel="noopener noreferrer"&gt;Recipe&lt;/a&gt; 👩‍🍳&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developers.google.com/search/docs/appearance/structured-data/video" rel="noopener noreferrer"&gt;Video&lt;/a&gt; 🎥&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Implementing Google Rich Content&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To implement rich content we will need to use the &lt;a href="https://schema.org/" rel="noopener noreferrer"&gt;Schema org&lt;/a&gt; data structure for our markup and add it inside our HTML. Let's look at an example of implementing the JSON LD data type.&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;application/ld+json&lt;/span&gt;&lt;span class="dl"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@context&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://schema.org&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;NewsArticle&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;headline&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Title of a News Article&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;image&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://example.com/photos/1x1/photo.jpg&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;datePublished&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2015-02-05T08:00:00+08:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dateModified&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2015-02-05T09:20:00+08:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;author&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Person&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Jane Doe&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;url&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://example.com/profile/janedoe123&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above example is from the schema type of &lt;em&gt;NewsArticle&lt;/em&gt;. You can search for the data type in &lt;a href="https://schema.org/" rel="noopener noreferrer"&gt;Schema org&lt;/a&gt; to see all the available fields.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;However you MUST include the required minimum fields from the Google documentation otherwise Google won't able to extract the necessary information to validate the data.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some more important points to note is that &lt;strong&gt;the content that is described by the JSON should be visible to users on the website they are visiting.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;For example if you are going to create a JSON that references an article it should be visible to users in your frontend.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do i check if my website has rich content results?
&lt;/h2&gt;

&lt;p&gt;Alright, you have created your neat JSON objects and you are ready to showcase your articles, videos and more on your search results. But how do you know if you implemented the JSON correctly and that google is actually aware of it?&lt;/p&gt;

&lt;p&gt;Don't sweat because Google has created &lt;a href="https://search.google.com/test/rich-results" rel="noopener noreferrer"&gt;&lt;strong&gt;a neat little tool&lt;/strong&gt;&lt;/a&gt; for us to test if our website supports rich contents and to warn us if we have a mistake on our JSON.&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%2Ffdxc2hdxt3l9q9m1390a.png" 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%2Ffdxc2hdxt3l9q9m1390a.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing thoughts
&lt;/h2&gt;

&lt;p&gt;Think about ways you might add content as rich results in google. Maybe add Q&amp;amp;A content on your page or some videos that showcase your product.&lt;/p&gt;

&lt;p&gt;Google rich contents are a great way to showcase your website in a more robust and colorful way. Take up more space on the search results and get your CTR up!&lt;/p&gt;

&lt;p&gt;Important links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developers.google.com/search/docs/appearance/structured-data/search-gallery" rel="noopener noreferrer"&gt;Structured data markup that Google Search supports&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://search.google.com/test/rich-results" rel="noopener noreferrer"&gt;Does your page support rich results?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://schema.org/" rel="noopener noreferrer"&gt;Schema.org&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>👨🏻‍💻Securing Your Web Applications from SQL Injection with SQLMap</title>
      <dc:creator>Sakis bal</dc:creator>
      <pubDate>Sat, 10 Jun 2023 11:46:02 +0000</pubDate>
      <link>https://dev.to/thanasismpalatsoukas/securing-your-web-applications-from-sql-injection-with-sqlmap-27ea</link>
      <guid>https://dev.to/thanasismpalatsoukas/securing-your-web-applications-from-sql-injection-with-sqlmap-27ea</guid>
      <description>&lt;p&gt;&lt;small&gt;&lt;a href="https://pixabay.com//?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=4084717" rel="noopener noreferrer"&gt;Cover image by Pete Linforth&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
What is SQL injection

&lt;ol&gt;
&lt;li&gt;A practical example of SQL injection&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;

SQLMap: Automated SQLi testing

&lt;ol&gt;
&lt;li&gt;Routes protected by authorization&lt;/li&gt;
&lt;li&gt;Slowing down queries&lt;/li&gt;
&lt;li&gt;Enumerating the database&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;

Protecting against SQLi

&lt;ol&gt;
&lt;li&gt;Prepared query&lt;/li&gt;
&lt;li&gt;Sanitize and escape user input&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;Legally test SQLMap on intentionally injectable websites&lt;/li&gt;

&lt;/ol&gt;

&lt;h1&gt;
  
  
  What is SQL injection
&lt;/h1&gt;

&lt;p&gt;SQL injection is a way for attackers to change the queries that interact with the database and &lt;em&gt;&lt;strong&gt;"inject"&lt;/strong&gt;&lt;/em&gt; their own queries. A typical example is a query that has been composed from concatenation which includes user inputed variables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;"SELECT * FROM users WHERE id = "&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;_GET&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above query can be &lt;em&gt;&lt;strong&gt;"injected"&lt;/strong&gt;&lt;/em&gt; through the $_GET["id"] parameter. &lt;/p&gt;

&lt;p&gt;SQL injection is still one of the most common ways to penetrate a website. A study from 2019 shows that &lt;strong&gt;29% of websites are still susceptible to sql injection attacks&lt;/strong&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%2Fot3dgbwnxv3tyii7jzox.png" 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%2Fot3dgbwnxv3tyii7jzox.png" alt="Image description"&gt;&lt;/a&gt; &lt;small&gt;Credit: &lt;a href="https://www.ptsecurity.com/ww-en/analytics/web-vulnerabilities-2020/" rel="noopener noreferrer"&gt;Web Application vulnerabilities and threats : statistics for 2019&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical example of SQL injection
&lt;/h2&gt;

&lt;p&gt;The above SQL code might run by doing a GET reques to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://example.com/article?id=1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So it expects id to be 1. Which would result in the SQL query to be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;"SELECT * FROM users WHERE id = 1"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, if we think smart about it we know that we can extend the query to return more results. &lt;/p&gt;

&lt;p&gt;If instead of 1 we would write something like &lt;strong&gt;1 or 1 = 1&lt;/strong&gt; the query would extend and we would be able to get all user information from the database. The request would look like that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://example.com/article?id=1 or 1=1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and the query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$q = "SELECT * FROM users WHERE id = 1 or 1=1";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  SQLMap: Automated SQLi testing
&lt;/h2&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%2Fwa0trygq8ct2dtls3z64.png" 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%2Fwa0trygq8ct2dtls3z64.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are many types of SQLinjection and it would take an awful amount of time to check for all types of SQLi against a target. This is why SQLMap was created. It automates the process of testing. &lt;/p&gt;

&lt;p&gt;To download SQLMap if you are on Linux distribution you can type.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install sqlmap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For &lt;strong&gt;Windows&lt;/strong&gt; you can download the github version&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep in mind that you need to have python downloaded in your machine as well to run sqlmap.&lt;/p&gt;

&lt;p&gt;SQLMap comes with a plethora of parameters and flags that we will explore in this article. &lt;/p&gt;

&lt;p&gt;To start we will see a simple attack to a certain endpoint. We need to use the -u parameter to set the endpoint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sqlmap -u "https://example.com/articles?id=1"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will test a single endpoint for sql injection. However we still need to press "Y" on everything. This is sometimes useful but most times it is better to just go with the default behavior to speed up the process so you can add the --batch parameter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sqlmap -u "https://example.com/articles?id=1" --batch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This speeds up the process a bit. However you still need to manually test every single endpoint and most websites have more than just 5 or 10 endpoints to test. So we would need a tool that let's us &lt;strong&gt;crawl&lt;/strong&gt; through the links of the website and perform sql injection when it sees parameters sent to the backend. &lt;/p&gt;

&lt;p&gt;Luckily SQLMap has a --crawl= parameter which does exactly that. Depending on the value it will crawl down as many directories from the root of the website.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sqlmap -u "https://example.com/articles?id=1" --batch --crawl=2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SQLmap starts living up to its name as we are actually truly automating the process. However we are not done yet. We can speed the process up a bit more by adding the --smart flag. This flag performs SQLi only if it finds positive heuristics. By adding --smart most endpoints will not be tested at all for SQLi which will speed to the process tremendously. &lt;/p&gt;

&lt;p&gt;We can also add more threads so that more requests are executed if we are confident that the server can handle it by using the --threads= flag.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sqlmap -u "https://example.com/articles?id=1" --batch --crawl=2 --smart --threads=10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Routes protected by authorization
&lt;/h2&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%2Ffwpj4lp61zshm6e7hesa.png" 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%2Ffwpj4lp61zshm6e7hesa.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Most web applications have routes that are protected by authorizations. This means that they can only be accessed if we have logged in for example. &lt;/p&gt;

&lt;p&gt;In typical PHP applications you can continue the session by sending a PHPSESSID cookie to the server.&lt;/p&gt;

&lt;p&gt;In order to test the routes that are access after the log in has occurred we would need to add a --cookie="PHPSESSID=" flag. The PHPSESSID can be found in Chrome under application &amp;gt; Cookies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sqlmap -u "https://example.com/articles?id=1" --batch --crawl=2 --smart --threads=10 --cookies="PHPSESSID=&amp;lt;String&amp;gt;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Slowing down requests
&lt;/h2&gt;

&lt;p&gt;If you are testing on a live website and you don't want to disrupt it you can use the --delay= flag which will delay each HTTP request by the  value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enumerating the database
&lt;/h2&gt;

&lt;p&gt;In this phase, after an SQLi has been found you can start enumerating the database to start seeing the users, databases, tables and column tables. &lt;/p&gt;

&lt;p&gt;Keep in mind that the speed in which he exploitation will take place depends a lot on the type of SQLi that has been found. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In-band SQLi&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In-band SQL Injection occurs when an attacker is able to use the same communication channel to both launch the attack and gather results. (&lt;a href="https://www.acunetix.com/websitesecurity/sql-injection2/" rel="noopener noreferrer"&gt;https://www.acunetix.com/websitesecurity/sql-injection2/&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This type of attack is very fast in comparison to&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inferential SQLi (Blind SQLi)&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;an attacker is able to reconstruct the database structure by sending payloads, observing the web application’s response and the resulting behavior of the database server. (&lt;a href="https://www.acunetix.com/websitesecurity/sql-injection2/" rel="noopener noreferrer"&gt;https://www.acunetix.com/websitesecurity/sql-injection2/&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With Blind SQLi you should focus more on extracting key databases and tables instead of trying to dump the whole database which will be impossible on most cases.&lt;/p&gt;

&lt;p&gt;To start enumerating you can use the --dbs flag. This will show all the databases that are available. After choosing a database with the -D flag you would search in the same way for the tables with --tables and then choose a table using -T flag.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sqlmap -u "https://example.com/&amp;lt;EXPLOITED URL&amp;gt; -D myapp -T users --dump"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the above code you would dump the data from the table users &lt;/p&gt;

&lt;h1&gt;
  
  
  Protecting against SQLi
&lt;/h1&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%2Fbuov0qopuqjksseqpj9l.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%2Fbuov0qopuqjksseqpj9l.jpg" alt="Image description"&gt;&lt;/a&gt; &lt;a href="https://www.pexels.com/photo/security-logo-60504" rel="noopener noreferrer"&gt;Photo by Pixabay&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Prepared query
&lt;/h2&gt;

&lt;p&gt;The easiest way to protect against SQL injections is to use prepared statements. Never concatenate user inputted parameters inside of SQL queries. For example the above query should be&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$q = "SELECT * FROM users WHERE id = ?";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would prevent SQL injection from happening.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sanitize and escape user input
&lt;/h2&gt;

&lt;p&gt;If for whatever reason you are unable to make a prepared statement and you need to concatenate a string to a query you should be absolutely certain about what values make it inside the Query.&lt;/p&gt;

&lt;p&gt;On our example above we can make sure that the $_GET parameter is sanitized and is always an integer before being used inside the query&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;$_GET&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this way we can make sure that whatever the user is requesting will have to be an integer&lt;/p&gt;

&lt;p&gt;You should escape the character when necessary as well. If the input is not strictly and integer and when it can be a string you should strip it to make sure the input will not escape the query.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;addslashes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'descr'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Legally test SQLMap on intentionally injectable websites
&lt;/h1&gt;

&lt;p&gt;If you really want to test the tool online there are websites out there that are intentionally weak against SQLi attacks. &lt;a href="http://testphp.vulnweb.com/" rel="noopener noreferrer"&gt;http://testphp.vulnweb.com/&lt;/a&gt; is one of them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parrot Ctf
&lt;/h2&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%2Fkx8txyjbbs1nyxbemchc.png" 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%2Fkx8txyjbbs1nyxbemchc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Parrot Ctf has a lot of free labs which let you test different hacking skills. Here is a lab that is specific &lt;a href="https://parrot-ctfs.com/dashboard/box.php?boxID=7330078175" rel="noopener noreferrer"&gt;to SQLi&lt;/a&gt;. &lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;SQLMap is a powerful tool for exploiting security issues. Use it wisely, and use it legally on sites that you have permission to run tests on. Lights off, have a fun weekend!&lt;/p&gt;

</description>
      <category>sql</category>
      <category>security</category>
      <category>beginners</category>
      <category>web</category>
    </item>
    <item>
      <title>Universally Bad Programming Practises (and their alternatives) pt.1</title>
      <dc:creator>Sakis bal</dc:creator>
      <pubDate>Thu, 26 Jan 2023 19:47:30 +0000</pubDate>
      <link>https://dev.to/thanasismpalatsoukas/universally-bad-programming-practises-and-their-alternatives-pt1-5ck7</link>
      <guid>https://dev.to/thanasismpalatsoukas/universally-bad-programming-practises-and-their-alternatives-pt1-5ck7</guid>
      <description>&lt;p&gt;The focus of this post is to highlight &lt;strong&gt;bad programming practises that can occur on any modern programming language or framework&lt;/strong&gt;. We are going to try and identify bad practises that are unquestionably wrong and should be avoided.&lt;/p&gt;

&lt;p&gt;To try and analyse these bad practises, undestand why they are happening and how they can be solved we will need a programming language to show some concrete examples. &lt;strong&gt;We will use PHP&lt;/strong&gt; for this as i am most familiar with it.&lt;/p&gt;




&lt;p&gt;So one of the unquestionable bad practises used is...&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Uncontrolled usage of global variables&lt;/strong&gt; 🤪
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fbxskf7w59cbh72j79ayj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fbxskf7w59cbh72j79ayj.png" alt="A line that goes from complex to straight" width="626" height="352"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(in reverse)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Our usual suspects are &lt;strong&gt;Global Mutatable States&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.javatpoint.com/what-is-global-variable" rel="noopener noreferrer"&gt;Global&lt;/a&gt;&lt;/strong&gt; means that it can be &lt;strong&gt;accessed from every point of our code&lt;/strong&gt;. A usual example for this is the $_POST, $_GET or $_SESSION parameter in PHP. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Mutable" rel="noopener noreferrer"&gt;Mutatable&lt;/a&gt;&lt;/strong&gt; means that it &lt;strong&gt;can change its value from everywhere&lt;/strong&gt;. $_SESSION parameter is an example of a parameter that is going to be used throughout our application and can change its state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://academind.com/tutorials/what-is-state" rel="noopener noreferrer"&gt;State&lt;/a&gt;&lt;/strong&gt; is the current situation. For example a switch of a light has two states. Being on or off. Based on its history it can only go from one state to another. If it is On the only state it can go into is being off.&lt;/p&gt;

&lt;p&gt;One clear example of widespread use of Global mutatable states is the &lt;strong&gt;$_SESSION variable in PHP&lt;/strong&gt;.&lt;/p&gt;



&lt;h2&gt;
  
  
  An example of uncontrolled usage of a global variable🔧
&lt;/h2&gt;

&lt;p&gt;Let's suppose that you are saving in a session the information of a cart in an e-shop. $_SESSION['cart']. Your use of the session variable is justified as the user will need access to the cart information througout his visit. Let's look at an example of a function that takes a decision based on the cart length&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;sendNotificationEmailBasedOnCartLength&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="nb"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$_SESSION&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'cart'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;$_SESSION&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'cart'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'hasSentEmail'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;sendSomeEmail&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nv"&gt;$_SESSION&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'cart'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'hasSentEmail'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&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;h3&gt;
  
  
  Unessesary global injection ❌
&lt;/h3&gt;

&lt;p&gt;Issues that injection presents:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Maintainabillity:&lt;/strong&gt;&lt;br&gt;
In this example we can see that there is an &lt;strong&gt;unecessary injection of the global variable $_SESSION['cart']&lt;/strong&gt; inside function. This function is at this point &lt;strong&gt;dependant&lt;/strong&gt; on the $_SESSION variable to function. Even if we decide later that we have found a better way to store and retrieve cart information we will have to &lt;strong&gt;identify every point that $_SESSION&lt;/strong&gt; is used and change the usage. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Readabillity:&lt;/strong&gt;&lt;br&gt;
One more problem that arises from injecting these global variables is that whoever is reading the function doesn't know that these variables exist in the first place. It is not obvious as they are not stated as parameters. This degrades the readabillity of the code.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is an &lt;strong&gt;error-prone&lt;/strong&gt; approach. If your project does not have test suites you will have to debug this slowly and a lot of mistakes will eventually land on production.&lt;/p&gt;
&lt;h3&gt;
  
  
  Uncontrolled change of global state
&lt;/h3&gt;

&lt;p&gt;Here we are changing the hasSentEmail value of cart to 1 to inform the application that we have already sent an email to this cart and to not do it again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where else does this value change? We have absolutely no clue&lt;/strong&gt; The hasSentEmail value from $_SESSION variable could change at any point in our application from any function if we do not have any controlled way of using this session. If we are doing a session_start() and opening the session gate in every file there could be a session mutation in any file. &lt;strong&gt;This creates unpredictabillity and destabilizes our program&lt;/strong&gt;. &lt;/p&gt;



&lt;h2&gt;
  
  
  Solutions! 🤔
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Limit the globallity of the $_SESSION
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;sendNotificationEmailBasedOnCartLength&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nv"&gt;$cartSize&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nv"&gt;$hasEmailBeenSentForCart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&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="nv"&gt;$cartSize&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;$hasEmailBeenSentForCart&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;sendSomeEmail&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;First you would need to decouple the function and the session. Pass any information you need about the session inside the parameters of the function. This limits the global variable to a local variable.&lt;/p&gt;
&lt;h3&gt;
  
  
  Better control of $_SESSION by limiting it's usage
&lt;/h3&gt;

&lt;p&gt;Second, you should not access the $_SESSION['cart'] variable directly in any file. Choose a file and create a class that is responsible for creating the session, retrieving it and changing it. By having a single class that is responsible for these actions you can be assured that the global variable will not have an unexpected state somewhere down the road.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nb"&gt;session_start&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Cart&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="nv"&gt;$products&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__constructor&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="o"&gt;!&lt;/span&gt;&lt;span class="nv"&gt;$_SESSION&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'cart'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nv"&gt;$_SESSION&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'cart'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'products'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[],&lt;/span&gt; &lt;span class="s2"&gt;"emailIsSent"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&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="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;initializeCart&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$_SESSION&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'cart'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'products'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[],&lt;/span&gt; &lt;span class="s2"&gt;"emailIsSent"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;addProduct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Product&lt;/span&gt; &lt;span class="nv"&gt;$product&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$_SESSION&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'cart'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'products'&lt;/span&gt;&lt;span class="p"&gt;][]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$product&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;setEmailIsSent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$_SESSION&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'cart'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'emailIsSent'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;getCart&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="nv"&gt;$_SESSION&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'cart'&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 can see a simple example of creating a class that is in &lt;strong&gt;the only mutator and retriever $_SESSION['cart']&lt;/strong&gt;. If you decide in the future to retrieve information for the cart or creating a new cart you are &lt;strong&gt;not dependable on the $_SESSION['cart']&lt;/strong&gt; variable as you can swap the functionallity of these functions anyhow you like and the your app would work the same. &lt;/p&gt;

&lt;p&gt;Additionally we can decide that only &lt;em&gt;these&lt;/em&gt; classes will have the abillity to interact with sessions and remove all session_start() instances from anywhere else making sure that this &lt;strong&gt;global variable will only change its state in this controlled enviroment&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The session['cart'] variable can only hold the values specified by this class. &lt;/p&gt;



&lt;h2&gt;
  
  
  In conclusion
&lt;/h2&gt;

&lt;p&gt;We did show why having a global variable mutate uncontrollably in our application is bad as it creates:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Unpredictabillity&lt;/li&gt;
&lt;li&gt;Maintainabillity issues&lt;/li&gt;
&lt;li&gt;Unredabillity&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;and we demonstrated with the use of classes that control the mutations and retrieval of these variables how we can make our application cleaner and easier to adapt to change&lt;/p&gt;

&lt;p&gt;Sources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://ericnormand.me/article/global-mutable-state" rel="noopener noreferrer"&gt;Global mutatable states&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>gratitude</category>
    </item>
    <item>
      <title>PHP 8.1 On New Heights With Amazing New Additions 🎉</title>
      <dc:creator>Sakis bal</dc:creator>
      <pubDate>Thu, 29 Apr 2021 17:04:37 +0000</pubDate>
      <link>https://dev.to/thanasismpalatsoukas/php-8-1-on-new-heights-with-amazing-new-additions-1gcg</link>
      <guid>https://dev.to/thanasismpalatsoukas/php-8-1-on-new-heights-with-amazing-new-additions-1gcg</guid>
      <description>&lt;h2&gt;
  
  
  PHP Improvements
&lt;/h2&gt;

&lt;p&gt;PHP is on a roll lately and spoiling us with some amazing additions. On PHP 8.0 there were additions like Union Types which helped us set more complex static types, JIT with big performance improvements, named arguments and these are just a few.&lt;/p&gt;

&lt;p&gt;Now PHP is adding Enums, Array unpacking with string keys, and Fibers driving the language to new heights.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are those enums and why should i care?
&lt;/h2&gt;

&lt;p&gt;To those who aren't aware enums (enumerations) are used when a variable is supposed to take a specific range of values. Until now if you wanted to create an enum-like type in PHP you would have to directly use static variables or associative arrays like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Car&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="nv"&gt;$carState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"RUNNING"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"RUNNING"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"STOPPED"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"STOPPED"&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;

    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="nv"&gt;$_speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$_state&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__construct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="nv"&gt;$speed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$carState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;_speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$speed&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;_state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$carState&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 we could use the state to determine which types of cars states we have. Most code editors would type-hint the types when we pressed Car::$carState. &lt;/p&gt;

&lt;p&gt;Do you see the issue with that? The class has no idea if you actually used the types that we have selected! A solution to this would be to simply manually check in the constructors or in setters if the variable that is passed has the appropriate values. But you probably agree that this sucks, and can lead to more bugs than we should have to handle.&lt;/p&gt;

&lt;p&gt;Enums are here to solve this issue.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class="n"&gt;enum&lt;/span&gt; &lt;span class="nc"&gt;CarTypes&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;running&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;stopped&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Car&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="nv"&gt;$carState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"RUNNING"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"RUNNING"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"STOPPED"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"STOPPED"&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;

    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="nv"&gt;$_speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;CarTypes&lt;/span&gt; &lt;span class="nv"&gt;$_state&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__construct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="nv"&gt;$speed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;CarTypes&lt;/span&gt; &lt;span class="nv"&gt;$carState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;_speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$speed&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;_state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$carState&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;by using this new built-in data type we can automatically skip all the checks and let enum do it for us. Neat!&lt;/p&gt;

&lt;h2&gt;
  
  
  What about fibers?
&lt;/h2&gt;

&lt;p&gt;Fibers are utilizing 'green threads' to create virtual parallelism. While the computer is busy doing work in controllers or fetching data from database fibers helps regulate the traffic between those actions. &lt;/p&gt;

&lt;p&gt;According to the RFC:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The Fiber API is not expected to be used directly in &amp;gt;application-level code. Fibers provide a basic, low-level &amp;gt;flow-control API to create higher-level abstractions that &amp;gt;are then used in application code"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This means that you will probably not use Fibers in your production code but will rather use them with the help of frameworks that utilize them like ReactPHP. &lt;/p&gt;

&lt;p&gt;to see all changes of PHP 8.1 visit the following website&lt;br&gt;
&lt;a href="//stitcher.io"&gt;https://stitcher.io/blog/new-in-php-81&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>news</category>
    </item>
    <item>
      <title>The Encapsulation Principle Explained</title>
      <dc:creator>Sakis bal</dc:creator>
      <pubDate>Mon, 15 Mar 2021 21:44:26 +0000</pubDate>
      <link>https://dev.to/thanasismpalatsoukas/clean-coding-the-encapsulation-principle-13n</link>
      <guid>https://dev.to/thanasismpalatsoukas/clean-coding-the-encapsulation-principle-13n</guid>
      <description>&lt;p&gt;&lt;a href="https://www.pexels.com/photo/black-and-white-round-car-air-filter-159293/"&gt;Image by pexels&lt;/a&gt; &lt;em&gt;(Just drive it!)&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Instructions Unclear
&lt;/h2&gt;

&lt;p&gt;It’s Christmas, &lt;strong&gt;I got myself a new GPU&lt;/strong&gt; as a gift and &lt;strong&gt;instructions as to how to add them&lt;/strong&gt; to my computer.  Not much time passed until I realized that the instructions book I got were not as clear as I hoped it would be. &lt;/p&gt;

&lt;h3&gt;
  
  
  Instruction book: &lt;strong&gt;Pages 410&lt;/strong&gt; 😳
&lt;/h3&gt;

&lt;p&gt;Contents:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is a GPU&lt;/li&gt;
&lt;li&gt;How does a GPU work&lt;/li&gt;
&lt;li&gt;Advanced Image Processing Algorithms&lt;/li&gt;
&lt;li&gt;…&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There’s not much to say. &lt;strong&gt;The book was bad&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Hell, it would be easier to just attend a whole semester of hardware classes instead of reading any more of this. It went on and on about things I never really wanted to know! &lt;strong&gt;All I wanted to know is how to put the GPU inside the computer&lt;/strong&gt; and just play and chill a bit.&lt;/p&gt;

&lt;p&gt;Now if that instruction book was a &lt;strong&gt;class inside a program it would have violated one of the most basic programming rules: Encapsulation&lt;/strong&gt;, or else the art of exposing to the client only the important parts of your code, or the parts the client needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why Encapsulation?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We have already explained what encapsulation is but to understand it better we need to see the alternatives of NOT encapsulated our class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;speed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;speed&lt;/span&gt;
    &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;

&lt;span class="n"&gt;toyota&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'Toyota'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;myCrazyWeirdCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'Lamborghini'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;myCrazyWeirdCar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;41000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look, I would never call myself a &lt;em&gt;mechanical engineer&lt;/em&gt; but even I understand there is something fishy going on here with this car. &lt;em&gt;myCrazyWeirdCar&lt;/em&gt; is about to go outside the earth’s orbit and conquer mars if it continues with this speed, and that probably isn’t what the author of this code above wanted to happen.&lt;/p&gt;

&lt;h3&gt;
  
  
  Let’s fix this:
&lt;/h3&gt;

&lt;p&gt;First I am assuming the car owner wanted to just get the car’s speed higher.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;speed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;maxSpeed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;speed&lt;/span&gt;
    &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;maxSpeed&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__maxSpeed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;400&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__maxSpeed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;maxSpeed&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;speedUp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;speed&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;If&lt;/span&gt; &lt;span class="n"&gt;speed&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 
        &lt;span class="k"&gt;return&lt;/span&gt;

    &lt;span class="n"&gt;totalSpeed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__speed&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;speed&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;totalSpeed&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__maxSpeed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__maxSpeed&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;totalSpeed&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__model&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" is going at "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__speed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" km/h !"&lt;/span&gt;


&lt;span class="n"&gt;toyota&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'Toyota'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;220&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;myCrazyWeirdCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'Lamborghini'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;toyota&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;speedUp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;toyota&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now what we changed is that we gave our class attributes a little more privacy. &lt;em&gt;(that is what the __ is before the attribute names)&lt;/em&gt;. &lt;strong&gt;This means that these attributes are not accessible anymore directly!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No more Mr. 4000 car speed allowed. Or any sort of&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;myCrazyWeirdCar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;40000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, why is that a good thing?&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem With Not Encapsulating
&lt;/h2&gt;

&lt;p&gt;To operate the car the client does not need to directly change the speed of the car. &lt;strong&gt;By giving the client the ability to change it we get three problems&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The client knows too much about our class
&lt;/h3&gt;

&lt;p&gt;He doesn’t know anymore what the class is supposed to do or what he is supposed to change. Do we use the class to have a data type that has a speed attribute that we can use? Do we use it to the model of the class and retrieve the model info? &lt;strong&gt;What is the class’s reason to exist?&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;The state of the Car class becomes unpredictable&lt;/strong&gt;.
&lt;/h3&gt;

&lt;p&gt;If the user is allowed to take any attribute anytime and change it directly to whatever he wants the &lt;strong&gt;Car Class becomes unpredictable and thus needs more and more checking in every method that we use&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;For example, if the user could directly manipulate the speed to be a negative number then the car would be able to run at a negative speed. This would then need to be checked on every single method we are using.&lt;/p&gt;

&lt;h3&gt;
  
  
  Unable to change attribute names
&lt;/h3&gt;

&lt;p&gt;Using the attributes directly leads to a problem &lt;strong&gt;where you can’t change the attribute names anymore because they are used in random places on your code&lt;/strong&gt;. Changing one attribute name now requires you to check every file for its usage and change its name. This is most definitely not SOLID.&lt;/p&gt;

&lt;h3&gt;
  
  
  You against yourself
&lt;/h3&gt;

&lt;p&gt;Now you are probably wondering: &lt;em&gt;OK, but I AM the developer and I control these values so I can just like not change them to some unpredictable value?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Well, that is what many people including myself think. But then &lt;strong&gt;I get lazy at some point and just want the car value to change to some unpredictable value just for this one case&lt;/strong&gt;, and then you end up making exceptions to support this one case and then your car isn’t a car anymore, and the story goes on.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You are primarily protecting you from yourself&lt;/strong&gt; when creating a class. Remember that. So it’s better to isolate the attributes from a class and let them be private and just expose the functionality you need.&lt;/p&gt;

&lt;p&gt;Take for example the class method from above:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;speedUp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;speed&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;If&lt;/span&gt; &lt;span class="n"&gt;speed&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 
        &lt;span class="k"&gt;return&lt;/span&gt;

    &lt;span class="n"&gt;totalSpeed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__speed&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;speed&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;totalSpeed&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__maxSpeed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__maxSpeed&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;totalSpeed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our car &lt;strong&gt;can accelerate to any speed we want without ever going more than the intended max speed&lt;/strong&gt;. The user already inputs a max speed when creating the object so he expects the class to stop at max speed. He doesn’t need to know how it is done, he just inserts a speed and the method is encapsulating the logic behind it. Neat right?&lt;/p&gt;

&lt;h2&gt;
  
  
  In conclusion
&lt;/h2&gt;

&lt;p&gt;If you want to help your future self-use encapsulation because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It helps you write cleaner software and design your classes to exist without having them questioning their reason for existence.&lt;/li&gt;
&lt;li&gt;Make classes reusable by hiding their complexity&lt;/li&gt;
&lt;li&gt;Fewer checks per class method because of the unpredictability of attributes.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>python</category>
      <category>codequality</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Repository Pattern With Javascript</title>
      <dc:creator>Sakis bal</dc:creator>
      <pubDate>Thu, 11 Mar 2021 22:06:26 +0000</pubDate>
      <link>https://dev.to/thanasismpalatsoukas/repository-pattern-with-javascript-4nl</link>
      <guid>https://dev.to/thanasismpalatsoukas/repository-pattern-with-javascript-4nl</guid>
      <description>&lt;p&gt;&lt;em&gt;&lt;a href="https://www.pexels.com/photo/photo-of-warehouse-3821385/"&gt;Photo by Cleyder Duque from Pexels&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Explain it simply&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The repository, in simple words, is a pattern used to keep a &lt;strong&gt;loose connection between the client and the server data storing procedures hiding all complex implementation.&lt;/strong&gt; This means that the client will not have to be concerned as to how to access the database, add or remove items from a collection of items, pointers, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why Would I Want To Use It&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let’s make a scenario where you just call API endpoints from your client and use it in a certain way. In a real-world scenario, you would probably call the same endpoint on different points in your files depending on where you need to use the data. For example:&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;const&lt;/span&gt; &lt;span class="nx"&gt;todoItemsElContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;todo-items&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://example.com/todoItems.json&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="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&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;todoItemDiv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;div&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
               &lt;span class="nx"&gt;todoItemDiv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;innerText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;p&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
               &lt;span class="nx"&gt;innerText&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DESCR&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; duration: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;todoItemDiv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

           &lt;span class="nx"&gt;todoItemDiv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;appendChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;innerText&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
           &lt;span class="nx"&gt;todoItemsElContainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;appendChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;todoItemDiv&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
       &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;addTodoItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;duration&lt;/span&gt;&lt;span class="p"&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;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;DESCR&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;DURATION&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;duration&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;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&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;Content-Type&lt;/span&gt;&lt;span class="dl"&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;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&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="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&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;h2&gt;
  
  
  &lt;strong&gt;Issues with the above approach&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There are several issues with the above code example. For one in the first fetch call we are &lt;strong&gt;mixing the presentation with fetching of the data. This makes the fetch non-reusable.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Furthermore, &lt;strong&gt;what happens now if we want to change a certain attribute of the requested object now?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Let’s suppose the API changes and we need to change an attribute name from todoList.DESCR to todoList.DESCRIPTION. &lt;strong&gt;We will have to go to every single instance and change that attribute to the new attribute name.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is quite unproductive and might lead to accumulating mistakes and errors over time. (There is a chance we forget some instance unchanged and find that out later, which would be very frustrating).&lt;/p&gt;

&lt;p&gt;Another possible scenario is that there will be some business logic involved in the procedure. By scattering around functions that are related to that object you are creating more violations to SOLID. But enough talking about the problem. What is the solution?&lt;/p&gt;

&lt;h2&gt;
  
  
  Repository Pattern to the Rescue
&lt;/h2&gt;

&lt;p&gt;With the repository pattern, you manage to map attributes that come directly from the database to the repository model which gives us flexibility. If the attributes of the item change we can easily change them at the ONE spot where they are used: The Repository. No need to go to every file the object is retrieved, respecting the SOLID principle.&lt;/p&gt;

&lt;p&gt;The power of abstraction and inheritance gives us the power to create a default use for simple API object management to minimize the boilerplate. Then with inheritance, the concrete implementations can overwrite the default behavior.&lt;/p&gt;

&lt;p&gt;Additionally, business logic is encapsulated in functions inside the Repository. If the implementation ever changes you have it all in one place to change it however you like.&lt;/p&gt;

&lt;p&gt;Below is an example of the TodoItemRepository.&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;class&lt;/span&gt; &lt;span class="nx"&gt;TodoItem&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="cm"&gt;/**
   * Naming attributes the same as in the database
   * helps when adding the items back to the database.
   */&lt;/span&gt;
  &lt;span class="kd"&gt;constructor&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;description&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;duration&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;DESCR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;description&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;DURATION&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;duration&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;ID&lt;/span&gt; &lt;span class="o"&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="nx"&gt;getDescription&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;DESCR&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;getDuration&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;DURATION&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;getId&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;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="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;TodoItemRepository&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="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;todoItems&lt;/span&gt; &lt;span class="o"&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;todoItemDataContext&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;TodoItemDataContext&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nx"&gt;getAll&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;todoItemDataContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getAll&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;todoItem&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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;todoItems&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;TodoItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;todoItem&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;todoItem&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DESCRIPTION&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;todoItem&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DURATION&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="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;todoItems&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="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;todoItem&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;todoItemDataContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;todoItem&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;newTodoItem&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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;todoItems&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;todoItem&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;error&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&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;First of all above, we decoupled the fetching of the data with the presentation of it. Now we can reuse it.&lt;/p&gt;

&lt;p&gt;If now the database changes the DESCR attribute to DESCRIPTION all we need to do is change our Repository class to accept this change. In short, the design became more SOLID. &lt;strong&gt;Note here that you need to use getters, or setters &lt;em&gt;(make the attributes private)&lt;/em&gt; within your application so you are not dealing directly with the attribute names.&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;The repository pattern:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Helps us keep the code SOLID&lt;/li&gt;
&lt;li&gt;Is an abstraction that hides the complexity of communicating with the data persistence layer&lt;/li&gt;
&lt;li&gt;Makes our code more robust&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Learn More About The Repository Pattern
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/infrastructure-persistence-layer-design"&gt;Design the infrastructure persistence layer, by Microsoft&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://martinfowler.com/eaaCatalog/repository.html"&gt;Repository by Edward Hieatt and Rob Mee&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>codequality</category>
      <category>productivity</category>
    </item>
    <item>
      <title>The {Zero, One, Two, Many} Tip For Better UX</title>
      <dc:creator>Sakis bal</dc:creator>
      <pubDate>Tue, 09 Mar 2021 14:18:20 +0000</pubDate>
      <link>https://dev.to/thanasismpalatsoukas/the-zero-one-two-many-for-better-ux-1g95</link>
      <guid>https://dev.to/thanasismpalatsoukas/the-zero-one-two-many-for-better-ux-1g95</guid>
      <description>&lt;p&gt;*(image from &lt;a href="https://www.pexels.com"&gt;pexels&lt;/a&gt;) &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Being consistent with your code designs is hard&lt;/strong&gt;, you need to be careful to watch out for all possible states that your code might fall into and take care of those, but where do we start?&lt;/p&gt;

&lt;p&gt;When creating a new component I usually find myself having already created the data necessary to populate the component. This means I am usually starting my design with one to two copies of the specific component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;todoItems&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;todoItem&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;TodoItem&lt;/span&gt; &lt;span class="nx"&gt;todoItem&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;todoItem&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sometimes the lazy part of ourselves takes control and just lets this component like this and moves on to the next subject. But there is a problem with this approach.&lt;/p&gt;

&lt;h3&gt;
  
  
  Zero Items case
&lt;/h3&gt;

&lt;p&gt;In case there are 0 todo items the page will look ugly and empty. What should there be instead?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Help the user navigate and add a new to-do item.&lt;/li&gt;
&lt;li&gt;Inform him that there should be something there instead of nothing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The other case that we should take care of is the MANY items case. What happens if we got 1000 items? &lt;/p&gt;

&lt;h3&gt;
  
  
  Many items case
&lt;/h3&gt;

&lt;p&gt;In that case, we need to have considered how these elements will look like.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add a "see more" button.&lt;/li&gt;
&lt;li&gt;Load data asynchronously if possible for best UX.&lt;/li&gt;
&lt;li&gt;Let the user minimize it after opening it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Following this {zero, one, two, many} tecnique you will never have to encounter these nasty empty designs again!&lt;/p&gt;

</description>
      <category>design</category>
      <category>productivity</category>
      <category>codequality</category>
      <category>react</category>
    </item>
    <item>
      <title>Flex Your Design Skills With Flexbox 💪</title>
      <dc:creator>Sakis bal</dc:creator>
      <pubDate>Thu, 09 Apr 2020 15:21:37 +0000</pubDate>
      <link>https://dev.to/thanasismpalatsoukas/flex-your-design-skills-with-flexbox-12d3</link>
      <guid>https://dev.to/thanasismpalatsoukas/flex-your-design-skills-with-flexbox-12d3</guid>
      <description>&lt;h1&gt;
  
  
  Flexbox
&lt;/h1&gt;

&lt;p&gt;Flexbox &lt;em&gt;(Flexible Box Layout Module)&lt;/em&gt;  is a a trendy way to make your design flexible without the need of using tricky positioning tricks or float.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Flexbox
&lt;/h2&gt;

&lt;p&gt;Flexbox is ideal for times where you need to &lt;strong&gt;re-order elements on certain circumstances, or if you want to scale your elements vertically, horizontically or if you want to align your elements&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Terminology
&lt;/h2&gt;

&lt;p&gt;To use the flexbox you will first need to know about 2 core elements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;flex container&lt;/strong&gt; which is the outter element embracing all other elements.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;flex item&lt;/strong&gt; which are the elements inside of the flex-container&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Flexbox rules
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Order
&lt;/h3&gt;

&lt;p&gt;To change the order of the elements that you got inside the flex container you will need to use &lt;strong&gt;order: &lt;/strong&gt;. Elements with the same number will be positioned as they would have been positioned by default. Lower numbers than other numbers are positioned to the left if we have a row orientation and to the top if we got a column orientation. We will analyze these further down below.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/thanasismpalatsoukas/embed/jObOBEP?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Flex-grow
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Flex-grow&lt;/strong&gt; is used to specify which elements will take up more space&lt;br&gt;
inside the container than other elements. &lt;strong&gt;By default the flex-grow value is 0&lt;/strong&gt; which means that the elements will not take up the remaining space of the flex container. &lt;em&gt;Let's take an example where we got 3 elements and all got flex-grow: 1&lt;/em&gt;. All elements will take up the same remaining space of the flex-container, but if one element has flex-grow: 2 it will take twice as much remaining space as its other siblings.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/thanasismpalatsoukas/embed/OJyJpMY?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Flex-direction
&lt;/h3&gt;

&lt;p&gt;Flex direction comes in handy when you want to &lt;strong&gt;reverse the order of your flex items&lt;/strong&gt; or if you want to &lt;strong&gt;totally change their orienation from a row to a column&lt;/strong&gt;. To do that you can select one of the following option:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flex-direction: row;
flex-direction: row-reverse;
flex-direction: column;
flex-direction: column-reverse;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/thanasismpalatsoukas/embed/BaoaWKX?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Flex wrap
&lt;/h3&gt;

&lt;p&gt;You may be wondering at that point &lt;em&gt;"What if i got items inside a flex-container and i want to have more than one row for my items?"&lt;/em&gt;. Well flex-wrap got us covered as you can do exactly that by using:&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;flex-wrap: wrap&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 or&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;flex-wrap: wrap-reverse&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
This will make elements that need some space to go to a new row so that they aren't squished together.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/thanasismpalatsoukas/embed/LYpYWWr?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Flex shrink
&lt;/h3&gt;

&lt;p&gt;Although flex-shrink looks a lot like flex-grow &lt;em&gt;(They are very close cousins)&lt;/em&gt;, they do sligtly differeny things. While flex-grow let's elements take up the remaining space of the flex container flex-shrink &lt;strong&gt;let's items with higher flex-shrink numbers sacrifise more of their own personal space to give it to other siblings around&lt;/strong&gt;. Flex shrink truly is the &lt;em&gt;good guy&lt;/em&gt; here.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/thanasismpalatsoukas/embed/oNjNWVx?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

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

&lt;p&gt;Flexbox is a great tool for making a robust layout. It can be best used with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scalling horizontically.&lt;/li&gt;
&lt;li&gt;Scalling vertically.&lt;/li&gt;
&lt;li&gt;Re ordering elements.&lt;/li&gt;
&lt;li&gt;Flexible designs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hope to see you here on part 2 😃&lt;/p&gt;

</description>
      <category>css</category>
      <category>design</category>
    </item>
    <item>
      <title>The box model explained</title>
      <dc:creator>Sakis bal</dc:creator>
      <pubDate>Tue, 07 Apr 2020 18:59:43 +0000</pubDate>
      <link>https://dev.to/thanasismpalatsoukas/the-box-model-explained-1jn5</link>
      <guid>https://dev.to/thanasismpalatsoukas/the-box-model-explained-1jn5</guid>
      <description>&lt;h2&gt;
  
  
  Generally
&lt;/h2&gt;

&lt;p&gt;Positioning and spacing is one of the core reasons of css existence. Slick designs simply need a little whitespace around them so that every element can shine with its own glamour.&lt;/p&gt;

&lt;p&gt;One of the concepts that i didn't really get in the beggining of web development was the difference of padding and margin. In my eyes these two were doing identical things as i wasn't using them for any cutting-edge design. &lt;/p&gt;

&lt;p&gt;Therefore i decided to run back on the basics and talk about some good old margin and padding.&lt;/p&gt;

&lt;h1&gt;
  
  
  Box model
&lt;/h1&gt;

&lt;p&gt;Before beggining we need to clear up what the box model is. To better understand how margin and padding&lt;br&gt;
actually differ from each other we need to first see how they are different in the box model&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZG1lPb9p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/viq14gE.jpg%3F1" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZG1lPb9p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/viq14gE.jpg%3F1" alt="Alt text of image" width="400" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see above, every element has the content area where all the content we can see resides. For example on a p tag that would be the text within.&lt;/p&gt;

&lt;p&gt;Then we have the padding which extends the inner elements width and height and pushes outwards the border and margin of the element. After that the border is outside of the padding giving us the option to create a square outside the padding area.&lt;/p&gt;

&lt;p&gt;Last but not least the margin is outside&lt;br&gt;
of our element giving us the option to move the element around &lt;em&gt;( Note here that the margin still affects the height and&lt;br&gt;
width of our element. You still need to count it in when you want the absolute height and width of an element)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Css by default assigns the height and width of an element to the content area. So to actually get the real width&lt;br&gt;
and height of an element you need to calculate the following:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;actual height and width of an element: height + padding + border + margin&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tip: By opening the developers console (right-click inspect element) you will see the box model on the right.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This should give us an easier time understanding what a margin and padding property is.&lt;/p&gt;
&lt;h2&gt;
  
  
  Margin
&lt;/h2&gt;

&lt;p&gt;Now we are ready to talk about the margin property&lt;/p&gt;

&lt;p&gt;As our respected friend w3schools states:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The CSS margin properties are used to create space around elements, outside of any defined borders.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's begin by seeing the properties:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;margin-left&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;x&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;margin-right&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;x&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;margin-top&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;x&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;margin-bottom&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;x&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;margin&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;x&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="nt"&gt;y&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="nt"&gt;z&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="nt"&gt;w&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;where x,y,z,w can have the values of px|rem|%|vw|vh.&lt;/p&gt;

&lt;p&gt;margin is shorthand for all the 4 of the above margin properties. It goes clockwise starting from the top element if you add all 4 of the values. If you just add x,y the the margin of x will be applied on top and bottom of the element and the margin of y will be applied to the left and right of the element. If only x is applied the the margin will be applied to all 4 sides&lt;/p&gt;

&lt;h3&gt;
  
  
  Examples
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;margin:20px&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rRrfDiaq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/TIAd6L5.jpg%3F1" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rRrfDiaq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/TIAd6L5.jpg%3F1" alt="Alt text of image" width="500" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;margin:10px 20px&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5iWl3I5U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/vEqAAwu.jpg%3F1" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5iWl3I5U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/vEqAAwu.jpg%3F1" alt="Alt text of image" width="500" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;margin:10px 20px 30px 40px&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SL8jvNt_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/fAok9w8.jpg%3F1" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SL8jvNt_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/fAok9w8.jpg%3F1" alt="Alt text of image" width="500" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Margin is perfect for "pushing" your element away from other elements. For example when you got a p element that you need to move a bit away from other p elements, just a bit whitespace to make our paragraph visually pleasing.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;tip: You can use margin: 0 auto to horizontically center an element's content. Be aware that the element needs to have a width specified for this to work.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Padding
&lt;/h2&gt;

&lt;p&gt;Now it's time for the padding. &lt;/p&gt;

&lt;p&gt;Padding properties are almost identical to margin properties in a lot of ways which is logical considering the similarities these 2 share.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;padding-left&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;x&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;padding-right&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;x&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;padding-top&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;x&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;padding-bottom&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;x&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;padding&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;x&lt;/span&gt; &lt;span class="nt"&gt;y&lt;/span&gt; &lt;span class="nt"&gt;z&lt;/span&gt; &lt;span class="nt"&gt;w&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where x,y,z,w can have the values of px|rem|%|vw|vh.&lt;/p&gt;

&lt;p&gt;Same as above padding is a shorthand for all the other properties. Padding is ideal for cases where you want to extend the border&lt;br&gt;
away from the element or if i want to give space between the background color of an element and the content inside.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bYC5qK7q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/xseMFPo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bYC5qK7q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/xseMFPo.jpg" alt="Alt text of image" width="800" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope this guide was helpful! Have a nice day and remember to stay inside 🦄&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>css</category>
      <category>html</category>
      <category>design</category>
    </item>
    <item>
      <title>Useful resources i use on day to day basis.</title>
      <dc:creator>Sakis bal</dc:creator>
      <pubDate>Fri, 03 Jan 2020 19:00:27 +0000</pubDate>
      <link>https://dev.to/thanasismpalatsoukas/useful-resources-i-use-on-day-to-day-basis-4clh</link>
      <guid>https://dev.to/thanasismpalatsoukas/useful-resources-i-use-on-day-to-day-basis-4clh</guid>
      <description>&lt;p&gt;When i work on a project i use several different resources that come in handy everyday. I picked them up from several other people who mentioned them on their resources list and just kept using the best ones. While surfing facebook i got in contact with some people who asked about some help on their design. I then proposed to them to use one of these resources that i will list here and they were totally blown away. Until now i had no idea that there were still people who had no idea that these extremely useful resources existed. That is why i decided to make a post of it. Here is the list:&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Ui Gradients&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Whenever i am looking for a beatiful gradient to overlay on an image or to put as a background Ui gradients is a no-brainer and my usual first place to go.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1Oeu4cBX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://uigradients.com/static/images/uigradients.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1Oeu4cBX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://uigradients.com/static/images/uigradients.jpg" alt="Alt text of image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uigradients.com/"&gt;Go to ui gradients&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Flaticon&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Small beatiful icons like facebook, and instagram can be found here. Why bother doing the tedious work of making an icon when you can have them easily free on flaticon? Just don't forget to reference the creator of the icon on your own website. This way both you and the creator wins!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f_yYG6ZZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://media.flaticon.com/share/flaticon-generic.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f_yYG6ZZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://media.flaticon.com/share/flaticon-generic.jpg" alt="Alt text of image" width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.flaticon.com/"&gt;Go to ui flaticon&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Dribbble&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Dribble is a place where designers upload their creations and get feedback on them. It is also a place for developers and other designers to get inspiration from to create their own masterpieces!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aJaGni-7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.dribbble.com/uploads/1615/original/f3731f44e5b7085e8dfd5272f7b4f0a8.png%3F1565983272" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aJaGni-7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.dribbble.com/uploads/1615/original/f3731f44e5b7085e8dfd5272f7b4f0a8.png%3F1565983272" alt="Alt text of image" width="800" height="603"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dribbble.com/"&gt;Go to dribbble&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Pexels&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Pexels is the go to website if you need HD images to put either as a placeholders on your new websites or as real photos as pexels has a free to use policy for their images. It has thousands of beatiful images and i use them on most of my projects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xpvNGtt4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.pexels.com/assets/pexels-stock-photos-6c3d5eb0cbed47e1bdf44ff85ebd9cd4669f50b895b3c6e76a23a4fd43852099.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xpvNGtt4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.pexels.com/assets/pexels-stock-photos-6c3d5eb0cbed47e1bdf44ff85ebd9cd4669f50b895b3c6e76a23a4fd43852099.jpg" alt="Alt text of image" width="800" height="548"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.pexels.com/"&gt;Go to pexels&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Google fonts&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Thousands of beatiful open source fonts are found here and can be used for free ! Google fonts is fast and reliable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LckXzLE2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.gstatic.com/images/icons/material/apps/fonts/1x/opengraph_color_1200dp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LckXzLE2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.gstatic.com/images/icons/material/apps/fonts/1x/opengraph_color_1200dp.png" alt="Alt text of image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://fonts.google.com/"&gt;Go to pexels&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  More resources?
&lt;/h1&gt;

&lt;p&gt;If you made it down here, thank you for reading through my resource list, i hope you create something amazing with these resources. If you have any other resource that you want to share with me or others please comment it down below!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>design</category>
    </item>
    <item>
      <title>How i plan to elevate my designing skills on 2020 🎉</title>
      <dc:creator>Sakis bal</dc:creator>
      <pubDate>Wed, 01 Jan 2020 10:59:58 +0000</pubDate>
      <link>https://dev.to/thanasismpalatsoukas/how-i-plan-to-elevate-my-designing-skills-on-2020-23ld</link>
      <guid>https://dev.to/thanasismpalatsoukas/how-i-plan-to-elevate-my-designing-skills-on-2020-23ld</guid>
      <description>&lt;p&gt;Designing is a big part of the web development proccess and it is the best way to attract new users to your platform. I always lacked the ability to make unique beatiful designs. You know this feeling after successfully finishing a website and getting the feel that &lt;em&gt;this looks professional&lt;/em&gt;? . That is what i plan on achieving to feel after making most of my new websites on 2020 🎉. But how do i plan to achieve this?&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Copying 50 different beatiful designs&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This way i will be able to start having a feel about what is and what isn't beatiful in general. It will give me a good sense about which fonts go well together and which colors match good. While 50 is definitely an excessive number i do believe strongly in the repetition makes the master mentallity&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Reading more and more about graphic design&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;While doing a copy of a website might be useful to get a feel about your design quality it doesn't state exactly why you get the feeling of quality on your design. A good designing book will hopefully give me an idea of what exactly quality means on designing standards and help me create my own stunning designs.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Are &lt;em&gt;You&lt;/em&gt; aware of any better ways to help me get better on designing?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you have any resources, or any other ways that i could follow to become a better designer i would deeply appreciate it! Just comment down below.&lt;/p&gt;

&lt;p&gt;Oh and while we are at it, this is my first official post on dev 🎉! &lt;strong&gt;Thanks to dev for giving us free entertainment&lt;/strong&gt; and i hope i will be able to entertain or help people with my posts as i continue writing!&lt;/p&gt;

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