<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kevin Peery on Medium]]></title>
        <description><![CDATA[Stories by Kevin Peery on Medium]]></description>
        <link>https://medium.com/@kevin-peery?source=rss-652bd10803a5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*GNMjmEr6zWOMZBTnOLaXLw.jpeg</url>
            <title>Stories by Kevin Peery on Medium</title>
            <link>https://medium.com/@kevin-peery?source=rss-652bd10803a5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 03:04:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kevin-peery/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Exploring Multithreading in C# and Java: A Comparative Guide]]></title>
            <link>https://kevin-peery.medium.com/exploring-multithreading-in-c-and-java-a-comparative-guide-8e89fe607292?source=rss-652bd10803a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e89fe607292</guid>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[multithreading]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Kevin Peery]]></dc:creator>
            <pubDate>Wed, 27 Sep 2023 10:58:03 GMT</pubDate>
            <atom:updated>2023-09-27T11:07:27.819Z</atom:updated>
            <content:encoded><![CDATA[<p>Multithreading is a powerful concept in modern software development that allows programs to perform multiple tasks concurrently, improving performance and responsiveness. In this article, we’ll explore multithreading in two popular programming languages: C# and Java. We’ll also introduce the concept of “concurrency” as it relates to multithreading.</p><p>Another term often used interchangeably with “multithreading” is “concurrency.” Concurrency refers to the ability of a system or program to manage multiple tasks or threads simultaneously. Multithreading is a specific approach to achieving concurrency, where multiple threads are used to execute tasks concurrently within a single process. Concurrency can also be achieved through other mechanisms, such as <a href="https://learn.microsoft.com/en-us/dotnet/standard/threading/threads-and-threading">multiprocessing</a>, <a href="https://learn.microsoft.com/en-us/dotnet/standard/parallel-programming/">parallel processing</a>, or <a href="https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/">asynchronous programming</a>, depending on the context and programming language.</p><h3>Multithreading Fundamentals</h3><p>Before diving into language-specific details, let’s establish some multithreading fundamentals:</p><h3>What is Multithreading?</h3><p>Multithreading is the concurrent execution of multiple threads within the same process. Threads are lightweight units of execution that share the same memory space but can run independently. This enables programs to execute multiple tasks simultaneously, making efficient use of modern multi-core processors.</p><h3>Why Use Multithreading?</h3><p>Multithreading offers several advantages, including:</p><ul><li>Improved Performance: Multithreaded programs can utilize multiple CPU cores, speeding up computation-intensive tasks.</li><li>Responsiveness: Multithreading keeps user interfaces responsive, as background tasks can run independently.</li><li>Parallel Processing: Tasks that can be divided into subtasks can benefit from parallel processing, completing faster.</li></ul><p>Now, let’s explore how C# and Java handle multithreading.</p><h3>Multithreading in C#</h3><p>C# provides robust multithreading support through the .NET Framework. Here are some key aspects:</p><h3>Threading Library</h3><p>C# offers the System.Threading namespace, which includes classes and utilities for working with threads. Key classes include Thread for creating and managing threads and ThreadPool for efficient thread management.</p><h3>Creating Threads</h3><p>To create a new thread, you can instantiate the Thread class and provide it with a delegate that represents the method to be executed in the new thread. Here’s a simple example of creating and starting a new thread in C#:</p><pre>using System;<br>using System.Threading;<br><br>class Program<br>{<br>    static void Main()<br>    {<br>        // Create a new thread and specify the method to execute<br>        Thread newThread = new Thread(DoWork);<br><br>        // Start the thread<br>        newThread.Start();<br><br>        // Main thread continues to execute here<br>        Console.WriteLine(&quot;Main thread is running.&quot;);<br><br>        // Wait for the new thread to finish<br>        newThread.Join();<br><br>        Console.WriteLine(&quot;Main thread finished.&quot;);<br>    }<br><br>    static void DoWork()<br>    {<br>        Console.WriteLine(&quot;New thread is running.&quot;);<br>        // Perform some work here<br>    }<br>}</pre><p>In this example, a new thread is created using the Thread class, and the DoWork method is specified as the method to execute in the new thread. The Start method initiates the execution of the new thread, while the main thread continues to run independently. The Join method is used to wait for the new thread to finish before the main thread proceeds.</p><h3>Thread Synchronization</h3><p>Multithreading introduces challenges related to data synchronization and coordination between threads. C# provides tools for thread synchronization, including locks, mutexes, and semaphores. These tools help prevent data races and ensure that threads work together without conflicts.</p><h3>Multithreading in Java</h3><p>Java’s multithreading support is an integral part of the language and platform. Here are some key aspects:</p><h3>The Thread Class</h3><p>Java includes the Thread class in the java.lang package, making it easy to create and manage threads.</p><h3>Creating Threads</h3><p>To create a new thread in Java, you can extend the Thread class and override the run method. Here&#39;s an example:</p><pre>class MyThread extends Thread {<br>    public void run() {<br>        System.out.println(&quot;New thread is running.&quot;);<br>        // Perform some work here<br>    }<br>}<br><br>public class Main {<br>    public static void main(String[] args) {<br>        // Create a new thread<br>        Thread newThread = new MyThread();<br><br>        // Start the thread<br>        newThread.start();<br><br>        // Main thread continues to execute here<br>        System.out.println(&quot;Main thread is running.&quot;);<br>    }<br>}</pre><p>In this example, a new thread is created by extending the Thread class and overriding the run method. The start method initiates the execution of the new thread.</p><h3>Thread Synchronization</h3><p>Java provides synchronization mechanisms such as the synchronized keyword and classes like Lock and Semaphore to manage thread synchronization and prevent data conflicts.</p><h3>Similarities and Differences</h3><p>While both C# and Java support multithreading, there are some differences in their implementations and features. Here are a few:</p><ul><li>Thread Creation: C# provides a delegate-based approach for creating threads, while Java uses the Thread class with method overriding.</li><li>Thread Management: Java’s thread management is more abstract, allowing for finer control over thread behavior. C# offers the ThreadPool for efficient management of threads.</li><li>Thread Safety: Both languages provide tools for thread synchronization and ensuring thread safety, but the syntax and classes may differ.</li></ul><h3>Conclusion</h3><p>Multithreading is a powerful technique for improving the performance and responsiveness of applications. C# and Java offer robust multithreading support, each with its own set of tools and features. Understanding the fundamentals of multithreading and the specific implementations in these languages is crucial for building efficient and scalable applications.</p><p>As you explore multithreading in C# and Java, consider your project requirements and the strengths of each language’s multithreading capabilities. With the right approach, you can leverage multithreading to create high-performance applications that make the most of modern hardware.</p><p>Happy multithreading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e89fe607292" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering AJAX: Building Dynamic Web Applications]]></title>
            <link>https://kevin-peery.medium.com/mastering-ajax-building-dynamic-web-applications-1acbff1d1b47?source=rss-652bd10803a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/1acbff1d1b47</guid>
            <category><![CDATA[promises]]></category>
            <category><![CDATA[xmlhttprequest]]></category>
            <category><![CDATA[fetch-api]]></category>
            <category><![CDATA[ajax]]></category>
            <dc:creator><![CDATA[Kevin Peery]]></dc:creator>
            <pubDate>Tue, 26 Sep 2023 15:03:58 GMT</pubDate>
            <atom:updated>2023-09-26T15:04:53.153Z</atom:updated>
            <content:encoded><![CDATA[<p>When it comes to building modern web applications, AJAX (Asynchronous JavaScript and XML) is a game-changer. It empowers developers to create dynamic and responsive websites without the need for full-page reloads. In this article, we’ll dive deep into the world of AJAX, explore its core concepts, discuss the Fetch API, and provide a few practical code examples.</p><h3>What is AJAX?</h3><p>AJAX is a set of web development techniques that allows you to make asynchronous requests to a server from a web page. The term “asynchronous” is crucial here because it means that AJAX requests can be initiated without blocking the rest of the code execution. In other words, your web page can continue to respond to user interactions while making requests to the server in the background.</p><h3>Key AJAX Concepts</h3><p>Before we dive into code examples, let’s understand the key concepts related to AJAX:</p><ol><li>HTTP Requests: AJAX relies on standard HTTP methods like GET (for retrieving data) and POST (for sending data) to communicate with a server.</li><li>XMLHttpRequest: In the past, the primary method of making AJAX requests was through the XMLHttpRequest object. This approach involved creating an instance of the object, setting up event listeners to handle responses, and initiating requests.</li><li>Fetch API: In modern web development, the Fetch API has become the preferred way to make AJAX requests. It provides a simpler and promise-based interface for working with HTTP requests.</li><li>Promises: Promises are a fundamental part of AJAX. They allow you to handle asynchronous operations in an organized and readable manner. AJAX requests often return promises that resolve when the response is received.</li></ol><h3>The Fetch API: Making AJAX Requests</h3><p>Let’s take a closer look at how to make AJAX requests using the Fetch API. Here’s a basic example:</p><pre>// Create an AJAX request using the Fetch API<br>fetch(&#39;https://api.example.com/data&#39;)<br>  .then(response =&gt; {<br>    // Handle the response (e.g., parse JSON data)<br>    return response.json();<br>  })<br>  .then(data =&gt; {<br>    // Use the retrieved data<br>    console.log(data);<br>  })<br>  .catch(error =&gt; {<br>    // Handle errors<br>    console.error(&#39;Error:&#39;, error);<br>  });</pre><p>In this example:</p><ul><li>We use fetch to send an asynchronous GET request to the specified URL.</li><li>The then method is used to handle the response, where we parse the JSON data using response.json().</li><li>Finally, we use another then to work with the retrieved data and a catch block to handle errors.</li></ul><h3>AJAX in Action</h3><p>Now, let’s explore some practical scenarios where AJAX shines:</p><h3>Live Search</h3><p>Imagine creating a live search feature where search results are updated as the user types. AJAX allows you to send partial search queries to the server, retrieve matching results, and display them in real-time.</p><pre>// AJAX live search example<br>inputElement.addEventListener(&#39;input&#39;, () =&gt; {<br>  const query = inputElement.value;<br>  fetch(`https://api.example.com/search?q=${query}`)<br>    .then(response =&gt; response.json())<br>    .then(results =&gt; {<br>      // Update the search results on the page<br>      displayResults(results);<br>    })<br>    .catch(error =&gt; {<br>      console.error(&#39;Error:&#39;, error);<br>    });<br>});</pre><h3>Real-Time Updates</h3><p>AJAX is perfect for building real-time features like chat applications, social media feeds, or live notifications. It enables your web page to constantly check for updates on the server and refresh content without user intervention.</p><pre>// AJAX real-time notifications example<br>function checkForNotifications() {<br>  fetch(&#39;https://api.example.com/notifications&#39;)<br>    .then(response =&gt; response.json())<br>    .then(notifications =&gt; {<br>      // Display new notifications to the user<br>      showNotifications(notifications);<br>    })<br>    .catch(error =&gt; {<br>      console.error(&#39;Error:&#39;, error);<br>    });<br>}<br><br>// Poll for notifications every 5 seconds<br>setInterval(checkForNotifications, 5000);</pre><h3>Conclusion</h3><p>AJAX is a vital tool in the modern web developer’s toolkit. It enables the creation of dynamic, responsive, and user-friendly web applications. By understanding the principles of asynchronous requests, mastering the Fetch API, and exploring practical examples, you can harness the full potential of AJAX in your web development projects. So, embrace AJAX, and unlock a world of possibilities for building interactive web experiences.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1acbff1d1b47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reversing a String in C#, Java, and JavaScript: A Step-by-Step Guide]]></title>
            <link>https://kevin-peery.medium.com/reversing-a-string-in-c-java-and-javascript-a-step-by-step-guide-739d45720ea5?source=rss-652bd10803a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/739d45720ea5</guid>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Kevin Peery]]></dc:creator>
            <pubDate>Tue, 26 Sep 2023 00:36:00 GMT</pubDate>
            <atom:updated>2023-09-26T00:40:05.776Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we’ll explore how to reverse a string using three popular programming languages: C#, Java, and JavaScript. We’ll dive into the code, providing detailed explanations and step-by-step instructions for each language. Whether you’re a beginner looking to understand the basics of string manipulation or an experienced developer seeking language-specific solutions, this guide has got you covered.</p><h3>Reversing a String in C#</h3><pre>using System;<br><br>class Program<br>{<br>    static void Main()<br>    {<br>        string input = &quot;Hello, World!&quot;;<br>        string reversed = ReverseString(input);<br>        Console.WriteLine(reversed);<br>    }<br><br>    static string ReverseString(string input)<br>    {<br>        char[] charArray = input.ToCharArray();<br>        Array.Reverse(charArray);<br>        return new string(charArray);<br>    }<br>}</pre><p>In C#, we can convert the input string to a character array, reverse it using Array.Reverse, and then create a new string from the reversed character array.</p><h3>Reversing a String in Java</h3><pre>public class Main {<br>    public static void main(String[] args) {<br>        String input = &quot;Hello, World!&quot;;<br>        String reversed = reverseString(input);<br>        System.out.println(reversed);<br>    }<br><br>    static String reverseString(String input) {<br>        StringBuilder reversed = new StringBuilder();<br>        for (int i = input.length() - 1; i &gt;= 0; i--) {<br>            reversed.append(input.charAt(i));<br>        }<br>        return reversed.toString();<br>    }<br>}</pre><p>In Java, we can achieve string reversal by iterating through the input string from the end to the beginning and appending characters to a StringBuilder.</p><h3>Reversing a String in JavaScript</h3><pre>function reverseString(input) {<br>    return input.split(&#39;&#39;).reverse().join(&#39;&#39;);<br>}<br><br>const input = &#39;Hello, World!&#39;;<br>const reversed = reverseString(input);<br>console.log(reversed);</pre><p>In JavaScript, we can split the input string into an array of characters, reverse the array using reverse(), and then join the characters back together into a string.</p><p>In this exploration of string reversal in C#, Java, and JavaScript, we’ve seen how each language brings its unique approach to solving a common problem. While the goal remains the same — to reverse a string — the implementation varies.</p><p>C# leverages array manipulation with ease, Java showcases the power of StringBuilder, and JavaScript&#39;s concise array methods provide a quick solution. It&#39;s fascinating to observe how these languages, with their distinct syntax and features, achieve a common objective.</p><p>As you delve into the code examples, you’ll likely notice that the choice of language can influence the simplicity and efficiency of your solution. Whether you prefer the elegance of C#, the flexibility of Java, or the brevity of JavaScript, each language has its strengths.</p><p>So, which one is the best? The answer depends on your specific project requirements and your familiarity with the language. The beauty of programming lies in having a range of tools at your disposal, each suited to a particular task.</p><p>In your coding journey, remember that learning different programming languages not only broadens your horizons but also equips you with a diverse set of problem-solving skills. Keep experimenting, keep coding, and keep exploring the world of programming!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=739d45720ea5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying SOLID Principles in Object-Oriented Programming]]></title>
            <link>https://kevin-peery.medium.com/demystifying-solid-principles-in-object-oriented-programming-2f5afa974cd6?source=rss-652bd10803a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f5afa974cd6</guid>
            <category><![CDATA[solid-principles-in-java]]></category>
            <category><![CDATA[solid-programming]]></category>
            <category><![CDATA[solid-principles]]></category>
            <dc:creator><![CDATA[Kevin Peery]]></dc:creator>
            <pubDate>Tue, 26 Sep 2023 00:12:43 GMT</pubDate>
            <atom:updated>2023-09-26T00:12:43.985Z</atom:updated>
            <content:encoded><![CDATA[<p>Object-Oriented Programming (OOP) is a powerful paradigm that allows developers to model real-world entities using objects and classes. While OOP provides numerous benefits such as modularity and code reusability, writing maintainable and scalable code can be challenging. This is where SOLID principles come into play. SOLID is an acronym that represents five essential principles for designing robust and maintainable software. In this article, we’ll demystify each of these principles and understand how they contribute to writing clean and maintainable code.</p><h3>1. Single Responsibility Principle (SRP)</h3><p>The Single Responsibility Principle states that a class should have only one reason to change. In other words, a class should have a single responsibility or job. This principle encourages us to keep classes focused on doing one thing and doing it well.</p><p>Example: Consider a User class in a web application. This class should handle user-related functionalities like authentication and authorization. If we mix unrelated functionalities, such as user profile management, within the User class, it violates SRP. Instead, we should have a separate UserProfile class to manage user profiles.</p><h3>2. Open-Closed Principle (OCP)</h3><p>The Open-Closed Principle suggests that software entities (classes, modules, functions, etc.) should be open for extension but closed for modification. It encourages us to design code in a way that allows us to add new functionality without altering existing code.</p><p>Example: Imagine a Shape class with methods to calculate the area for different shapes like circles and rectangles. To adhere to OCP, we can create new subclasses like Circle and Rectangle that extend the Shape class without modifying the existing Shape class.</p><h3>3. Liskov Substitution Principle (LSP)</h3><p>The Liskov Substitution Principle states that objects of a derived class should be able to replace objects of the base class without affecting the correctness of the program. In simpler terms, if a class is a subclass of another class, it should be usable interchangeably with its base class.</p><p>Example: If you have a Bird base class and a Penguin subclass, you should be able to use a Penguin object wherever you use a Bird object without causing issues. This principle ensures that inheritance relationships maintain consistency.</p><h3>4. Interface Segregation Principle (ISP)</h3><p>The Interface Segregation Principle advises that a class should not be forced to implement interfaces it does not use. In other words, we should design small, specific interfaces rather than large, monolithic ones.</p><p>Example: If you have an Employee interface with methods for both salary calculation and vacation management, not all classes implementing this interface might need both functionalities. Instead, we can split it into SalaryCalculable and VacationManageable interfaces, allowing classes to implement only what&#39;s relevant.</p><h3>5. Dependency Inversion Principle (DIP)</h3><p>The Dependency Inversion Principle suggests that high-level modules should not depend on low-level modules. Both should depend on abstractions. It encourages the use of interfaces or abstract classes to decouple the high-level and low-level components of a system.</p><p>Example: Instead of directly instantiating database access code in a service class, we can define an IDatabase interface and have the service class depend on the interface. This way, we can easily switch between different database implementations without modifying the service class.</p><h3>Conclusion</h3><p>SOLID principles are fundamental guidelines for writing maintainable, flexible, and robust code in OOP. While these principles are language-agnostic, they are universally applicable. By following these principles, developers can design software that is easy to understand, extend, and maintain. Incorporating SOLID principles into your coding practices will lead to better software design and improved software quality.</p><p>In the ever-evolving world of software development, mastering these principles is an essential step toward becoming a more proficient and effective programmer. So, embrace SOLID principles, and watch your codebase transform into a masterpiece of modularity and maintainability.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f5afa974cd6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering SQL Concepts for Software Developer Interviews]]></title>
            <link>https://kevin-peery.medium.com/mastering-sql-concepts-for-software-developer-interviews-e4ef5a55f3b5?source=rss-652bd10803a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4ef5a55f3b5</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[stored-procedure]]></category>
            <category><![CDATA[structured-query-language]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Kevin Peery]]></dc:creator>
            <pubDate>Tue, 26 Sep 2023 00:09:18 GMT</pubDate>
            <atom:updated>2023-09-26T01:02:23.787Z</atom:updated>
            <content:encoded><![CDATA[<p>As a software developer, preparing for technical interviews can be a daunting task. SQL (Structured Query Language) is a critical skill often assessed in interviews for roles that involve database interactions and data manipulation. In this article, we’ll dive into key SQL concepts commonly encountered in software developer interviews. By mastering these concepts, you’ll not only boost your interview performance but also enhance your abilities as a database-driven developer.</p><h3>Table of Contents</h3><pre>1. Introduction to SQL<br>   - What is SQL?<br>   - Why is SQL important for developers?<br><br>2. Database Basics<br>   - Relational Databases<br>   - Tables, Rows, and Columns<br>   - Primary Keys and Foreign Keys<br><br>3. SQL Queries<br>   - SELECT Statements<br>   - Filtering and Sorting Data<br>   - Aggregate Functions (COUNT, SUM, AVG, MAX, MIN)<br>   - Joins (INNER JOIN, LEFT JOIN, RIGHT JOIN)<br>   - Subqueries<br><br>4. Data Manipulation<br>   - INSERT, UPDATE, DELETE Statements<br>   - Transactions<br>   - Stored Procedures<br>     - What are Stored Procedures?<br>     - Creating and Executing Stored Procedures<br>     - Advantages and Use Cases<br>     - Best Practices<br><br>5. Data Definition Language (DDL)<br>   - CREATE TABLE<br>   - ALTER TABLE<br>   - DROP TABLE<br><br>6. Normalization<br>   - First, Second, and Third Normal Forms (1NF, 2NF, 3NF)<br>   - Denormalization<br><br>7. Indexes<br>   - What are indexes?<br>   - Types of Indexes (B-Tree, Bitmap, etc.)<br>   - Creating and Managing Indexes<br><br>8. Database Design<br>   - Entity-Relationship Diagrams (ERDs)<br>   - Design Considerations<br>   - Database Modeling Best Practices<br><br>9. Performance Optimization<br>   - Query Optimization<br>   - Index Optimization<br>   - Caching<br><br>10. Transactions and Concurrency Control<br>    - ACID Properties<br>    - Locking Mechanisms<br>    - Isolation Levels<br><br>11. Common SQL Interview Questions<br>    - Sample SQL interview questions with explanations and solutions.<br><br>12. Conclusion<br>    - Recap of key SQL concepts<br>    - The importance of continuous learning</pre><h3>What is SQL?</h3><p>SQL, or Structured Query Language, is a domain-specific language used for managing and querying relational databases. It provides a standardized way to interact with databases, enabling you to perform tasks such as retrieving data, updating records, and defining database structures.</p><p>SQL is not limited to a single database management system; it is supported by various database platforms, including PostgreSQL, MySQL, SQL Server, and SQLite. This versatility makes SQL a valuable skill for developers working with different databases.</p><h3>Why is SQL Important for Developers?</h3><p>SQL is a fundamental skill for developers for several reasons:</p><ul><li>Data Retrieval: Developers use SQL to retrieve specific data from databases, allowing applications to display relevant information to users.</li><li>Data Modification: SQL enables developers to insert, update, and delete records in a database, ensuring that data remains accurate and up to date.</li><li>Database Design: Understanding SQL helps developers design efficient and normalized database structures, contributing to application performance and maintainability.</li><li>Reporting and Analysis: SQL is essential for generating reports and performing data analysis, which are common tasks in software development.</li><li>Backend Development: Many backend systems rely on databases to store and manage data. SQL knowledge is crucial for building robust backend services.</li></ul><p>Now that we’ve established the importance of SQL, let’s explore the basics of relational databases.</p><h3>2. Database Basics</h3><h3>Relational Databases</h3><p>A relational database is a type of database that organizes data into structured tables with rows and columns. These tables are related to each other through common fields, allowing you to establish relationships and query data efficiently.</p><p>Key characteristics of relational databases include:</p><ul><li>Tables: Relational databases store data in tables, each of which represents a specific entity or concept. For example, you might have tables for “Users,” “Products,” and “Orders.”</li><li>Rows: Each row in a table represents a single record or data entry. For instance, in a “Users” table, each row corresponds to one user.</li><li>Columns: Columns define the attributes or properties of the data. In a “Users” table, columns might include “ID,” “Name,” “Email,” and “Date of Birth.”</li></ul><h3>Tables, Rows, and Columns</h3><p>Let’s take a closer look at these fundamental components:</p><ul><li>Tables: Think of tables as spreadsheets or containers that hold related data. In a retail application, you might have a “Products” table to store information about various products.</li><li>Rows: Rows are individual records within a table. Each row represents a distinct data entry. For instance, in the “Products” table, each row could represent a specific product, such as a laptop, smartphone, or television.</li><li>Columns: Columns, also known as fields, define the attributes or properties of the data stored in the table. For our “Products” table, columns could include “ProductID,” “ProductName,” “Price,” and “StockQuantity.”</li></ul><p>Understanding the structure of tables, rows, and columns is foundational to working with relational databases in SQL. Now, let’s explore two essential concepts closely related to table design: primary keys and foreign keys.</p><h3>Primary Keys and Foreign Keys</h3><p>Primary keys and foreign keys are crucial for establishing relationships between tables and ensuring data integrity.</p><ul><li>Primary Key: Every table in a relational database should have a primary key. A primary key is a unique identifier for each row in the table. It ensures that each record can be uniquely identified. In our “Products” table, “ProductID” could serve as the primary key.</li><li>Foreign Key: A foreign key is a field in a table that links to the primary key of another table. It establishes a relationship between the tables. For instance, in an “Orders” table, you might have a foreign key that references the “ProductID” from the “Products” table, indicating which product was ordered.</li></ul><p>These keys enable you to create meaningful connections between tables, ensuring data consistency and accuracy. With a solid understanding of these database basics, you’re ready to dive into SQL queries.</p><h3>3. SQL Queries</h3><h3>SELECT Statements</h3><p>SQL queries are at the heart of database interactions. A SELECT statement is used to retrieve data from one or more tables. It allows you to specify which columns to retrieve and apply filters to narrow down the results.</p><p>Here’s a basic example:</p><pre>SELECT ProductName, Price<br>FROM Products<br>WHERE Price &lt; 100;</pre><p>In this query:</p><ul><li>SELECT ProductName, Price specifies that we want to retrieve the &quot;ProductName&quot; and &quot;Price&quot; columns.</li><li>FROM Products indicates that we&#39;re querying the &quot;Products&quot; table.</li><li>WHERE Price &lt; 100 is a filter condition that restricts the results to products with a price less than 100.</li></ul><h3>Filtering and Sorting Data</h3><p>SQL offers various ways to filter and sort data. For instance:</p><ul><li>ORDER BY: You can use ORDER BY to sort the results based on one or more columns. For example, ORDER BY Price DESC sorts products by price in descending order.</li><li>GROUP BY: The GROUP BY clause is used to group rows based on the values in one or more columns. This is often used with aggregate functions like COUNT, SUM, AVG, MAX, and MIN to perform calculations on grouped data.</li><li>HAVING: When using GROUP BY, the HAVING clause allows you to filter grouped results based on aggregate values. For example, HAVING COUNT(*) &gt; 5 filters groups with more than five members.</li></ul><p>SQL queries are versatile and can be customized to retrieve precisely the data you need. Next, let’s explore one of the most powerful SQL features: joins.</p><h3>Joins (INNER JOIN, LEFT JOIN, RIGHT JOIN)</h3><p>Relational databases are designed to store data in separate tables that can be related to each other. To retrieve information from multiple tables, you use SQL joins.</p><ul><li>INNER JOIN: An inner join returns only the rows that have matching values in both tables. It effectively combines rows from two or more tables based on a related column.</li><li>LEFT JOIN (OUTER JOIN): A left join returns all rows from the left table and the matching rows from the right table. If there’s no match, NULL values are returned for the right table’s columns.</li><li>RIGHT JOIN (OUTER JOIN): A right join is similar to a left join but returns all rows from the right table and the matching rows from the left table.</li><li>FULL OUTER JOIN: A full outer join returns all rows when there is a match in either the left or the right table. If there’s no match, NULL values are returned for the columns from the non-matching table.</li></ul><p>Joins are powerful for combining data from multiple tables, allowing you to create comprehensive result sets. They are particularly useful when working with normalized databases where data is divided into several related tables.</p><h3>Subqueries</h3><p>A subquery is a query nested within another query. It allows you to retrieve data from one table based on data from another table. Subqueries can be used in various parts of a SQL statement, such as the SELECT, FROM, or WHERE clauses.</p><p>Here’s an example of a subquery used in a WHERE clause:</p><pre>SELECT ProductName<br>FROM Products<br>WHERE CategoryID IN (SELECT CategoryID FROM Categories WHERE CategoryName = &#39;Electronics&#39;);</pre><p>In this query:</p><ul><li>The inner query (SELECT CategoryID FROM Categories WHERE CategoryName = &#39;Electronics&#39;) retrieves the CategoryID for the &quot;Electronics&quot; category.</li><li>The outer query retrieves the ProductName of products that belong to the &quot;Electronics&quot; category using the IN operator.</li></ul><p>Subqueries are a versatile tool for complex data retrieval scenarios and can help you tackle advanced interview questions.</p><p>With a solid understanding of SQL queries, you’re well-equipped to retrieve and manipulate data from relational databases. But SQL is not limited to data retrieval; it’s also a powerful tool for data manipulation.</p><h3>4. Data Manipulation</h3><h3>INSERT, UPDATE, DELETE Statements</h3><p>SQL provides three main statements for data manipulation:</p><ul><li>INSERT: The INSERT statement is used to add new records (rows) to a table. For example, to add a new product to the &quot;Products&quot; table:</li></ul><pre>INSERT INTO Products (ProductName, Price) VALUES (&#39;Smartphone&#39;, 499.99);</pre><ul><li>UPDATE: The UPDATE statement modifies existing records in a table. For instance, to update the price of a product:</li></ul><pre>UPDATE Products SET Price = 549.99 WHERE ProductName = &#39;Smartphone&#39;;</pre><p>DELETE: The DELETE statement removes one or more records from a table. To delete a product:</p><pre>DELETE FROM Products WHERE ProductName = &#39;Smartphone&#39;;</pre><p>These statements are essential for maintaining and modifying data within a database.</p><h3>Transactions</h3><p>Transactions are a fundamental concept in database management. A transaction is a sequence of one or more SQL statements that are executed as a single unit of work. Transactions ensure that a series of operations either all succeed or fail together, maintaining data consistency.</p><p>Transactions adhere to the ACID properties:</p><ul><li>Atomicity: A transaction is atomic, meaning that it’s treated as a single, indivisible unit. Either all the changes within a transaction are applied, or none of them are.</li><li>Consistency: A transaction takes the database from one consistent state to another. It ensures that data remains valid throughout the transaction.</li><li>Isolation: Transactions are isolated from each other, meaning that the changes made in one transaction are not visible to other transactions until the first transaction is completed (committed).</li><li>Durability: Once a transaction is committed, its changes are permanent and survive any system failures.</li></ul><p>For example, consider a bank transfer as a transaction. Funds are deducted from one account and added to another. The transaction is atomic, ensuring that if one part fails, the other doesn’t go through. It maintains consistency by ensuring that the accounts’ total balances remain accurate. The isolation property ensures that concurrent transactions don’t interfere with each other, and durability ensures that the transfer remains in effect even after a system crash.</p><h3>Stored Procedures</h3><p>Stored procedures are a powerful and essential component of SQL databases. They are essentially a set of precompiled SQL statements that can be executed as a single unit. Stored procedures offer numerous advantages in terms of performance, security, and maintainability in database management. In this section, we’ll dive into what stored procedures are, how to create and execute them, explore their advantages, and discuss best practices for using them effectively.</p><h4>What are Stored Procedures?</h4><p>A stored procedure is a collection of SQL statements that are stored on the database server. These statements are precompiled and can be executed by invoking the procedure’s name. Stored procedures can accept parameters, return values, and perform a wide range of operations within the database.</p><p>One significant benefit of stored procedures is that they encapsulate complex logic within the database itself. This means that application developers can call a stored procedure without needing to know the underlying SQL details. This abstraction layer simplifies application code and enhances security by preventing SQL injection attacks.</p><h4>Creating and Executing Stored Procedures</h4><p>Creating a stored procedure typically involves using the CREATE PROCEDURE or CREATE PROC SQL statement. Here&#39;s a basic example of creating a stored procedure that retrieves employee information by department:</p><pre>CREATE PROCEDURE GetEmployeesByDepartment (@DepartmentName VARCHAR(50))<br>AS<br>BEGIN<br>    SELECT EmployeeName, Salary<br>    FROM Employees<br>    WHERE Department = @DepartmentName;<br>END;</pre><p>In this example:</p><ul><li>We create a procedure named GetEmployeesByDepartment.</li><li>It accepts a parameter @DepartmentName that specifies the department to retrieve employees from.</li><li>The procedure contains a SQL query to select employee names and salaries based on the provided department name.</li></ul><p>To execute this stored procedure, you can use the EXEC or EXECUTE statement:</p><pre>EXEC GetEmployeesByDepartment &#39;Engineering&#39;;</pre><p>This will invoke the stored procedure and return the results for the “Engineering” department.</p><h4>Advantages and Use Cases</h4><p>Stored procedures offer several advantages:</p><ol><li>Improved Performance: Stored procedures are precompiled and cached, resulting in faster execution times for frequently used operations.</li><li>Security: They prevent SQL injection attacks by parameterizing inputs and enforcing security permissions.</li><li>Encapsulation: Complex database logic can be encapsulated within stored procedures, reducing code duplication in application code.</li><li>Maintainability: Changes to database logic can be made within the stored procedure, without requiring changes to the application code.</li><li>Version Control: Stored procedures can be versioned and tracked, ensuring control over database changes.</li></ol><p>Use cases for stored procedures include data retrieval, data modification (INSERT, UPDATE, DELETE), report generation, and business logic implementation.</p><h4>Best Practices</h4><p>When working with stored procedures, consider these best practices:</p><ol><li>Parameterize Inputs: Always use parameterized inputs to prevent SQL injection attacks.</li><li>Keep It Simple: Avoid creating overly complex stored procedures. Simplicity enhances maintainability.</li><li>Document Procedures: Provide clear documentation for each stored procedure, including input parameters and expected output.</li><li>Error Handling: Implement error handling and reporting mechanisms within stored procedures.</li><li>Testing: Thoroughly test stored procedures to ensure they behave as expected.</li><li>Version Control: Use version control systems to track changes to stored procedures.</li></ol><p>Stored procedures are a valuable tool in SQL database management. They promote code reusability, enhance security, and improve overall database performance. By mastering the creation and usage of stored procedures, you can leverage their benefits to streamline database operations and ensure data integrity.</p><p>Now that we’ve covered data manipulation, transactions, and stored procedures let’s shift our focus to defining database structures.</p><h3>5. Data Definition Language (DDL)</h3><h3>CREATE TABLE</h3><p>The Data Definition Language (DDL) in SQL is used to define and manage the structure of the database. The primary DDL command is CREATE TABLE, which defines a new table&#39;s structure.</p><p>Here’s an example:</p><pre>CREATE TABLE Customers (<br>    CustomerID INT PRIMARY KEY,<br>    FirstName VARCHAR(50),<br>    LastName VARCHAR(50),<br>    Email VARCHAR(100) UNIQUE<br>);</pre><p>In this query:</p><ul><li>CREATE TABLE Customers defines a new table named &quot;Customers.&quot;</li><li>The columns are defined within parentheses, each with a name and data type (e.g., CustomerID INT).</li><li>PRIMARY KEY indicates that the CustomerID column is the primary key, ensuring uniqueness.</li><li>UNIQUE on the Email column ensures that email addresses are unique across all customers.</li></ul><h3>ALTER TABLE</h3><p>The ALTER TABLE statement is used to modify an existing table&#39;s structure. You can add, modify, or drop columns and constraints. For example, to add a &quot;Phone&quot; column:</p><pre>ALTER TABLE Customers<br>ADD Phone VARCHAR(15);</pre><h3>DROP TABLE</h3><p>The DROP TABLE statement deletes an existing table and all its data permanently. Use this statement with caution, as it results in data loss:</p><pre>DROP TABLE Customers;</pre><p>DDL statements are essential for defining and maintaining the database’s structure, ensuring that it evolves with the application’s requirements. In the next section, we’ll explore a critical concept related to database design: normalization.</p><h3>6. Normalization</h3><p>Database normalization is a process used to organize a relational database efficiently. It minimizes data redundancy and ensures that data is stored in a logical and structured manner. Normalization is typically divided into several normal forms, with the most common being the First Normal Form (1NF), Second Normal Form (2NF), and Third Normal Form (3NF).</p><h3>First Normal Form (1NF)</h3><p>To achieve 1NF:</p><ul><li>Ensure that each column in a table contains atomic (indivisible) values. Avoid storing multiple values in a single column.</li></ul><p>For example, instead of storing phone numbers as a comma-separated string in a single column, create a separate “Phone Numbers” table with each phone number in a separate row, linking it to the main table using foreign keys.</p><h3>Second Normal Form (2NF)</h3><p>In addition to 1NF, to achieve 2NF:</p><ul><li>Remove partial dependencies. Ensure that non-key attributes (columns) depend on the entire primary key, not just part of it.</li></ul><h3>Third Normal Form (3NF)</h3><p>In addition to 2NF, to achieve 3NF:</p><ul><li>Remove transitive dependencies. Ensure that non-key attributes do not depend on other non-key attributes.</li></ul><p>Normalization helps maintain data integrity, reduces data redundancy, and simplifies data updates. However, it’s essential to strike a balance between normalization and performance. In some cases, denormalization (reintroducing redundancy) might be necessary for performance optimization.</p><h3>7. Indexes</h3><p>Indexes are data structures that improve the speed of data retrieval operations on a database table. They function similar to the index of a book, allowing the database management system to quickly locate the rows that match a query.</p><h3>What Are Indexes?</h3><p>Indexes are created on one or more columns of a table. When a query includes a filter condition on an indexed column, the database can use the index to quickly locate the relevant rows, significantly reducing the search time.</p><h3>Types of Indexes</h3><p>There are various types of indexes, including:</p><ul><li>B-Tree Indexes: These are the most common type of index. They work well for most situations and are suitable for columns with high cardinality (many unique values).</li><li>Bitmap Indexes: Bitmap indexes use bitmap vectors to represent the values in a column. They are efficient for columns with low cardinality (few unique values).</li><li>Hash Indexes: Hash indexes use a hash function to map values to specific locations in the index. They are suitable for exact-match queries but not for range queries.</li><li>Full-Text Indexes: Full-text indexes are used for efficient text-based searching, enabling searches for specific words or phrases within text columns.</li></ul><h3>Creating and Managing Indexes</h3><p>To create an index on a column, you use the CREATE INDEX statement. For example:</p><pre>CREATE INDEX idx_last_name ON Customers (LastName);</pre><p>In this query:</p><ul><li>CREATE INDEX idx_last_name ON Customers (LastName); creates an index named idx_last_name on the LastName column of the Customers table. This will speed up queries that involve filtering or sorting based on last names.</li></ul><p>Indexes are valuable for optimizing query performance, but they come with trade-offs. While they speed up read operations, they can slightly slow down write operations (inserts, updates, and deletes). Therefore, it’s essential to create indexes thoughtfully and consider the specific queries that need optimization.</p><h3>8. Database Design</h3><h3>Entity-Relationship Diagrams (ERDs)</h3><p>Before diving into SQL, it’s crucial to plan and design your database structure. Entity-Relationship Diagrams (ERDs) are a visual tool for representing the relationships between entities (tables) in your database. They help you model the structure of your database and understand how tables are related.</p><p>ERDs use symbols like rectangles (for tables), diamonds (for relationships), and lines (to connect them) to create a visual representation of your data model. By designing your database with ERDs, you can clarify the relationships between tables, identify key fields, and ensure that your database is organized efficiently.</p><h3>Design Considerations</h3><p>When designing a database, consider the following factors:</p><ul><li>Data Integrity: Ensure that data remains accurate and consistent by defining appropriate constraints, primary keys, and foreign keys.</li><li>Performance: Design your database to handle expected data volumes efficiently. Consider indexing, denormalization, and query optimization techniques.</li><li>Scalability: Plan for future growth by designing a schema that can scale with increased data and user loads.</li><li>Security: Implement access controls, authentication, and encryption to protect sensitive data.</li><li>Normalization: Apply normalization principles to avoid data redundancy and improve maintainability.</li></ul><h3>Database Modeling Best Practices</h3><p>To create a well-structured database:</p><ol><li>Identify Entities: Determine the entities (objects or concepts) in your application and represent them as tables. Each table should correspond to a distinct entity.</li><li>Define Relationships: Identify how entities are related to each other. Use foreign keys to establish these relationships.</li><li>Choose Data Types: Select appropriate data types for each column to ensure efficient storage and retrieval.</li><li>Create Indexes: Create indexes on columns that are frequently used in filtering, sorting, or joining.</li><li>Implement Constraints: Define constraints such as primary keys, foreign keys, and unique constraints to enforce data integrity.</li></ol><h3>9. Performance Optimization</h3><p>Efficient database performance is critical for applications. SQL offers several strategies for optimizing performance:</p><h3>Query Optimization</h3><p>Query optimization involves crafting SQL queries that retrieve data as efficiently as possible. This includes selecting the appropriate columns, using indexes, and minimizing data retrieval.</p><p>For instance, instead of using SELECT * to retrieve all columns, specify only the columns you need. Additionally, use the EXPLAIN statement (available in many database systems) to analyze query execution plans and identify areas for improvement.</p><h3>Index Optimization</h3><p>Proper indexing is a key factor in performance optimization. Create indexes on columns that are frequently used in WHERE clauses, JOIN conditions, and ORDER BY clauses. However, avoid excessive indexing, as it can lead to increased storage and maintenance overhead.</p><h3>Caching</h3><p>Caching involves storing frequently accessed data in memory to reduce the need for repeated database queries. Implement caching mechanisms in your application to improve response times and reduce database load.</p><h3>10. Transactions and Concurrency Control</h3><h3>ACID Properties</h3><p>Transactions adhere to the ACID properties:</p><ul><li>Atomicity: Transactions are treated as indivisible units. All changes within a transaction are applied, or none of them are.</li><li>Consistency: Transactions take the database from one consistent state to another. Data remains valid throughout the transaction.</li><li>Isolation: Transactions are isolated from each other. Changes made in one transaction are not visible to other transactions until the first transaction is completed (committed).</li><li>Durability: Once a transaction is committed, its changes are permanent and survive any system failures.</li></ul><p>Ensuring that transactions adhere to these properties is essential for maintaining data integrity.</p><h3>Locking Mechanisms</h3><p>Concurrency control is crucial in multi-user database environments. Locking mechanisms prevent conflicts when multiple users attempt to access and modify the same data simultaneously. Common lock types include shared locks (for read operations) and exclusive locks (for write operations).</p><p>Database management systems employ locking to ensure that transactions do not interfere with each other, maintaining data consistency.</p><h3>Isolation Levels</h3><p>Isolation levels define the level of visibility that one transaction has into the changes made by other transactions. Common isolation levels include Read Uncommitted, Read Committed, Repeatable Read, and Serializable. Each level balances between data consistency and concurrency.</p><p>Choosing the appropriate isolation level depends on your application’s requirements and the trade-offs between data accuracy and performance.</p><h3>11. Common SQL Interview Questions</h3><p>Now that we’ve explored key SQL concepts, let’s conclude by highlighting some common SQL interview questions you might encounter:</p><ol><li>Write a SQL query to retrieve all employees’ names and their corresponding department names from two related tables: Employees and Departments.</li><li>Explain the differences between INNER JOIN, LEFT JOIN, and RIGHT JOIN. Provide an example of when to use each type of join.</li><li>What are the ACID properties, and why are they important in database transactions?</li><li>Define the First Normal Form (1NF) and provide an example of a table that violates it. How would you bring the table into 1NF?</li><li>How can you optimize the performance of a slow SQL query? Discuss various optimization techniques.</li></ol><p>These questions cover a range of SQL topics and can help you prepare for interviews.</p><h3>Conclusion</h3><p>SQL is a powerful language for managing and querying relational databases, and its importance in software development cannot be overstated. By mastering SQL concepts such as database design, SQL queries, normalization, indexes, performance optimization, and transactions, you’ll not only excel in software developer interviews but also contribute to building robust and efficient database-driven applications.</p><p>Remember that SQL is a skill that improves with practice and real-world experience. Continuously honing your SQL skills will not only benefit your career but also enhance your ability to work with data effectively. So, keep querying, keep optimizing, and keep building amazing data-driven applications. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4ef5a55f3b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Key Object-Oriented Programming (OOP) Concepts in C#]]></title>
            <link>https://kevin-peery.medium.com/understanding-key-object-oriented-programming-oop-concepts-in-c-ecbc39793085?source=rss-652bd10803a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecbc39793085</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[object-oriented-design]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <dc:creator><![CDATA[Kevin Peery]]></dc:creator>
            <pubDate>Mon, 25 Sep 2023 23:17:46 GMT</pubDate>
            <atom:updated>2023-09-25T23:31:27.016Z</atom:updated>
            <content:encoded><![CDATA[<h3>Classes and Objects</h3><p>At the core of OOP in C# are classes and objects:</p><ul><li>Class: A class is a blueprint or template for creating objects. It defines the structure and behavior of objects of that class.</li><li>Object: An object is an instance of a class. It has attributes (properties) and behaviors (methods) defined by the class.</li></ul><p>Here’s an example:</p><pre>// Define a class<br>class Car<br>{<br>    public string Make;<br>    public string Model;<br><br>    public void StartEngine()<br>    {<br>        Console.WriteLine(&quot;Engine started!&quot;);<br>    }<br>}<br><br>// Create an object (instance) of the class<br>Car myCar = new Car();<br>myCar.Make = &quot;Toyota&quot;;<br>myCar.Model = &quot;Camry&quot;;<br>myCar.StartEngine();</pre><p>In this example, Car is a class, and myCar is an object of that class.</p><h3>Inheritance</h3><p>Inheritance allows you to create new classes that reuse properties and behaviors of existing classes. It establishes a hierarchy of classes, where a subclass inherits from a superclass:</p><pre>class Animal<br>{<br>    public string Name;<br>    public void Eat() { /* Eating logic */ }<br>}<br><br>class Dog : Animal<br>{<br>    public void Bark() { /* Barking logic */ }<br>}<br><br>Dog myDog = new Dog();<br>myDog.Name = &quot;Fido&quot;;<br>myDog.Eat();  // Inherited method<br>myDog.Bark(); // Dog-specific method</pre><p>In this example, Dog is a subclass of Animal, inheriting the Name attribute and Eat method from the superclass.</p><h3>Polymorphism</h3><p>Polymorphism allows objects of different classes to be treated as objects of a common base class. This promotes flexibility in method invocation, depending on the actual type of the object at runtime:</p><pre>class Shape<br>{<br>    public virtual void Draw()<br>    {<br>        // Default drawing logic<br>    }<br>}<br><br>class Circle : Shape<br>{<br>    public override void Draw()<br>    {<br>        // Circle-specific drawing logic<br>    }<br>}<br><br>Shape myShape = new Circle();<br>myShape.Draw(); // Calls Circle&#39;s Draw method</pre><p>In this example, myShape is an object of type Shape, but it references a Circle object. At runtime, the Draw method of Circle is invoked.</p><h3>Abstraction</h3><p>Abstraction is the process of hiding complex implementation details while exposing essential features. It allows you to focus on high-level aspects of an object:</p><pre>abstract class Shape<br>{<br>    public abstract void Draw(); // Abstract method with no implementation<br>}</pre><p>In this case, Shape is an abstract class with an abstract method Draw. Concrete subclasses must provide their own implementations.</p><h3>Encapsulation</h3><p>Encapsulation bundles data (attributes) and methods (functions) that operate on that data into a single unit (class). It restricts direct access to some components, providing data hiding and protecting the object’s state:</p><pre>class BankAccount<br>{<br>    private decimal balance;<br><br>    public void Deposit(decimal amount)<br>    {<br>        if (amount &gt; 0)<br>            balance += amount;<br>    }<br><br>    public decimal GetBalance()<br>    {<br>        return balance;<br>    }<br>}</pre><p>Here, balance is a private field, and methods are used to access and modify it, ensuring proper encapsulation.</p><h3>Interfaces</h3><p>Interfaces define contracts that classes must adhere to by implementing specific methods and properties. They enable multiple classes to share common functionality while allowing each class to have its own implementation:</p><pre>interface IDrawable<br>{<br>    void Draw();<br>}<br><br>class Circle : IDrawable<br>{<br>    public void Draw()<br>    {<br>        // Circle drawing logic<br>    }<br>}</pre><p>In this example, Circle implements the IDrawable interface by providing its own Draw method.</p><h3>Composition</h3><p>Composition is a principle that emphasizes building complex objects or behaviors by combining simpler objects, rather than relying solely on inheritance. It promotes flexibility and reusability by allowing you to create new classes by composing existing classes.</p><p>Here’s a brief explanation and an example of composition:</p><h4>Composition:</h4><p>Composition involves creating classes that are composed of other classes or objects as parts, and it often follows the “has-a” relationship.</p><pre>class Engine<br>{<br>    public void Start()<br>    {<br>        Console.WriteLine(&quot;Engine started.&quot;);<br>    }<br>}<br><br>class Car<br>{<br>    private Engine engine;<br><br>    public Car()<br>    {<br>        engine = new Engine();<br>    }<br><br>    public void StartCar()<br>    {<br>        engine.Start();<br>        Console.WriteLine(&quot;Car started.&quot;);<br>    }<br>}</pre><p>In this example, the Car class has a StartCar method that internally uses an Engine object. This demonstrates composition because the Car class is composed of an Engine object to achieve its functionality.</p><h3>LINQ (Language Integrated Query)</h3><p>LINQ, or Language Integrated Query, is a feature in C# that provides a powerful way to query and manipulate data within collections, databases, and other data sources. It allows you to write queries using a familiar and expressive syntax, making data manipulation more readable and maintainable.</p><p>LINQ queries are typically used with collections, such as arrays, lists, or dictionaries. Here’s a basic example of LINQ in action:</p><pre>using System;<br>using System.Linq;<br>using System.Collections.Generic;<br><br>public class LINQExample<br>{<br>    public static void Main(string[] args)<br>    {<br>        List&lt;int&gt; numbers = new List&lt;int&gt; { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };<br><br>        // Using LINQ to filter even numbers<br>        var evenNumbers = numbers.Where(n =&gt; n % 2 == 0);<br><br>        // Using LINQ to project the result into a new list<br>        var squaredNumbers = numbers.Select(n =&gt; n * n);<br><br>        Console.WriteLine(&quot;Even Numbers: &quot; + string.Join(&quot;, &quot;, evenNumbers));<br>        Console.WriteLine(&quot;Squared Numbers: &quot; + string.Join(&quot;, &quot;, squaredNumbers));<br>    }<br>}</pre><p>In this example, LINQ is used to filter even numbers and to project the numbers into their squared values. LINQ allows us to work with data in a more declarative and expressive manner.</p><h3>Reflection</h3><p>Reflection is a feature in C# that enables you to inspect and interact with the metadata and behavior of types, objects, and assemblies at runtime. It provides a way to query and manipulate classes, methods, properties, fields, and more, making it a valuable tool for tasks such as dynamic object creation, serialization, and custom attribute usage.</p><p>Here’s a basic example of how reflection can be used to inspect and interact with types:</p><pre>using System;<br>using System.Reflection;<br><br>public class ReflectionExample<br>{<br>    public static void Main(string[] args)<br>    {<br>        // Get the type of a class<br>        Type carType = typeof(Car);<br><br>        // Get public properties of the class<br>        PropertyInfo[] properties = carType.GetProperties();<br><br>        Console.WriteLine(&quot;Properties of the Car class:&quot;);<br>        foreach (var property in properties)<br>        {<br>            Console.WriteLine(property.Name);<br>        }<br><br>        // Invoke a method dynamically<br>        MethodInfo startEngineMethod = carType.GetMethod(&quot;StartEngine&quot;);<br>        Car myCar = new Car();<br>        startEngineMethod.Invoke(myCar, null);<br>    }<br>}<br><br>public class Car<br>{<br>    public string Make { get; set; }<br>    public string Model { get; set; }<br><br>    public void StartEngine()<br>    {<br>        Console.WriteLine(&quot;Engine started!&quot;);<br>    }<br>}</pre><p>In this example, reflection is used to:</p><ul><li>Get the type of the Car class.</li><li>Retrieve and display the public properties of the Car class.</li><li>Dynamically invoke the StartEngine method of the Car class.</li></ul><h3>Entity Framework</h3><p>Entity Framework (EF) is a powerful Object-Relational Mapping (ORM) framework in C# that simplifies database interactions by allowing developers to work with databases using object-oriented code. It bridges the gap between the object-oriented world of C# and the relational world of databases.</p><p>Key aspects of Entity Framework include:</p><ul><li>Entity Classes: Entity Framework allows you to define entity classes that represent database tables. These classes map database tables to C# objects.</li><li>DbContext: The DbContext class acts as the entry point to the Entity Framework. It manages the database connection, tracks changes to entities, and facilitates database operations.</li><li>LINQ Integration: Entity Framework integrates seamlessly with LINQ, enabling developers to query and manipulate data using a familiar and expressive syntax.</li></ul><p>Here’s a basic example of using Entity Framework to define an entity class and perform database operations:</p><pre>using System;<br>using System.Linq;<br>using Microsoft.EntityFrameworkCore;<br><br>// Define an entity class<br>public class Product<br>{<br>    public int Id { get; set; }<br>    public string Name { get; set; }<br>    public decimal Price { get; set; }<br>}<br><br>// Define a DbContext<br>public class AppDbContext : DbContext<br>{<br>    public DbSet&lt;Product&gt; Products { get; set; }<br>}<br><br>public class EntityFrameworkExample<br>{<br>    public static void Main(string[] args)<br>    {<br>        using (var context = new AppDbContext())<br>        {<br>            // Create a new product<br>            var product = new Product<br>            {<br>                Name = &quot;Laptop&quot;,<br>                Price = 999.99M<br>            };<br><br>            // Add the product to the database<br>            context.Products.Add(product);<br>            context.SaveChanges();<br><br>            // Retrieve and display products<br>            var products = context.Products.ToList();<br>            foreach (var p in products)<br>            {<br>                Console.WriteLine($&quot;Product: {p.Name}, Price: {p.Price:C}&quot;);<br>            }<br>        }<br>    }<br>}</pre><p>In this example, Entity Framework is used to define an entity class (Product), create a database context (AppDbContext), and perform database operations, including adding a new product and querying products using LINQ.</p><h3>CI/CD and OOP: A Synergistic Approach</h3><p>Object-Oriented Programming (OOP) principles play a vital role in modern software development, providing a foundation for building maintainable and scalable code. But how do these principles fit into the broader context of software development practices such as Continuous Integration and Continuous Deployment (CI/CD)?</p><h4>Encapsulation and CI/CD</h4><p><em>Encapsulation</em>, one of the core OOP principles, emphasizes bundling data and methods into a single unit (class). This concept aligns well with CI/CD practices, where code changes must be encapsulated within version control repositories and automated build pipelines. By encapsulating code changes, developers can ensure that new features or bug fixes are isolated, tested, and integrated smoothly into the project.</p><h4>Abstraction and CI/CD</h4><p><em>Abstraction</em> in OOP involves hiding complex implementation details while exposing essential features. Similarly, CI/CD abstracts the complexities of the deployment process by automating steps like building, testing, and deployment. Abstraction in CI/CD streamlines the process, making it more manageable and less error-prone.</p><h4>Polymorphism and CI/CD</h4><p><em>Polymorphism</em> allows objects of different classes to be treated as objects of a common base class. In CI/CD, different environments (development, staging, production) often require different configurations or settings. Polymorphism-like techniques, such as environment-specific configuration files or settings, enable code to adapt seamlessly to various deployment targets.</p><p>While this article primarily focuses on understanding OOP principles in C#, it’s essential to recognize that these principles aren’t isolated concepts. They are integral to building robust and maintainable software, whether you’re working on local development or contributing to a CI/CD pipeline. By applying OOP principles thoughtfully, you can create code that integrates smoothly into the CI/CD workflow, contributing to a more efficient and reliable software development process.</p><h3>Conclusion</h3><p>Understanding these key OOP concepts is essential for writing clean, maintainable, and extensible code in C#. Whether you’re preparing for an interview or looking to enhance your coding skills, mastering these principles will serve you well in your software development journey. Practice applying these concepts to real-world scenarios to solidify your understanding and become a proficient C# developer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecbc39793085" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Software Engineering, Technology Certifications, and Educational Achievements]]></title>
            <link>https://kevin-peery.medium.com/software-engineering-and-technology-certifications-422cceb65b77?source=rss-652bd10803a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/422cceb65b77</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[certification-courses]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Kevin Peery]]></dc:creator>
            <pubDate>Tue, 15 Mar 2022 12:14:16 GMT</pubDate>
            <atom:updated>2026-09-12T15:10:03.110Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a post to display the various software engineering and technology certifications and educational achievements that I have acquired</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rJU9QUEi0_Pj2zh0UkETzw.jpeg" /><figcaption>Bachelor of Science in Nursing (BSN) — The University of Texas at Arlington (UTA): <a href="https://catalog.uta.edu/academicregulations/graduation/#:~:text=Magna%20Cum%20Laude%20Latin%20Honors,in%20residence%20is%203.700%20%2D%203.899">https://catalog.uta.edu/academicregulations/graduation/#:~:text=Magna%20Cum%20Laude%20Latin%20Honors,in%20residence%20is%203.700%20%2D%203.899</a>)</figcaption></figure><h3><strong>Note: I am a U.S. citizen. This is for tech roles in Germany, where I am not a citizen.</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ibfDT8-1gX3ZMat9lYYOmw.png" /><figcaption>Recommendation Letter From the Imagine Foundation <strong>Note: I am a U.S. Citizen. </strong>This is for Germany.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o4PV-QkUldZ5rL5do_D3Bw.png" /><figcaption>Cybersecurity Artificial Intelligence (CS_AI) Certificate Program: Purdue University Northwest, Ivy Tech Community College, University of North Carolina-Charlotte, and University of Tennessee-Chattanooga</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pUhtHKfUjNPeEljExzIy8w.png" /><figcaption>Udacity Future AWS AI Programmer Nanodegree. Confirmation: <a href="http://www.udacity.com/certificate/e/c972ebc4-900d-11f1-8c0d-73082235e2e0"><strong>www.udacity.com/certificate/e/c972ebc4-900d-11f1-8c0d-73082235e2e0</strong></a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hryLzjIGTGKZHc_C5tPt6A.png" /><figcaption>Udacity AWS AI Practitioner Challenge. Confirmation: <a href="http://www.udacity.com/certificate/e/7070203a-27b9-11f1-ac7c-13e4574d6384"><strong>www.udacity.com/certificate/e/7070203a-27b9-11f1-ac7c-13e4574d638</strong></a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E9HQiINVFsIU8gwdjfCHQA.png" /><figcaption>Udacity Foundation of Generative AI Confirmation: <a href="http://www.udacity.com/certificate/e/8fa9bb46-b7bc-11ef-aadd-6b1fd5b36e06"><strong>www.udacity.com/certificate/e/8fa9bb46-b7bc-11ef-aadd-6b1fd5b36e06</strong></a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i3ADOq6lPU_QzCbL4o94Vw.png" /><figcaption><a href="https://www.credly.com/badges/9ec69b3d-7020-470a-b778-3e196b79742c/public_url">https://www.credly.com/badges/9ec69b3d-7020-470a-b778-3e196b79742c/public_url</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*75bQk7Z94dVVX6IKeDoriA.png" /><figcaption><a href="https://www.credly.com/badges/a797eb29-f10d-4d57-b815-8bb92c89e620/public_url">https://www.credly.com/badges/a797eb29-f10d-4d57-b815-8bb92c89e620/public_url</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N0l959OXG70Wrty8Jzbspg.png" /><figcaption>Completion of Full Stack Development Season Two with Franklin Cummings X Qwasar Silicon Valley. More information: <a href="https://qwasar.io/tech-talent-programs/full-stack-developer-program/">https://qwasar.io/tech-talent-programs/full-stack-developer-program/</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O8R9ejBViP0Mh5bkcIOkaA.png" /><figcaption>Udacity Front End Developer Nanodegree Program: confirm.udacity.com/e/4ba1ccac-c38c-11ed-ba17-a79c1fc5e06e</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XY5BR02HCtQezFrdPfZZ2g.png" /><figcaption>Hackbright and Walmart Intermediate Java and Spring Boot Software Engineering Program <a href="https://hackbrightacademy.com/walmart-x3/">https://hackbrightacademy.com/walmart-x3/</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xmh4mcCLZ-tCSC01lVVMMw.png" /><figcaption>Hackbright and Walmart Front-End JavaScript Program</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Op2-IocVozZDDZxrGU6Eyg.png" /><figcaption>LaunchCode Web Development JavaScript &amp; Java Certificate of Achievement <a href="https://www.launchcode.org/course-catalog/web-development-java">https://www.launchcode.org/course-catalog/web-development-java</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7zbJ3UCkKPWoOyWGT0oaIQ.png" /><figcaption>CompTIA A+ Certification: <a href="https://www.credly.com/badges/a7650111-2e8d-4753-a264-9e275d5a97b2/public_url">https://www.credly.com/badges/a7650111-2e8d-4753-a264-9e275d5a97b2/public_url</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zm4QD8MVC0vJBPGm0Hrnrg.png" /><figcaption>CompTIA Security+ ce Certification: <a href="https://www.credly.com/badges/0f767056-a849-49d6-8c47-2c081d48b7e2/public_url">https://www.credly.com/badges/0f767056-a849-49d6-8c47-2c081d48b7e2/public_url</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DEccw8nrek-WCjLmvM6yoQ.png" /><figcaption>Qwasar Silicon Valley Introduction to Fullstack Development <a href="https://qwasar.io/tech-talent-programs/full-stack-developer-program/">https://qwasar.io/tech-talent-programs/full-stack-developer-program/</a> Certificate Verification: <a href="https://upskill.us.qwasar.io/certificates/MTM0Ni1wZWVyeV9rLWp1bC0yMDIxLTMwLWQ3N2Q=">https://upskill.us.qwasar.io/certificates/MTM0Ni1wZWVyeV9rLWp1bC0yMDIxLTMwLWQ3N2Q=</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-EIjBzMH7oVpz4Dqs-bSoA.png" /><figcaption>Qwasar Silicon Valley Introduction to Fullstack Development <a href="https://qwasar.io/tech-talent-programs/full-stack-developer-program/">https://qwasar.io/tech-talent-programs/full-stack-developer-program/</a> Certificate Verification: <a href="https://upskill.us.qwasar.io/certificates/MTIwMy1wZWVyeV9rLW1hci0yMDIxLTExLTk0ZGM=">https://upskill.us.qwasar.io/certificates/MTIwMy1wZWVyeV9rLW1hci0yMDIxLTExLTk0ZGM=</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dBfM9vC0RaqLlcWE6o2P1g.png" /><figcaption>Java Developer Nanodegree Program through Udacity <a href="https://www.udacity.com/course/java-programming-nanodegree--nd079">https://www.udacity.com/course/java-programming-nanodegree--nd079</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3sg1q9ggeKR_ocgaLE-TwQ.png" /><figcaption>Udacity Front End Developer</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yBL2Jly2iUuvqQkr2o_wZQ.png" /><figcaption>Software Engineering Bootcamp Certificate from the Flatiron School</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5D8j_LEZdAocK1_t1alhdA.png" /><figcaption>Software Engineering Bootcamp at the University of Utah: <a href="https://www.credly.com/badges/10b60bc6-8859-43fe-a489-1f5ab931afae/public_url">https://www.credly.com/badges/10b60bc6-8859-43fe-a489-1f5ab931afae/public_url</a> (direct Credly link to the certificate)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fd4ONzbs4znW4nObhXHxKw.jpeg" /><figcaption>Software Engineering Bootcamp Certificate from the University of Utah</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d5GgFHAUAFXFe86HJU3i_A.png" /><figcaption>Cloud Native Development Training Program through Galvanize</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8WqvXchvIQgl7hRFb49Q8g.png" /><figcaption>Udacity Java Programming Basics Certificate</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fqbYTi6lZlOIaruamYTD_w.png" /><figcaption>Cloud DevOps Engineer Nanodegree Program through Udacity</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t5-J85QpEVSd9tYRIgDYLw.png" /><figcaption>Google IT Support Professional Certificate</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zf5vbrDNMbu0SuTBROO_DQ.png" /><figcaption>Udacity AWS Machine Learning Foundations</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJj1yPlnA-15bHcyz5uuGw.png" /><figcaption>AWS Machine Learning Foundations 2022</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*24zBM7szWwQXG5Vo0BVcLA.png" /><figcaption>A Cloud Guru Introduction to AWS</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FrMh9gU8pfb2s6i60r-bdQ.png" /><figcaption>A Cloud Guru Introduction to Cloud Computing</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=422cceb65b77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Overview of Next-Generation JavaScript Features for React Apps]]></title>
            <link>https://medium.com/better-programming/an-overview-of-next-generation-javascript-features-for-react-apps-4b8957248fe7?source=rss-652bd10803a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b8957248fe7</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Kevin Peery]]></dc:creator>
            <pubDate>Sun, 01 Sep 2019 22:02:30 GMT</pubDate>
            <atom:updated>2019-09-15T16:30:31.414Z</atom:updated>
            <content:encoded><![CDATA[<h4>Next-generation JavaScript uses arrow functions, let, const,<strong> </strong>and<strong> </strong>other updated syntax</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s5T6qv42SGLLK_pUhhDP6w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@priscilladupreez?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Priscilla Du Preez</a> on <a href="https://unsplash.com/search/photos/next-generation?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Next-generation JavaScript could be thought of as the latest version of ECMAScript, the standardized specification for JavaScript.</p><p>Each version endeavors to improve upon and add new functionality to this increasingly popular programming language. JavaScript has taken over the world of software development.</p><p>According to <a href="https://codeburst.io/10-top-programming-languages-in-2019-for-developers-a2921798d652">Codeburst.io</a>, JavaScript is the top programming language for developers. It was recognized as the most popular programming language in the Stack Overflow Developer Survey 2019 and it is the most popular programming language on GitHub.</p><p>Needless to say, JavaScript is a key language for software developers to know.</p><p><a href="https://insights.stackoverflow.com/survey/2019#most-popular-technologies">Stack Overflow Developer Survey Results 2019:</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xQyKZUyAsPn_CNAKgA_6lg.png" /><figcaption>Source: <a href="https://insights.stackoverflow.com/survey/2019#most-popular-technologies">https://insights.stackoverflow.com/survey/2019#most-popular-technologies</a></figcaption></figure><p>Next-generation JavaScript uses arrow functions, let, const,<strong> </strong>and<strong> </strong>other updated syntax. Modern React apps typically use these updated features of the JavaScript language.</p><h3><strong>let and const</strong></h3><p>With ECMAScript 2015, the ES6 version of JavaScript, two new keywords were introduced in JavaScript, let and const.</p><p>These keywords replaced the previous var keyword, which defines a variable globally. The scope of the var variable is the entire enclosing function.</p><p>Variables declared by let have their scope in the block for which they are defined, as well as in any contained sub-blocks. In next-generation JavaScript, let and const replace var.</p><p>However, const is used if you plan on never re-assigning this “variable”.</p><h3><strong>Arrow Functions</strong></h3><p>Arrow functions are a different way of creating functions in JavaScript. Aside from having a shorter syntax, they offer advantages when it comes to maintaining the scope of the this keyword.</p><p>According to <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#No_binding_of_this">Mozilla</a>:</p><blockquote>“An arrow function does not have its own this. The this value of the enclosing lexical scope is used; arrow functions follow the normal variable lookup rules. So, while searching for this which is not present in current scope, an arrow function ends up finding the this from its enclosing scope.”</blockquote><p>In the following code, the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#No_binding_of_this">this within the function</a> that is passed to setInterval has the same value as the this in the lexically enclosing function:</p><pre>function Person(){<br>  this.age = 0;<br><br>  setInterval(() =&gt; {<br>    this.age++; // |this| properly refers to the Person object<br>  }, 1000);<br>}<br><br>var p = new Person();</pre><pre>function callMe(name) {</pre><pre>    console.log(name);</pre><pre> }</pre><pre>const callMe = function(name) {</pre><pre>     console.log(name);</pre><pre> }</pre><pre>becomes:</pre><pre> const callMe = (name) =&gt; {</pre><pre>     console.log(name);</pre><pre> }</pre><pre><strong>Important:</strong></pre><pre>When there are no arguments, use empty parentheses in the function declaration:</pre><pre> const callMe = () =&gt; {</pre><pre>     console.log(&#39;Kevin!&#39;);</pre><pre> }</pre><pre>When there is only one argument, you may omit the parentheses around the argument:</pre><pre> const callMe = name =&gt; {</pre><pre>     console.log(name);</pre><pre> }</pre><pre>If there are two or more arguments, then you need to include the parentheses around the arguments: </pre><pre> const callMe = (name, age) =&gt; {</pre><pre>    console.log(name, age);</pre><pre>}</pre><pre>When just returning a value, you can use this shortcut, which removes the curly braces and the return keyword: </pre><pre> const returnMe = name =&gt; name</pre><pre>The above is the same as:</pre><pre> const returnMe = name =&gt; {</pre><pre>     return name;</pre><pre> }</pre><h3><strong>Imports and Exports</strong></h3><p>In React and all modern JavaScript projects following best practices, the convention is to split code across multiple JavaScript files called modules. This is done to adhere to the <a href="https://en.wikipedia.org/wiki/Single_responsibility_principle">single responsibility principle</a> while keeping each file and module manageable.</p><p>To access the code in another file, you must export it using the export keyword and import it into the receiving file using import statements.</p><p>As React is simply a JavaScript library, its pattern is similar, where components are transferred using import and export statements.</p><p><a href="https://reactjs.org/docs/components-and-props.html">Components</a> let you split the UI into independent, reusable pieces and think about each piece in isolation. There are two types of exports, default (unnamed) and named exports:</p><pre><strong>default</strong> =&gt; export default ...;</pre><pre><strong>named</strong> =&gt; export const someData = ...;</pre><pre>Default exports can be imported this way: </pre><pre>import chosenName from &#39;./path/to/file.js&#39;;</pre><pre>chosenName is something that you simply choose. </pre><pre><strong>Named</strong> exports must be imported explicitly by their name:</pre><pre>import { someData } from &#39;./path/to/file.js&#39;;</pre><p>While a file can only contain one default export, the number of named exports are unlimited. A single default export can also be combined with any number of named exports in the same file.</p><pre><strong>named</strong> exports can be imported cumulatively with the following syntax:</pre><pre>import * as nameYouPick from &#39;./path/to/file.js&#39;;</pre><pre>nameYouPick is a name you come up with. It bundles all exported variables and functions into a simple JavaScript object. If you<br>  <br>export const someData = ... (/path/to/file.js )<br> <br>That import can be accessed using nameYouPick, much like you would access any other value on a JavaScript object: nameYouPick.someData </pre><h3><strong>Classes</strong></h3><p>Classes are comparable to constructor functions. They are used to define blueprints for the creation of JavaScript objects. Classes are used by React to create components.</p><pre> class Person {</pre><pre>     constructor () {</pre><pre>         this.name = &#39;Kevin&#39;;</pre><pre>     }</pre><pre>  }</pre><pre>//here we are instantiating the Person class</pre><pre> const person = new Person();</pre><pre> console.log(person.name); // prints &#39;Kevin&#39; to the console</pre><p>In the above example, both the class and a property of that class, this.name, are specifically defined. This is the older ECMAScript approach to defining properties.</p><p>In modern JavaScript projects using the next-generation features, the simpler way of defining class properties is as follows, omitting the explicit property definition referencing this.name:</p><pre> class Person {</pre><pre>     name = &#39;Kevin&#39;;</pre><pre> }</pre><pre> const person = new Person();</pre><pre> console.log(person.name); // prints &#39;Kevin&#39;</pre><h3><strong>Classes and Defining Methods</strong></h3><pre><strong>Option 1:</strong></pre><pre> class Person {</pre><pre>     name = &#39;Kevin&#39;;</pre><pre>     printMyName () {</pre><pre>         console.log(this.name); <br>// &#39;<strong>this</strong>&#39; is required to refer to the class</pre><pre>     }</pre><pre> }</pre><pre> const person = new Person();</pre><pre> person.printMyName();</pre><pre><strong><br>Option 2:</strong></pre><pre> class Person {</pre><pre>     name = &#39;Kevin&#39;;</pre><pre>     printMyName = () =&gt; {</pre><pre>         console.log(this.name);</pre><pre>     }</pre><pre> }</pre><pre> const person = new Person();</pre><pre> person.printMyName();</pre><p>Note: The second approach, option two, has the advantage that comes with the use of arrow functions and binding: The |this| keyword does not change its reference.</p><p>The arrow function <em>does not</em> bind its own this<em>. </em>Instead<em>, </em>arrow functions <em>lexically</em> bind their context, so this actually refers to the originating context.</p><p>In the case above, this refers to the Person class as the Person class is the originating context. When you use this in an arrow function, it will maintain its context and not suddenly change it on runtime.</p><p>When not using arrow functions, the bind() method must be used to explicitly bind |this| to the class.</p><p>The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Function/bind">bind() method</a> creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called:</p><pre>var module = {<br>  x: 40,<br>  getX: function() {<br>    return this.x;<br>  }<br>}</pre><pre>var unboundGetX = module.getX;<br>console.log(unboundGetX()); // The function gets invoked at the <strong>global</strong> scope<br>// expected output: undefined</pre><pre>var boundGetX = unboundGetX.bind(module);<br>console.log(boundGetX());<br>// expected output: 40</pre><h3><strong>Classes and Inheritance</strong></h3><p>Inheritance in JavaScript is comparable to <a href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Object_prototypes">prototypes</a>, the mechanism with which JavaScript objects inherit features from one another.</p><pre> class Human {</pre><pre>     species = &#39;human&#39;;</pre><pre> }</pre><pre>//The extends keyword is used to inherit from the above Human class, which is known as the Parent class.</pre><pre> class Person extends Human {</pre><pre>     name = &#39;Kevin&#39;;</pre><pre>     printMyName = () =&gt; {</pre><pre>         console.log(this.name);</pre><pre>     }</pre><pre> }</pre><pre> const person = new Person();</pre><pre>person.printMyName();<br>console.log(person.species); // prints &#39;human&#39;</pre><h3><strong>Spread and Rest Operator</strong></h3><p>The spread and rest operators both use the same triple period syntax: …</p><p>The application determines whether you’re using it as the spread or as the rest operator. The rest operator is used to merge a list of function arguments into an array.</p><p>Conversely, the spread operator allows you to pull elements out of an array or pull the properties out of an object. Below are two examples to demonstrate the spread operator:</p><pre>const oldArray = [1, 2, 3];</pre><pre>const newArray = [...oldArray, 4, 5]; // The newArray is now [1, 2,</pre><pre>3, 4, 5];</pre><pre>The spread operator used on an object:</pre><pre> const oldObject = {</pre><pre>     name: &#39;Kevin&#39;</pre><pre> };</pre><pre> const newObject = {</pre><pre>     ...oldObject,</pre><pre>     gender: &#39;Male&#39;</pre><pre> };</pre><pre>newObject would then be</pre><pre> {<br>    name: &#39;Kevin&#39;,</pre><pre>    gender: &#39;Male&#39;<br> }</pre><p>The spread operator is useful for cloning both arrays and objects. Both are reference types rather than primitives. This means that, if they are reassigned, the pointer, rather than the value, is copied.</p><p>If you want to truly make a copy, a new object should be created with only the properties rather than the entire being copied. Copying reference types safely while eliminating side-effects, or alterations of the copied original, can be problematic.</p><p>The spread operator avoids these potential side-effects by providing a concise and easy way to create a shallow clone of the object or array.</p><p>An example using the rest operator:</p><pre>const filter = (...args) =&gt; args.filter(el =&gt; el === 1);</pre><pre>console.log(filter(1, 2, 3)); // [1]</pre><p>In the above example, the … used as a rest operator is merging the arguments into an array. The filter() method will execute a function on every element in the passed-in array.</p><p>The filter() method will then return a true or false boolean if the element is equal to 1. In JavaScript === (three equal signs) checks for type and value equality so that el must also be a number.</p><h3><strong>Destructuring</strong></h3><p>Destructuring allows for easy access to the values of arrays or objects for the purpose of assigning them to variables.</p><p>Spread takes out all elements or all properties and distributes them in a new array or object. Destructuring allows you to pull out single elements or properties and store them in variables for both arrays and objects.</p><pre>Array Destructuring:</pre><pre> const array = [1, 2, 3];</pre><pre> const [a, b] = array;</pre><pre> console.log(a); // prints 1</pre><pre> console.log(b); // prints 2</pre><pre> console.log(array); // prints [1, 2, 3]<br></pre><pre>Object Destructuring:</pre><pre> const myObj = {</pre><pre>     name: &#39;Kevin&#39;,</pre><pre>     gender: &#39;Male&#39;</pre><pre> }</pre><pre> const {name} = myObj;</pre><pre> console.log(name); // prints &#39;Kevin&#39;</pre><pre> console.log(gender); // prints undefined</pre><pre>console.log(myObj); // prints {name: &#39;Kevin&#39;, gender: &#39;Male&#39;}</pre><pre>Destructuring is very useful when working with function</pre><pre>arguments. Consider this example:</pre><pre> const printName = (personObj) =&gt; {</pre><pre>     console.log(personObj.name);</pre><pre> }</pre><pre>printName({name: &#39;Kevin&#39;, gender: &#39;Male&#39;}); // prints &#39;Kevin&#39;</pre><pre>Here, we only want to print the name in the function but we pass a complete person object to the function. This is not a problem, but it forces us to call personObj.name inside of our function. </pre><pre>We can condense this code with destructuring:</pre><pre> const printName = ({name}) =&gt; {</pre><pre>     console.log(name);</pre><pre> }</pre><pre>printName({name: &#39;Kevin&#39;, gender: &#39;Male&#39;}); // prints &#39;Kevin&#39;)</pre><p>After applying object destructuring, we get the same result as that of the example above, while decreasing the amount of code typed.</p><p>By destructuring, we simply pull out the name property and store it in a variable/argument, called name, which can then be used in the function body.</p><p>Hopefully, these next-generation JavaScript features prove to be useful in creating both Vanilla JavaScript and single-page React apps.</p><h3>Sources</h3><ul><li><a href="https://www.udemy.com/share/1000uMAkEedV1TQ3Q=/?xref=E0AZdFpRRHoJSUQvCz0GJVUWTx4dChQ%2BVFE=">React 16: The Complete Course (incl. React Router 4 &amp; Redux)</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">Classes - JavaScript | MDN</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#No_binding_of_this">Arrow functions</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions">Functions - JavaScript | MDN</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Object_prototypes">Object prototypes - Learn web development | MDN</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Function/bind">Function.prototype.bind() - JavaScript | MDN</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b8957248fe7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/an-overview-of-next-generation-javascript-features-for-react-apps-4b8957248fe7">An Overview of Next-Generation JavaScript Features for React Apps</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[State Changes in React]]></title>
            <link>https://kevin-peery.medium.com/state-changes-in-react-77000c2f625f?source=rss-652bd10803a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/77000c2f625f</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Kevin Peery]]></dc:creator>
            <pubDate>Sun, 02 Jun 2019 22:03:44 GMT</pubDate>
            <atom:updated>2019-12-07T09:28:38.177Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the most important things to remember about using state properly in React is to always avoid changing state directly. For example, you would not do the following:</p><p>this.state.comment = &#39;Hey!&#39;; this is really wrong!</p><p>this.setState({comment: &#39;Hey!&#39;}); this is how you do it!</p><p>this.state can only be assigned in the constructor like so:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/17e44d0f5225097603e1c23bcd65b18a/href">https://medium.com/media/17e44d0f5225097603e1c23bcd65b18a/href</a></iframe><h3>Since state updates may be asynchronous,</h3><p>React may batch multiple setState() calls into a single update for performance. Therefore, their values are unreliable for calculating the next state. Due to this limitation, we can use another form of setState() that accepts a function rather than an object as shown below. The function arguments passed in are 1.) the previous state and 2.) the props at the time the update is applied:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/646ac45f292d637efff07f7592a2e90f/href">https://medium.com/media/646ac45f292d637efff07f7592a2e90f/href</a></iframe><h3>State Updates are Merged</h3><p>When setState() is called, React merges the object provided into the current state. The below code shows how state is updated when it contains more than one independent variables. In this example we have the state set to two independent empty array variables, posts and comments:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e4f166653861116c3d9bfc09e1809c1a/href">https://medium.com/media/e4f166653861116c3d9bfc09e1809c1a/href</a></iframe><p>What’s happening above is a shallow merge where this.setState({comments}) does not alter this.state.posts, but instead completely replaces this.state.comments. this.setState() is updating each independent state variable individually so that it does not alter the other.</p><h3>One-Way Data Flow in React</h3><p>Parents and child components are unaware if a certain component is stateful or stateless, and since it is local to the component, it is only accessible to the one that both owns and sets it. The way to get the state to a component’s children is to pass it down as props. This unidirectional data flow is a key attribute of React where the parent component owns and alters the state, while the children of that component, which lie below the parent in the component tree, can receive the state as props. The children can not reach up into the parent component to alter state. Instead, they receive the state from the parent component as props or properties. Props in React are never modified by the component and must act like pure functions with respect to their props. This means that all functions related to props must not attempt to change their inputs, and always return the same result for the same inputs. That is the essence of a “pure” function. In addition, the state of the parent component only impacts those components which are below it in the state tree hierarchy.</p><h3>React Controlled Components</h3><p>In React, mutable state is typically kept in the state property of components and is only updated with <a href="https://reactjs.org/docs/react-component.html#setstate">setState()</a>. A controlled form is a form that derives its input values from state. In the code below, we are explicitly setting the value of the component and are updating that value in response to changes the user makes. I am setting value={this.state.name}on line 39 and value={this.state.checked}on line 44. The onChange event handler is referencing the handleChange function, which updates state through this.setState(), setting the name to the value of what the user typed in the input. Notice that the onChange event handler onChange={this.handleChange} is written in a similar syntax as a React prop. I am initially setting the name property on the state to an empty string. When the user enters something into the input, that value is captured and set as the new state through the handleChange arrow function and this.setState(), which triggers a re-render. <a href="https://medium.com/@kevin.peery/event-handling-and-management-in-react-c2a34779a15d">Reference <strong>binding</strong> and <strong>this</strong> from my previous blog post</a>. In my controlled component below, with regard to the submitted form, the whole state object is simply the controlled form data. This entire object is sent via a POST request to the back end. All of the controlled inputs, which comprise state value, within the &lt;form&gt; tags are sent by the handleSubmit function to the backend through the POST request as demonstrated in the below code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ae954b6c71a32cbbb6997322afe91b53/href">https://medium.com/media/ae954b6c71a32cbbb6997322afe91b53/href</a></iframe><ul><li><a href="https://reactjs.org/docs/state-and-lifecycle.html#state-updates-may-be-asynchronous">State and Lifecycle - React</a></li><li><a href="https://learn.co/tracks/full-stack-web-development-v7/react/forms/forms-lab">React Forms - Learn.co</a></li><li><a href="https://www.sitepoint.com/video-introducing-one-way-data-flow/">Video: Introducing One-Way Data Flow - SitePoint</a></li><li><a href="https://reactjs.org/docs/forms.html">Forms - React</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77000c2f625f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Event Handling and Management in React]]></title>
            <link>https://kevin-peery.medium.com/event-handling-and-management-in-react-c2a34779a15d?source=rss-652bd10803a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2a34779a15d</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Kevin Peery]]></dc:creator>
            <pubDate>Sun, 02 Jun 2019 14:40:40 GMT</pubDate>
            <atom:updated>2019-06-03T11:52:37.730Z</atom:updated>
            <content:encoded><![CDATA[<p>Although handling events with React Elements is much like handling events on DOM elements, there are unique differences with React’s approach to altering the user interface (UI). React has a special wrapper called <a href="https://reactjs.org/docs/events.html">SyntheticEvent</a> that forms part of its Event System. It promotes cross-browser compatibility and makes it easier on both developers and users by reducing inconsistencies across various browsers. The familiar stopPropagation() and preventDefault() methods seen in JavaScript remain relevant in React’s event system. Event handlers in React are attached to elements with a similar syntax observed in adding and passing down props through React components. The way to write a handler is to use on as the prefix and camelCase it with the event name suffix as demonstrated below with the onFocus event handler:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f4622ad98c2578cd2719f2796f1d2b91/href">https://medium.com/media/f4622ad98c2578cd2719f2796f1d2b91/href</a></iframe><p><a href="https://github.com/kevinptx/react-event-system-lab-online-web-sp-000/blob/solution/src/components/EyesOnMe.js">kevinptx/react-event-system-lab-online-web-sp-000</a></p><p>Notice in the code above we have the prop called onFocus on line 11 that is passed a function reference rather than executing the onFocus function. Unlike with vanilla JavaScript and HTML, which passes event handlers as <strong>strings</strong>, you pass a <strong>function</strong> as the event handler with React’s JSX syntax.</p><p>Below is how the event would be handled on DOM elements:</p><pre>&lt;button onfocus=&quot;onFocus()&quot;&gt;<br>  On Focus<br>&lt;/button&gt;</pre><p><strong>The React way:</strong></p><pre>&lt;button onFocus=<strong>{onFocus}</strong>&gt;<br>  on Focus<br>&lt;/button&gt;</pre><p>We are not writing onFocus(). The () at the end of the function would invoke it. Of special significance is that we are binding our onFocus() and onBlur() methods to <strong>this</strong> using an arrow function to avoid creating a new scope. This binding can also be accomplished using the ES5 approach as seen below, but I prefer using the updated ES6 binding method with arrow functions, which take care of the binding for you. As shown above, the similarity in syntax between passing JSX attributes as a props object and referencing an event handler is obvious.</p><p>Below is the more antiquated ES5 approach to binding <strong>this</strong>:</p><pre>this.onFocus = this.onFocus.bind(this); </pre><pre>this.onBlur = this.onBlur.bind(this);</pre><p>The binding is necessary to make this work in the callback. It is a general rule that if you refer to a method without () after it, such as onFocus={this.onFocus}, you should bind that method, either by using arrow functions (preferred) or by using the older ES5 technique of .bind(this) .</p><p>There is a complete list of <a href="https://reactjs.org/docs/events.html#supported-events">supported events</a> in the React documents, but some of the more common ones include: onKeyUp, onMouseDown, onFocus, andonSubmit</p><p>In React, <a href="https://reactjs.org/docs/events.html">SyntheticEvent</a> allows us to to take advantage of something called event pooling, which is a technique to improve our app’s performance. <em>Event pooling means that whenever an event fires, its event data, which is the form of an object, is sent to the callback. The object is then immediately cleaned up for later use.</em></p><p>Read more here on event pooling: <a href="https://learn.co/tracks/full-stack-web-development-v7/react/events/events-in-detail">https://learn.co/tracks/full-stack-web-development-v7/react/events/events-in-detail</a></p><h3>Updating State in React</h3><p>The purpose of having an event is usually to update state. We do not directly modify the state using this.state but instead, use this.setState() , which allows React to know that there has been an update in the component state in order to cause a re-render. An object is passed into this.setState() and is merged with the current state. Once state is updated, a re-render is triggered on the component. In order to deeply merge the current state with the object passed into this.setState() , we can use the spread operator to ‘decompose’ the object. (Note: the spread operator can also be used on arrays.) The spread operator is the updated ES6 approach to decompose the object vs the older ES5 method of using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign">Object.assign({}, obj)</a>. I will demonstrate this in an example below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/863554fb383f3e01f744fa80ac5128af/href">https://medium.com/media/863554fb383f3e01f744fa80ac5128af/href</a></iframe><p>What’s happening in the above code?</p><p>...this.state.addressInfo returns all the keys and values from within the addressInfo object. By using the JavaScript spread syntax, we are maintaining all of the keys and values that make up the addressInfo object from the top level key of street to the last key of country , along with all of the associated values of those keys. In addition, we are adding the city key with the new value Houston . If there already happens to be a city key inside addressInfo, it will be overwritten with the new one we are providing, which in our case is Houston, and if it did not exist, then it will be added.</p><p>See more: <a href="https://learn.co/tracks/full-stack-web-development-v7/react/events/updating-state">https://learn.co/tracks/full-stack-web-development-v7/react/events/updating-state</a></p><h3>Differences between State Changes and Prop Changes</h3><p>There are key differences between changes in state and changes in props. Changes in both similarly trigger a re-render of the React component as a change signifies an update in the UI (user interface). Components can change their own internal state, so changes can only happen internally. While a component can change its own state, it cannot change its own props. Prop changes are external rather than internal and happen when the grandparent or parent component changes the values to then pass down to their children components. I will cover this in greater detail in a subsequent blog post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2a34779a15d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>