<?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: fadyehabamer</title>
    <description>The latest articles on DEV Community by fadyehabamer (@fadyehabamer).</description>
    <link>https://dev.to/fadyehabamer</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%2F464446%2F0f829af7-35ba-40d3-8963-2ba5d9660e17.png</url>
      <title>DEV Community: fadyehabamer</title>
      <link>https://dev.to/fadyehabamer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fadyehabamer"/>
    <language>en</language>
    <item>
      <title>Generics In Csharp</title>
      <dc:creator>fadyehabamer</dc:creator>
      <pubDate>Fri, 19 Apr 2024 21:15:30 +0000</pubDate>
      <link>https://dev.to/fadyehabamer/generics-in-c-3ple</link>
      <guid>https://dev.to/fadyehabamer/generics-in-c-3ple</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj1macgbuuvy80oovk3rq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj1macgbuuvy80oovk3rq.png" alt="blog image" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;C#&lt;/strong&gt;, you can write code that works with a variety of data types by using generics.&lt;br&gt;
&lt;em&gt;As a result&lt;/em&gt;, the code is more flexible and reusable. Generic declarations are made with the &lt;strong&gt;&amp;lt;&amp;gt;&lt;/strong&gt; sign. &lt;br&gt;
For instance, the code that follows defines the generic method &lt;strong&gt;Print&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="n"&gt;Print&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="k"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;value&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;&lt;strong&gt;Any&lt;/strong&gt; data can be printed using this technique. The code that outputs a &lt;strong&gt;string **and an **integer&lt;/strong&gt;, for instance, is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="nf"&gt;Print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 10&lt;/span&gt;
&lt;span class="nf"&gt;Print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello, world!"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Hello, world!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Generics&lt;/strong&gt; can also be used to create generic classes. &lt;br&gt;
For example, the following code declares a generic class called &lt;strong&gt;List&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;List&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;items&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&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;void&lt;/span&gt; &lt;span class="nf"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;items&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Resize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Length&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Length&lt;/span&gt; &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;item&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="n"&gt;T&lt;/span&gt; &lt;span class="nf"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;index&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="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;index&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;Any kind of data can be stored in this class. For instance, the code that follows builds an integer list and appends some numbers to it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;
&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;20&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;30&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Generics are an effective technique for increasing the versatility and reusability of code. They are an essential component of the C# language and come in a variety of uses.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The following are some advantages of utilizing generics in C#:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;They increase the versatility of coding. Because generic code works with a variety of data types, it is more reusable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They improve the conciseness of the code. Compared to non-generic code, generic code can frequently be expressed more succinctly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They could enhance output. There are situations when generic code can increase performance by removing the requirement for type casts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They could aid in error prevention. Because generic code makes sure the right data types are utilized, it can help prevent problems.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Generic Classes
&lt;/h3&gt;

&lt;p&gt;The  symbol should be used after the class name to declare the Generic class. It is not required to include the word "T" in the Generic type definition. Any word in the TestClass&amp;lt;&amp;gt; class declaration is acceptable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TestClass&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;&amp;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;The System.Collection.Generic namespace also defines a number of classes that implement many of these key interfaces. &lt;br&gt;
The following table describes the core class types of this namespace.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Generic class&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Collection&lt;/td&gt;
&lt;td&gt;The basis for a generic collection Comparer compares two generic objects for equality&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dictionary&lt;/td&gt;
&lt;td&gt;A generic collection of name/value pairs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;List&lt;/td&gt;
&lt;td&gt;A dynamically resizable list of Items&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Queue&lt;/td&gt;
&lt;td&gt;A generic implementation of a first-in, first-out (FIFO) list&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stack&lt;/td&gt;
&lt;td&gt;A generic implementation of a last-in, first-out (LIFO) list&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;In conclusion,&lt;/em&gt;&lt;/strong&gt; &lt;br&gt;
generics are an essential feature of the C# language, offering developers a powerful mechanism for crafting versatile and reusable code. Whether in methods or classes, leveraging generics can significantly enhance the flexibility and efficiency of your C# applications.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>webdev</category>
      <category>microsoft</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Overcoming procrastination 🤓</title>
      <dc:creator>fadyehabamer</dc:creator>
      <pubDate>Sat, 07 Nov 2020 06:34:19 +0000</pubDate>
      <link>https://dev.to/fadyehabamer/overcoming-procrastination-4jdh</link>
      <guid>https://dev.to/fadyehabamer/overcoming-procrastination-4jdh</guid>
      <description>&lt;p&gt;You know the scene–you have a challenging task ahead of you, so you avoid thinking about it until the last minute. You sit down to finally do the task, and you become distracted by checking emails, Instagram feeds, ANYTHING that keeps you from actually doing the task.&lt;/p&gt;

&lt;p&gt;Sound familiar?&lt;/p&gt;

&lt;p&gt;At its core, procrastination is avoidance. We usually avoid things that are challenging because of fear, self-doubt, anxiety, or low self-confidence. When we are anxious or fearful, our emotions and behavior are hard to regulate, so we end up doing everything we can to avoid the “spinning” sensation and distract ourselves with something more fun and mindless. We fall prey to pesky instant gratification to soothe ourselves, but the problem is that procrastinating only makes the anxiety worse. It doesn’t go away. We just numb it, and then it comes back stronger!&lt;/p&gt;

&lt;p&gt;So that, there are some tips to overcome procrastination. &lt;/p&gt;

&lt;p&gt;1-Think of the reward. &lt;br&gt;
Try reminding yourself about how good it will feel when you finally check that item off your list. Ruminating about doing something is 10 times harder than actually doing it, and when you finally finish the task, you’ll feel great! &lt;/p&gt;

&lt;p&gt;2-Give yourself compassion. &lt;br&gt;
Many times, we actually feel bad about procrastinating. We beat ourselves up so much that we procrastinate even more. Try acknowledging how hard it is to get started and then say some encouraging phrases to yourself to get motivated. Read here about self-compassion and the growth mindset.&lt;/p&gt;

&lt;p&gt;3-Avoid the “When I Feel Like It” trap. There will never be a time when you feel like doing something you’re avoiding. Don’t fall into that trap.&lt;/p&gt;

&lt;p&gt;4-Break the task up into digestible parts. &lt;br&gt;
My dad used the phrase “One bite at a time” to remind me to make a difficult task a lot easier for myself. Break the task up into smaller tasks, and then get the easiest one checked off your list. You’ll start to feel better as it you make it through, step by step.&lt;/p&gt;

&lt;p&gt;5-Don’t multi-task. &lt;br&gt;
Research shows that as much as we wish we could multi-task well, we actually don’t do it effectively as humans. Push distractions out of the way, and focus on one small task at a time.&lt;/p&gt;

&lt;p&gt;Learning to stop procrastinating can change your life by allowing you to place all that ruminating energy elsewhere. You’ll learn to focus on process, not perfection and find that you will persevere.&lt;/p&gt;

</description>
      <category>overcoming</category>
      <category>webdev</category>
      <category>procrastination</category>
      <category>learning</category>
    </item>
    <item>
      <title>Front end development vs. Back end development</title>
      <dc:creator>fadyehabamer</dc:creator>
      <pubDate>Wed, 04 Nov 2020 19:48:11 +0000</pubDate>
      <link>https://dev.to/fadyehabamer/front-end-development-vs-back-end-development-358</link>
      <guid>https://dev.to/fadyehabamer/front-end-development-vs-back-end-development-358</guid>
      <description>&lt;p&gt;The website’s front end is everything you see and can interact with using a browser. So, creating this visual part is called front-end development. You could even say that designers creating user interfaces and planning experiences are also front-end developers, as they are working in collaboration on the same part of the project.&lt;br&gt;
To create the front end, engineers use the combination of HTML (for basic page structure and content), CSS (for visual editing), and JavaScript (for making websites interactive). The same set of tools is used to create progressive web apps –  mobile apps that look and feel like a native one but are created with the use of front-end technologies.&lt;/p&gt;

&lt;p&gt;On the other hand, the back end is everything that happens, well, backstage. It contains servers where your web pages are located and the underlying logic that governs the website’s functions and processes. &lt;/p&gt;

&lt;p&gt;The back end is built using a different set of technologies, including Java, PHP, Ruby, C#, and sometimes Javascript &lt;/p&gt;

</description>
      <category>frontend</category>
      <category>backend</category>
      <category>webdev</category>
      <category>webdesign</category>
    </item>
  </channel>
</rss>
