<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sydney Andre</title>
    <description>The latest articles on DEV Community by Sydney Andre (@saandre0217).</description>
    <link>https://dev.to/saandre0217</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1140164%2F4c714c0f-0ac9-49bb-98d9-3d87c0e31027.jpeg</url>
      <title>DEV Community: Sydney Andre</title>
      <link>https://dev.to/saandre0217</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saandre0217"/>
    <language>en</language>
    <item>
      <title>React's useReducer Hook</title>
      <dc:creator>Sydney Andre</dc:creator>
      <pubDate>Mon, 03 Jun 2024 19:32:33 +0000</pubDate>
      <link>https://dev.to/saandre0217/reacts-usereducer-hook-1pno</link>
      <guid>https://dev.to/saandre0217/reacts-usereducer-hook-1pno</guid>
      <description>&lt;p&gt;I am working on creating a customer intake form for a local bicycle repair shop. The form includes sections where the customer can input their contact information, details about the bike, and check off which services they need to schedule. &lt;/p&gt;

&lt;p&gt;The primary goal is to ensure all of the components I create are as reusable and customizable as possible. In this post I will explain how I set up this form so that there is no need to make any changes to the components if a question on the form needs to be updated or added. The only aspect that will need to be updated is the data imported into the components.&lt;/p&gt;

&lt;p&gt;While planning, I determined the contact and bike information would need text inputs, and the services would need checkbox inputs. Because the checkbox input would produce a boolean value and the text would produce a string, their event handling functionality would be different, so I  planned to create a component for each input type. &lt;/p&gt;

&lt;p&gt;I realized there would be many state changes occurring through events in the child components, but I needed state to be managed at the parent most component. At first, I was not exactly sure how to handle this, but after some research I found the React hook, useReducer.&lt;/p&gt;

&lt;p&gt;This hook allows you to add a reducer function to your component which helps to consolidate the state update logic outside of your component in a single function. Just like when initializing useState, you would call the hook at the top level of your parent component. In this example, that is Form.jsx. useReducer takes in 2 parameters: a reducer function and the initial state of the component. It returns the updated state and a dispatch function that uses the reducer to make updates to the state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const Parent = () =&amp;gt; {
const [state, dispatch] = useReducer(reducer, initialState)
...
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  useReducer Arguments
&lt;/h2&gt;

&lt;p&gt;Let’s look a little closer at what this reducer argument is made up of. The reducer function takes in the current state and an action object. The action object typically has a property named ‘type’ that is used to define the action that is taken on the state. Additionally, the action object can have additional properties. In the example below, it also has a ‘key’ property and a newValue property.&lt;/p&gt;

&lt;p&gt;The reducer function is often made up of a switch case that is dependent on the type property on the action object. Based on the type that is being passed in, a defined action is taken on the state. In the example below, if the type is ‘add_text’, then the state is returned with a new value at the key defined by the action object.&lt;/p&gt;

&lt;p&gt;The reducer function can be defined within your component or outside and imported in. In this example it is defined as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const reducer = (state, action) =&amp;gt; {
   switch(action.type) {
       case 'add_text': {
           return {
               ...state,
               [action.key]: action.newValue
           }
       }
       case 'change_boolean': {
           return {
               ...state,
               [action.key]: !state[action.key]
           }
       }
   }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example the initial state is an object named allQuestions which is defined outside of the component and imported in. It is in the exact shape the backend expects so that all of the data points can be added to the database on submission. &lt;/p&gt;

&lt;h2&gt;
  
  
  What useReducer Returns
&lt;/h2&gt;

&lt;p&gt;Now that we understand what arguments need to be passed into the useReducer, let’s look at what the hook returns and how it is used to help manage the state.&lt;/p&gt;

&lt;p&gt;useReducer returns the dispatch function which allows you to update state and trigger a rerender. An action object is the only argument that needs to be passed into the dispatch function. This object will include the properties that were used in the reducer function, for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dispatch({
       type:'add_text',
       key: someKeyName,
       newValue: someNewValueName
   })

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would be similar to the setState function that is returned when using useState. Also similar to useState, the new state with the appropriate updates made is returned when dispatch is called.&lt;/p&gt;

&lt;h2&gt;
  
  
  In Action
&lt;/h2&gt;

&lt;p&gt;Now let’s see this in action! First, I defined two event handling functions that wrap the dispatch function. The reason for this is to be able to pass in values to the action object. This is important for reusability. This way I can pass in the state property that needs to be updated, as well as, the new value of that property when the type is ‘add_text’&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const handleAddedText = (e, key) =&amp;gt; {
   dispatch({
       type:'add_text',
       key: key,
       newValue: e.target.value
   })
}


const handleCheckBoxChange = (key) =&amp;gt; {
   dispatch({
       type:'change_boolean',
       key: key
   })
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These functions are then passed down to &lt;code&gt;TextInputList.jsx&lt;/code&gt; and &lt;code&gt;CheckboxInputList.jsx&lt;/code&gt; from &lt;code&gt;From.jsx&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To manage the questions that will make up the form, I created an array of objects with the necessary question information for each input. I imported the respective question data arrays into each List component to map through and return the Input component which takes the event handler function passed down originally from Form.jsx, as well as the question data. Let’s look at the CheckboxInputList component for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import React from 'react';
import { CheckBoxInput } from './checkboxInput';
import { checkBoxLabels as cbLabelObjArr }  from '../formQuestionData';

export const CheckBoxForm = ({ handleCheckBoxChange }) =&amp;gt; {
   return (
       &amp;lt;div&amp;gt;{cbLabelObjArr.map((obj, i) =&amp;gt; (
           &amp;lt;CheckBoxInput
               key={i}
               label={obj.label}
               dbName={obj.dbName}
               handleCheckBoxChange={handleCheckBoxChange}
           /&amp;gt;
       ))}&amp;lt;/div&amp;gt;
   )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let’s check out how the CheckBoxInput component is set up:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';

export const CheckBoxInput = ({ key, label, dbName, handleCheckBoxChange }) =&amp;gt; {

return (
       &amp;lt;div &amp;gt;
           &amp;lt;div&amp;gt;{label}&amp;lt;/div&amp;gt;
           &amp;lt;input
               type='checkbox'
               onChange={() =&amp;gt; handleCheckBoxChange(dbName)}
           /&amp;gt;
       &amp;lt;/div&amp;gt;
   )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's it! Now, we have successfully utilized the useReducer hook to organize event handling across multiple components, and created highly flexible components. Throughout this process I became very familiar and confident in using the useReducer hook and created highly reusable components that will ensure the client has flexibility to update their form as needed.&lt;/p&gt;

&lt;p&gt;For more information and details check out &lt;a href="https://react.dev/reference/react/useReducer"&gt;React's useReducer documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>react</category>
      <category>tutorial</category>
      <category>javascript</category>
      <category>usereducer</category>
    </item>
    <item>
      <title>Introduction to Using Django</title>
      <dc:creator>Sydney Andre</dc:creator>
      <pubDate>Wed, 27 Dec 2023 17:47:39 +0000</pubDate>
      <link>https://dev.to/saandre0217/introduction-to-using-django-1a9i</link>
      <guid>https://dev.to/saandre0217/introduction-to-using-django-1a9i</guid>
      <description>&lt;p&gt;In this article, I will explain the basics of what Python's Django is, how it is used, and its benefits and pitfalls. As a primarily SERN stack developer, I was interested in exploring Django because of its all encompassing nature. There are a handful of JavaScript libraries and/or frameworks you would need in your stack to make up the functionality offered by Django, but with built in functionality comes trade offs, so let's dive in!&lt;/p&gt;

&lt;h2&gt;
  
  
  About Django
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How it started&lt;/strong&gt;&lt;br&gt;
Django was built out of necessity by developers at World Online, an online newspaper in Lawrence, Kanasas, in 2003 and released in 2005. Developers, Adrian Holovaty and Simon Willison, created Django (pronounced &lt;strong&gt;JANG&lt;/strong&gt;-oh) because World Online was responsible for building complex web applications on very short, journalism turn arounds. To keep up, they began to extract a generic framework from their previously build applications, and so Django was born.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it is&lt;/strong&gt;&lt;br&gt;
Django is an open source, full stack web development framework that follows an Model-View-Template (MVT) Framework. It provides features to build out both front and back end application components, utilizing SQLite for its DBMS and ASGI or WSGI for server options. It promises to make building website faster, safer, more scalable, and more versatile, and touts it is the web framework for perfectionists with deadlines. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Framework&lt;/strong&gt;&lt;br&gt;
Its MVT framework confuses many as it appears to be a renamed version of the classic MVC, but Django details the difference explaining that they interpret the “view” to describe &lt;em&gt;which&lt;/em&gt; data gets presented to the user, not what &lt;em&gt;how&lt;/em&gt; the data is presented, leaving the how as the responsibility of the "template". The "model" functions similarly to what you would expect. It is where data is provided from the database using an ORM that is built into Django. Some may still ask, where the controller fits into the picture, and they explain that the framework itself acts as the controller through the URL configuration. &lt;/p&gt;

&lt;p&gt;Now that we have an understanding of the framework's structure, take a look at the below diagram for a visual understanding of how data is passed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9jj8fb350rd2tamko9p3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9jj8fb350rd2tamko9p3.png" alt="Django data flow" width="713" height="503"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Image source: &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Introduction"&gt;https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Introduction&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Just as in other frameworks, this structure dictates the project and application file make up. A Django directory is made up of an overall project directory with one or more app directories included within the project. They delineate the difference between a project and apps describing apps as web applications that "do something" and projects as the larger container that houses multiple apps. This allows be continued reusability of code by separating functionality. &lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits and Pitfalls
&lt;/h2&gt;

&lt;p&gt;Python comes with many out of the box features like authentication, database connection, ORM, and database admin interface to name a few. In addition to these features, it is also known for its in-detail documentation and robust community. Because of this, it has gotten a reputation for being a go to choice for beginners and database driven sites, but that does not mean it doesn't come with its own set of downfalls. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits&lt;/strong&gt;&lt;br&gt;
First, let's explore its benefits. As a developer new to Python development, I can attest to its impressive documentation and ease of use. With only a few commands you can have a simple, full stack application set up in minutes. Along with documentation, its tutorials walk you through step by step creating a basic application. Additionally, database connection is done in seconds with a few commands, and a database administration interface can also be built out in the matter of a a few commands. These benefits are why Django has gained popularity because much of the set up and configuration is abstracted away, leaving the developer more time to work on actual functionality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pitfalls&lt;/strong&gt;&lt;br&gt;
Just as with most things, where there are pros, there are cons. Although Django has a reputation for being quick to set up, its runtime speed can often be a pitfall if your application is not well optimized. Because of the amount resources being accessed in the framework and the application's architecture, sites can run slowly, but this can be accounted for if you have optimization top of mind from the beginning. Additionally, Django is not always the best choice for every project. Because the backbone of the framework is built around different views that are served based on the url configuration, it is not always the best choice for smaller, one-page applications.&lt;/p&gt;

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

&lt;p&gt;I hope this article provided some context before you begin on your Django journey. Before embarking, map out your the architecture of your site to ensure Django is the best option and that you are developing with optimization in mind. Then, I suggest checking out &lt;a href="https://www.djangoproject.com/"&gt;Django's website&lt;/a&gt; for details on how to start a project. As mentioned previously, its documentation and community is one of its best benefits for new developers. &lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.djangoproject.com/"&gt;https://www.djangoproject.com/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.w3schools.com/django/django_intro.php"&gt;https://www.w3schools.com/django/django_intro.php&lt;/a&gt;&lt;br&gt;
&lt;a href="https://careerfoundry.com/en/blog/web-development/django-framework-guide/"&gt;https://careerfoundry.com/en/blog/web-development/django-framework-guide/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>django</category>
    </item>
    <item>
      <title>Comparing Java and JavaScript</title>
      <dc:creator>Sydney Andre</dc:creator>
      <pubDate>Thu, 07 Dec 2023 15:06:06 +0000</pubDate>
      <link>https://dev.to/saandre0217/comparing-java-and-javascript-4mi6</link>
      <guid>https://dev.to/saandre0217/comparing-java-and-javascript-4mi6</guid>
      <description>&lt;p&gt;In this article, we will explore the similarities and differences between Java and JavaScript. As a software developer, I learned JavaScript first and have recently begun digging into Java concepts. This article will explain some history about each language, the key differences between them, and provide code snippets for some Java basics.&lt;/p&gt;

&lt;h2&gt;
  
  
  About the Languages
&lt;/h2&gt;

&lt;p&gt;Both Java and JavaScript are object oriented programming languages that utilize C-style syntax. Both were developed in the 1990s; James Gosling began creating Java in 1991 and Brenden Eich invented what is known today as JavaScript in 1995. The first version of each was released in 1996. At their conceptions, Java was primarily used for back-end development and JavaScript for front-end. As they have evolved over the last few decades, the uses for both have expanded. Java now is primarily used in Android mobile application development, but still continues to be used for server applications, as well as software and web development.  Similarly, JavaScript's uses have continued to grow allowing developers to create full applications with JavaScript and its related frameworks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Feature Differences
&lt;/h2&gt;

&lt;p&gt;Now that we have reviewed some of their similarities, let's look at a few differences. One of the most significant differences between the languages is how the machine runs the code. Java is a compiled, then interpreted language; whereas, JavaScript is just interpreted. Java code is run through a compiler that creates bytecode that is then interpreted by the Java Virtual Machine. This allows Java much more portability than other compiled languages whose generated machine code is platform-specific. Because of this, Java often gets the tagline "write once, run anywhere". Java gets the best of both worlds--speed of a compiled language with the flexibility of an interpreted language.  Interpreted languages run code by reading each line one by one then translating to machine code. When interpreted languages first came out, they were much slower than compiled languages, but as they have evolved performance gap between the two has shrunk.&lt;/p&gt;

&lt;p&gt;Another difference is that Java is multi-threaded and JavaScript is single-threaded. This means Java can execute multiple tasks simultaneously; whereas, JavaScript can only run one line of code at a time. This sounds like a big downfall for JavaScript, but by utilizing asynchronous techniques, its performance is not hindered as much as it may seem.&lt;/p&gt;

&lt;p&gt;Lastly, Java is class-based and JavaScript is prototype based. This refers to an inheritance style in object-oriented programming. In JavaScript objects do not need to be defined in a class to inherit properties of another object as they can inherit from the prototype property. On the other hand, object inheritance in Java, occurs when an object created in a class.&lt;/p&gt;

&lt;h2&gt;
  
  
  Beginner Java Concepts
&lt;/h2&gt;

&lt;p&gt;Next we are going to walk through some basic Java concepts. First, when setting up a Java file, you will need to define the package which refers to the directory. All other code must be wrapped inside of a class and the name of the class must match the file name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kr"&gt;package&lt;/span&gt; &lt;span class="nx"&gt;JavaExample&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kr"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Tutorial&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="c1"&gt;//start writing in Java&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Other basics in Java feel similar to JavaScript such as operators, string and array methods like .length() and accessing elements in arrays and strings with bracket notation. Variable declaration is a bit different as they are declared and defined with keywords that indicate their datatype. Lets look at some examples in our Tutorial class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kr"&gt;package&lt;/span&gt; &lt;span class="nx"&gt;JavaExample&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kr"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Tutorial&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//primitive variables&lt;/span&gt;
    &lt;span class="nx"&gt;int&lt;/span&gt; &lt;span class="nx"&gt;myNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;char&lt;/span&gt; &lt;span class="nx"&gt;myChar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;s&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;boolean&lt;/span&gt; &lt;span class="nx"&gt;myBoolean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;//non-primitive variables&lt;/span&gt;
    &lt;span class="nb"&gt;String&lt;/span&gt; &lt;span class="nx"&gt;myString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Java is Fun!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;int&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="nx"&gt;myArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Methods, or functions as you may know them from JavaScript, are also defined with some additional keywords that indicate how they can be accessed and what datatype it is expected to return. Methods declared with the keyword static can be accessed without creating an object of the class but cannot be accessed in other classes. Those declared with public can be accessed in other classes but must be accessed by objects of the class. If the method is not returning a value, you will use the keyword void after static or public, but if it is returning a value, you will use the datatype keyword.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kr"&gt;package&lt;/span&gt; &lt;span class="nx"&gt;JavaExample&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kr"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Tutorial&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="c1"&gt;//static method returning an integer&lt;/span&gt;
  &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="nx"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;arraySum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;int&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="cm"&gt;/* creating an object from the class 
    to access variable from above */&lt;/span&gt;
    &lt;span class="nx"&gt;Tutorial&lt;/span&gt; &lt;span class="nx"&gt;myVar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Tutorial&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="c1"&gt;//for loop shorthand&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;int&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
            &lt;span class="nx"&gt;myVar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;myNumber&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;myVar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;myNumber&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//public method not returning a value&lt;/span&gt;
   &lt;span class="kr"&gt;public&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;printMe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt; &lt;span class="nx"&gt;words&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="c1"&gt;//print to the console&lt;/span&gt;
    &lt;span class="nx"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;words&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, we will take a look at Java's main method. This is a built in method that is used to the project's code. All Java projects must use the main method at least once. Best practices dictates there should be one file responsible for running the Java code and the other classes will define the functionalities. In this example we will see the difference in how public vs. static methods are invoked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kr"&gt;package&lt;/span&gt; &lt;span class="nx"&gt;JavaExample&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kr"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Tutorial&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kr"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//access public method by creating an object&lt;/span&gt;
        &lt;span class="nx"&gt;Tutorial&lt;/span&gt; &lt;span class="nx"&gt;myObj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Tutorial&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

        &lt;span class="c1"&gt;//Public method invocation&lt;/span&gt;
        &lt;span class="nx"&gt;int&lt;/span&gt; &lt;span class="nx"&gt;addedNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;arraySum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;myObj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;myArray&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;addedNumber&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;//Static method invocation&lt;/span&gt;
        &lt;span class="nx"&gt;myObj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;printMe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hey! learning is fun!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Many say that starting the JavaScript for fresh beginners is a good idea as it is a more straightforward language with less 'magic' happening in the background, so as a new JavaScript developer, I was interested to see how easily or difficult understanding Java concepts would be. Although, I have not fully dug into all of its complexities, the learning curve of understanding these basic Java concepts was much flatter than starting off fresh with JavaScript. &lt;/p&gt;

&lt;p&gt;I hope this article helps you in your coding journey!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>java</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Introduction to Data Analysis with Python</title>
      <dc:creator>Sydney Andre</dc:creator>
      <pubDate>Wed, 22 Nov 2023 14:45:33 +0000</pubDate>
      <link>https://dev.to/saandre0217/introduction-to-data-analysis-with-python-2o8m</link>
      <guid>https://dev.to/saandre0217/introduction-to-data-analysis-with-python-2o8m</guid>
      <description>&lt;p&gt;In the world of big business, decisions are rarely left to someone's gut feeling. When making plans for the future, most business owners and executives want evidence to inform their decision. This is were data analysis comes into the picture. In this article we will examine at a high-level what the process of analyzing data looks like and explore how Python libraries like NumPy, Pandas, and Matplotlib enable us to follow this process.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Data Analysis?
&lt;/h2&gt;

&lt;p&gt;It is the process of transforming and organizing collected data to provide insights on its relationships and patterns. Professionals can then make informed decisions based on evidence from the data. Data analysis is a tool to aid professionals in their decision making but should not be the only factor involved. Just as important as discovering the patterns and relationships the data reveals is interrogating the data's limitations. When handling a large amount of data, it is important to follow a process to maintain focus on the primary purpose of the analysis. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Analysis includes the following steps:&lt;/strong&gt;&lt;br&gt;
&lt;u&gt;1. Ask/Specify Data Requirements&lt;br&gt;
&lt;/u&gt;In this step we ask ourselves or the intended audience (stakeholders, supervisor, etc.) &lt;em&gt;What is the question we are trying to answer through analyzing this data set? What problem are we solving for or upcoming event are we planning for?&lt;/em&gt; This allows you to maintain focus and provides a scope for your analysis. If we are trying to forecast how much of product X we should order for November, we probably are not very concerned with the sales of product Y in July.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;2. Prepare or Collect Data&lt;/u&gt;&lt;br&gt;
Here, the questions are &lt;em&gt;How are we currently collecting data? Does this include the data points I need to answer the questions in the scope of this analysis? If not, what are those gaps and how can we fill them?&lt;/em&gt; These questions allow us to take stock of the information we have at our disposal and if that will be enough to meet the needs of our scope. If not, we will need to add additional steps to get the information we need, but knowing this early on can help avoid future headaches.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;3. Clean and Process Data&lt;/u&gt;&lt;br&gt;
In this step we are thinking about how the data needs to be organized to best meet our needs. Asking ourself, &lt;em&gt;Are there any potential errors, corruptions, or duplications that could skew or misrepresent data? If so, how to we account for these and clean them? How do we store this data so it is easily accessible and manageable?&lt;/em&gt; Something to keep in mind is your analysis is only as good as your raw data, so you must be aware of the integrity of your data to ensure the integrity of your findings.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;4. Analyze&lt;/u&gt;&lt;br&gt;
Now for the fun part! Here is where you will be looking for those relationships and patterns we were talking about earlier. &lt;em&gt;What is the data showing you? Where are there meaningful relationships between variables? What trends are revealing themselves?&lt;/em&gt; This is where we are trying to answer our question from step one by using data science and computing tools.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;5. Interpretation&lt;/u&gt;&lt;br&gt;
Now that the data has been collected, organized, and then transformed into insightful information, we can interpret our findings. &lt;em&gt;Did you answer the original question? Were there limitations that the analysis was not able to account for? Do those limitations affect your results?&lt;/em&gt; This line of questioning is important in understanding how we can report on or make decisions based on the results.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;6. Act/Report&lt;/u&gt;&lt;br&gt;
Lastly, it is time to either make a plan based on your results or provide stakeholders with the information. At this point, you must turn your results into something that is easily digestible using visualization tools and summarization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Python Libraries
&lt;/h2&gt;

&lt;p&gt;In this article we will be discussing three Python libraries that streamline data analysis by providing structures and operations to manipulate the raw data. &lt;/p&gt;

&lt;p&gt;&lt;u&gt;NumPy&lt;/u&gt; is a general purpose multi dimensional array processing package that provides operations for dealing with these types of complex array structures. NumPy can be used in machine learning to process images into arrays for Deep Learning. More broadly, it is the base for many other scientific computing libraries in Python where its functionalities are used to increase other library's performance and capabilities.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Pandas&lt;/u&gt; is one of these libraries built on top of NumPy. It is used to work with relational data and offers multiple structures and operations to transform numerical data and time series.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Matplotlib&lt;/u&gt; is a data visualization tool built on top of NumPy that makes creating line, bar, scatter plots, and other graphs simple.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Python to Analyze Sales Data
&lt;/h2&gt;

&lt;p&gt;Now that we understand a bit more about the process of analyzing data and the libraries that helps us do that, let's look at an example. Your company is looking to order more products for the holidays. You think you may need to order more than usual, but are unsure how much more. Let's follow the steps outlined above to see how we should plan out this upcoming product order.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The question we are trying to answer through analyzing this data is: Based on sales from previous years, should we order more product than usual in November? This means we will want to group our data by month and year and get the sum of the sales and number of products sold.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now, we need to review the data we have access to. Is there somewhere we have access to the raw sales data? If so, let's move on to the next step.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What state is this data in? Does it need to be cleaned of duplications or errors before analyzing it? If not, let's get to the fun part.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now that we have clean, relevant data, let's use Pandas and Matplotlib to analyze and interpret our data.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#import libraries
import pandas as pd
import matplotlib.pyplot as plt

#create a data frame from .csv data
#set index column to the column you want to extract your rows based on 
dfYear = pd.read_csv("/file/path/to/sales_data_sample.csv", encoding= 'unicode_escape', index_col="YEAR_ID")

#make sure the date field in your data is converted to a readable date 
dfYear['ORDERDATE']=pd.to_datetime(dfYear['ORDERDATE'])

#extract the data for each year
year2021 = dfYear.loc[2021]
year2022 = dfYear.loc[2022]

#group each year by month and get the sum of all sales for each month
byMonth2021 = year2021.groupby([year2021['ORDERDATE'].dt.month]).agg({
  'SALES': 'sum'
})
byMonth2022 = year2022.groupby([year2022['ORDERDATE'].dt.month]).agg({
  'SALES': 'sum'
})

#plot each table
plt.plot(byMonth2021.index, byMonth2021['SALES'], label=2021)
plt.plot(byMonth2022.index, byMonth2022['SALES'], label=2022)

#plot styling
#change the format of the y axis to represent money
ax = plt.subplot()
def formatter(x, pos):
    return '$' + format(x, ',')
ax.yaxis.set_major_formatter(formatter)

#make sure all months are displayed on the x axis
plt.xticks(byMonth2003.index)

#label your axes 
plt.ylabel('Sales')
plt.xlabel('Months')

#title your graph
plt.title('Very Important Business Sales by Month')

#make sure your line labels appear in the legend
plt.legend()

#export the plot
plt.show()

run python &amp;lt;file name&amp;gt; in your terminal to see your graph

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvj558nh85bzckjb0q44o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvj558nh85bzckjb0q44o.png" alt="line graph of sales by month for 2022 and 2021" width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5.Based on this graph we can see that sales are much higher in November than the rest of the year, but what does this tell us about how much product we need to order? Well, one may assume we need to order a lot more product for November. This may be true, but the sum of sales for the month may not be the best data point to look at when trying to determine how much product you need to order. This could also mean that  people just bought more expensive things in November.&lt;/p&gt;

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

&lt;p&gt;Although we looked at a fairly simple example, understanding how to use data analysis tools effectively is an incredibly important skill that many businesses need. Libraries like Pandas and Matplotlib make transforming data that much easier.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sources&lt;/strong&gt;&lt;br&gt;
Data Analysis General: &lt;a href="https://www.geeksforgeeks.org/what-is-data-analysis/?ref=lbp"&gt;https://www.geeksforgeeks.org/what-is-data-analysis/?ref=lbp&lt;/a&gt;&lt;br&gt;
Pandas General: &lt;a href="https://www.geeksforgeeks.org/introduction-to-pandas-in-python/?ref=lbp"&gt;https://www.geeksforgeeks.org/introduction-to-pandas-in-python/?ref=lbp&lt;/a&gt;&lt;br&gt;
Extracting rows in Pandas:&lt;a href="https://www.geeksforgeeks.org/python-pandas-extracting-rows-using-loc/?ref=lbp"&gt;https://www.geeksforgeeks.org/python-pandas-extracting-rows-using-loc/?ref=lbp&lt;/a&gt;&lt;br&gt;
Matplotlib General:&lt;a href="https://www.geeksforgeeks.org/matplotlib-tutorial/?ref=lbp#line"&gt;https://www.geeksforgeeks.org/matplotlib-tutorial/?ref=lbp#line&lt;/a&gt;&lt;br&gt;
Matplotlib styling:&lt;a href="https://www.w3resource.com/graphics/matplotlib/basic/matplotlib-basic-exercise-6.php"&gt;https://www.w3resource.com/graphics/matplotlib/basic/matplotlib-basic-exercise-6.php&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>datascience</category>
      <category>analytics</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Apple's Programming Language: Swift</title>
      <dc:creator>Sydney Andre</dc:creator>
      <pubDate>Mon, 16 Oct 2023 00:05:58 +0000</pubDate>
      <link>https://dev.to/saandre0217/apples-programming-language-swift-4l1n</link>
      <guid>https://dev.to/saandre0217/apples-programming-language-swift-4l1n</guid>
      <description>&lt;p&gt;In my &lt;a href="https://dev.to/saandre0217/intro-to-mobile-application-development-57gn"&gt;last article&lt;/a&gt;, we took a look at mobile app development--how it is different from web development, approaches, and took a quick look at two languages, Swift and Java, that are often used for native app development. In this article, we will take a deep dive into Swift learning more about its histories and basic language features.&lt;/p&gt;

&lt;h2&gt;
  
  
  History
&lt;/h2&gt;

&lt;p&gt;Swift was released in 2014 by Apple, but brainstorming began in 2010 by Chris Lattner and other Apple developers. Before its creation, the primary language for Apple's operating systems was Objective-C. In their announcement, Apple explains the impetus for creating Swift was to have a language that overcame the shortfalls of Objective-C. They wanted a faster, safer, and more modern and interactive language. A common misconception is that Swift only supports Apple's operating systems, but it also can support Linux, Windows, and Android OS.&lt;/p&gt;

&lt;p&gt;Some key characteristics that set Swift apart are its safety and interactivity. By safety, they are referring to type safety. Apple claims making many common programming such as uninitialized variables, copy/reference errors, and unsafe string formatting are impossible with Swift. When writing Swift in Xcode, you have access to Swift Playgrounds which is basically a real time REPL. As you code, your results appear immediately, and you can view what your results would be over the execution of the code.&lt;/p&gt;

&lt;p&gt;Now that we know a bit more about its history, let's learn a bit more about the language!&lt;/p&gt;

&lt;h2&gt;
  
  
  Language Features
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Datatypes&lt;/strong&gt;&lt;br&gt;
Swift includes fundamental types such as integers, floating-point values, booleans, and strings and three primary collection types including ordered collections, known as arrays, unordered collections of unique values, known as sets, and unordered collections of key/value pairs known as  dictionaries. An interesting feature of these collection types is that all values in the array or set must be of the same type. Similarly, in dictionaries, all of the keys must have the same type and all of the values must have the same type. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Variables and Constants&lt;/strong&gt;&lt;br&gt;
Similar to other languages, Swift utilizes constants and variables to associate names with a value of a specific datatype. As the name might suggest, values declared as constants with the keyword &lt;code&gt;let&lt;/code&gt; stay constant and cannot be changes; whereas, values declared as variables with the keyword &lt;code&gt;var&lt;/code&gt; can change values later in the program. Additionally, you can add type annotation to define the datatype of the variable or constant, although this is not necessary in practice because of Swift's type inference. You can also declare more than one variable or constant on one line. Let's take a look at an example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//declaring constants
let name = 'Georgia', age = 8, isCute = true
name = 'Sydney' /* this would result in an error as constants 
cannot be redefined */

//declaring variables
var numOfTreats = 3, bestFriend = 'Reggie', isHungry = false
numberOfTreats = 5
bestFriend = 'Sydney'
isHungry = 'sometimes' /*this would result in an error
because variables cannot be reassigned to a value of a
different type */
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unlike these simple data types, when declaring a collection, you must define the type of values you intend to use. The example below shows the syntax that is used.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//arrays
var favFruits: [String] = ['strawberry', 'raspberry',
bananas', 'raspberry']
favFruits = [4, 7, 9] //this would result in an error
//although it can be reassigned, the new 
values must be of the same type.

//sets
var favColors: Set&amp;lt;String&amp;gt; = ['blue', 'green', 'pink']
favColors = ['blue', 'blue', 'green']
//this would result in a error because sets must contain
 unique values

//Dictionaries 
var bio: [String: String] = [name: 'Georgia', 
hometown: 'Baton Rouge', birthMonth: 'March']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Collections&lt;/strong&gt;&lt;br&gt;
Now that we know some of the intricacies of collections in Swift. Let's explore how we can access and modify each of these types of collections.&lt;/p&gt;

&lt;p&gt;You can access the number of elements in any of these types by using the .count property. Let's use this property on our previously declared collections to see how many elements are in each.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;favFruits.count //results in 4
favColors.count //results in 3
bio.count //results in 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly, all collections have an isEmpty property that will result in a boolean values. The syntax works the same as the .count property.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Arrays&lt;/u&gt;&lt;br&gt;
Similar to bracket notation in JavaScript, you can access values at specific indexes by passing the index of the value you want in brackets directly after the array name. Additionally you can use a similar syntax to change an element in your variable array. Unlike JavaScript, the index you input must be valid, you cannot pass in an expression.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//retrieve the first element
favFruits[0] //strawberry

//change the second element
favFruit[1] = 'blueberry'

//add to the end
favFruit[favFruit.count] = 'oranges' //will result in an error
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can insert and remove values from an array by a specific index using the insert or remove methods or values can be added or removed from the end of an array with the .append and removeLast() methods. Additionally we can add another array to the end of an array using the += operator.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;favFruits.insert('grapes', at: 2)
favFruits.remove(at: 1)
favFruits.append('cherry')
favFruits += ['apple', 'grapefruit']
favFruits.removeLast()
favFruits.count //8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After all of this modifying, what do you think favFruits looks like now? If you answered &lt;code&gt;['strawberry', 'blueberry', 'grapes', 'raspberry', 'bananas', 'raspberry', 'cherry', 'apple']&lt;/code&gt;, great! You have been paying close attention.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Sets&lt;/u&gt;&lt;br&gt;
Now let's look at sets. Sets are unordered collections of non-repeating values. This means we cannot access values with indexes, but we still have methods to modify sets. Sets have  .insert, .remove, and .removeAll methods that allow us to modify. We can also check if a value is present with the .contains method. Let's look at our favColors set again!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;favColors.insert('yellow') 
favColors.remove('green')
favColors.contains('blue') //true
//What does fav colors look like now?
//['blue', 'pink', 'yellow']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;u&gt;Dictionaries&lt;/u&gt;&lt;br&gt;
You can update or add a new value to a dictionary in one of two ways. Updating and adding a value, look the same syntacticly. Whether the pair is updated or added depends on if they key that is used is already in the dictionary. To remove a value, simply use the same subscript syntax to update a value, but instead set that value equal to nil. Let's take a look at our bio dictionary that was declared previously.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//subscript syntax
bio[hometown] = 'New Orleans' //hometown was updated from Baton Rouge 
to New Orleans
bio[favColor] = 'green' //favColor key was added

//updateValue method
bio.updateValue('pink', forKey: 'favColor') //changed from green 
to pink
bio.updateValue('cookie', forKey: 'favSnack') //favSnack key was added

//remove a pair
bio[favColor] = nil
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the updateValue method is used, it returns the value that was at that key before the update. &lt;/p&gt;

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

&lt;p&gt;Swift has a lot to offer in terms of syntax simplicity, safety, and interactivity. Many say it is a great beginner language for because of this. Because of its similarities to C family languages, it is easy for seasoned programmers to pick up on and is a great tool to have on your tool belt as Apple is one of the most widely known and influential technology companies of our time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://developer.apple.com/swift/"&gt;https://developer.apple.com/swift/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.swift.org/swift-book/documentation/the-swift-programming-language/"&gt;https://docs.swift.org/swift-book/documentation/the-swift-programming-language/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.swift.org/getting-started/"&gt;https://www.swift.org/getting-started/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.extremetech.com/computing/183563-apples-new-swift-language-explained-a-clever-move-to-boost-ios-while-holding-android-apps-back"&gt;https://www.extremetech.com/computing/183563-apples-new-swift-language-explained-a-clever-move-to-boost-ios-while-holding-android-apps-back&lt;/a&gt;&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/Swift_(programming_language)"&gt;https://en.wikipedia.org/wiki/Swift_(programming_language)&lt;/a&gt;&lt;br&gt;
&lt;a href="https://exyte.com/blog/introduciton-to-swift"&gt;https://exyte.com/blog/introduciton-to-swift&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ios</category>
      <category>mobile</category>
      <category>learning</category>
      <category>swift</category>
    </item>
    <item>
      <title>Intro to Mobile Application Development</title>
      <dc:creator>Sydney Andre</dc:creator>
      <pubDate>Sun, 08 Oct 2023 19:08:46 +0000</pubDate>
      <link>https://dev.to/saandre0217/intro-to-mobile-application-development-57gn</link>
      <guid>https://dev.to/saandre0217/intro-to-mobile-application-development-57gn</guid>
      <description>&lt;p&gt;We all know what a mobile app is. Likely you use one or multiple mobile apps everyday... maybe even a couple in an hour. Smartphones completely changed how we interact with technology allowing us to have a supercomputer in our back pockets at all times, and the mobile apps that we download onto them are a huge part of this. In this article, we are going to learn more about the development of these apps including how it differs from web app development, the different mobile app development approaches, and some popular languages that are used in their development.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Mobile App Development?
&lt;/h2&gt;

&lt;p&gt;Mobile app development is the process of making software applications available on smartphones or tablets, typically utilizing a network connection. Because mobile apps do not have to be accessed through a browser, like web applications, they are downloaded directly on to the device and must be developed to operate on the device's platform. This is the primary difference between mobile and web applications. We will learn about other differences as we discuss the development approaches and programming languages.&lt;/p&gt;

&lt;p&gt;There are two primary platforms, and if you are a smartphone user, you may be able to guess what those are--iOS and Android. If this is news to you, iOS is the operating system that powers Apple products like iPhones and iPads, and Android is Google's operating system. Unlike iOS, which is only available for Apple products, Android is available to other companies that meet their requirements. These platforms are important when understanding the different development approaches.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mobile App Development Approaches
&lt;/h2&gt;

&lt;p&gt;There are four major approaches when developing a mobile app which are differentiated by how they run on the device's operating system. There are pros and cons to each approach which we will take a look at. The main thing to keep in mind when choosing an approach is--what matters most? Depending on if that is runtime performance, access to device APIS, cost, maintenance, or complexity of the code will help determine which approach is best.&lt;/p&gt;

&lt;p&gt;Before diving into the information, this diagram Intraway.com explains the relationship the different approaches has with the platform. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6i5ac67c5yuv6pvwca7k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6i5ac67c5yuv6pvwca7k.png" alt="Image description" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Native Applications&lt;/strong&gt;&lt;br&gt;
Native applications run directly on the operating system for the device, either iOS or Android, and are written in the programming language and framework the platform specifies. Apps using this approach have the best runtime performance and direct access to device APIs, but can be costly to build and maintain. Additionally you would need to create different code bases for each platform as iOS and Android utilize different programming languages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cross-Platform Applications&lt;/strong&gt;&lt;br&gt;
Cross-platform applications are a type of native application which do not have to follow the programming language and framework specifications of the platforms, but are compiled into a native application to run directly on the device's operating system. Because these apps must be compiled to run on the operating system, this causes some limitations. Runtimes often perform less than native apps and you are dependent on bridges and libraries to access device APIs and other features. This is not to say that cross-platform apps do not have their perks. Since you are not building directly for one platform, you do not need multiple code bases for your app to work on devices with different operating systems and they are often allow for more cost effective maintenance. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hybrid-Web Applications&lt;/strong&gt;&lt;br&gt;
These applications are built with basic web development technology, like Javascript, HTML, and CSS, but are bundled as app installation packages. They do not run directly on the operating system but utilize a framework such as Apache Cordova. This allows the app to run on a 'web container' that provides a browser runtime and bridge to access native APIs. Hybrid-web apps have shared code bases between the mobile and web app. This is a huge advantage since many apps have a web counterpart. Additionally, web developers can utilize their current skill base to create mobile apps, but again because they are not running directly on the operating system, there are performance and feature limitations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Progressive Web Applications&lt;/strong&gt;&lt;br&gt;
PWAs are another kind of development approach that does not run directly on the operating system. You can think of them almost as home screen shortcuts to a website, because they are not downloaded through the app store. &lt;/p&gt;

&lt;h2&gt;
  
  
  Popular Mobile App Languages
&lt;/h2&gt;

&lt;p&gt;As we now know after reviewing the different approaches, web developers can utilize their current skills to create hybrid-web apps, but if you want to create a native mobile app, then a developer may need to add some new tools to their tool belt. One of these skills may be learning additional programming languages like Swift and Java. These are both popular languages that are used but not limited to developing native apps. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Swift&lt;/strong&gt;&lt;br&gt;
Swift describes its self as a "general-purpose programming language that's approachable for newcomers and powerful for experts. It is fast, modern, safe, and a joy to write." This open-source language was created by Apple Inc. and is primarily used for creating applications for Apple platforms. Some features of Swift that set it apart are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;inferred types&lt;/li&gt;
&lt;li&gt;namespaces instead of headers&lt;/li&gt;
&lt;li&gt;automatically managed memory&lt;/li&gt;
&lt;li&gt;no semicolons!!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Java&lt;/strong&gt;&lt;br&gt;
A powerful, general-purpose programming language created in 1995 by Sun Microsystems, now Oracle. All of Android's software development kits which are required to use to build an android application utilize standard libraries of Java. For web developers with a background in C or C++, Java should come naturally as it has a very similar syntax.&lt;/p&gt;

&lt;p&gt;In my next article, we will take a deeper dive into Swift and Java and how they are used in native app development.&lt;/p&gt;

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

&lt;p&gt;After reading this article, I hope you have come away with a better understanding of mobile app development. There is still much left to learn, but having a foundational understanding of the approaches and skills you may need to develop your own mobile app are important first steps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/mobile/mobile-application-development/"&gt;https://aws.amazon.com/mobile/mobile-application-development/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.knowledgehut.com/blog/web-development/mobile-app-development-vs-web-development"&gt;https://www.knowledgehut.com/blog/web-development/mobile-app-development-vs-web-development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/javarevisited/top-5-programming-languages-for-mobile-app-development-in-2021-19a1778195b8"&gt;https://medium.com/javarevisited/top-5-programming-languages-for-mobile-app-development-in-2021-19a1778195b8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Photo: &lt;a href="https://workwiththebest.intraway.com/blog-post/mobile-hybrid-development/"&gt;https://workwiththebest.intraway.com/blog-post/mobile-hybrid-development/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/learn-java-for-android-app-development-a-complete-guide/"&gt;https://www.geeksforgeeks.org/learn-java-for-android-app-development-a-complete-guide/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.swift.org/"&gt;https://www.swift.org/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>mobile</category>
      <category>beginners</category>
      <category>java</category>
      <category>swift</category>
    </item>
    <item>
      <title>Understanding and Comparing Relational and NoSQL Database Management Systems</title>
      <dc:creator>Sydney Andre</dc:creator>
      <pubDate>Sun, 01 Oct 2023 21:24:59 +0000</pubDate>
      <link>https://dev.to/saandre0217/understanding-and-comparing-relational-and-nosql-database-management-systems-1akd</link>
      <guid>https://dev.to/saandre0217/understanding-and-comparing-relational-and-nosql-database-management-systems-1akd</guid>
      <description>&lt;h2&gt;
  
  
  Understanding
&lt;/h2&gt;

&lt;p&gt;Before we dive into comparing these database management systems. Let's start from the beginning to ensure we understand what a database is, how database management systems (DBMS) are used to interact with and manage databases, and the features of relational and noSQL DBMSes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is a database?&lt;/strong&gt;&lt;br&gt;
This is pretty intuitive and many may be able to make an educated guess on this definition. A database is a collection of related data that is populated with a purpose and includes relevant information pertaining to that purpose. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is a Database Management System?&lt;/strong&gt;&lt;br&gt;
If a database is just a collection of related and relevant data, then a DBMS must be the way you manage that data so it can be useful for your purpose. More specifically, a DBMS allows you to define the database's schema which is the description of how data is stored including the data's type, structure, and/or constraints. Additionally, the DBMS is used to construct, store, update, query, share, and control access to the data.&lt;/p&gt;

&lt;p&gt;As you can see, the DBMS gives you the functionality to make use of your database, so understanding the features of each can help you to better manage your data with the system you are using or plan to use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Relational Database Management Systems&lt;/strong&gt;&lt;br&gt;
Simply put, relational database management systems(RDBMS) store data in tables and primarily use Structured Query Language (SQL) to access the database. Some modern RDBMSes are mySQL, Microsoft SQL, and Oracle. An RDBMS can have any number of tables, but the relationship of the columns and rows is consistent throughout. Columns represent specific information about every record, and the rows represent each record. Additionally, all tables include a column of a unique identifier called the primary key. This is used to identify the table as well as link various tables to one another. When one table's primary key is used in another table, it is referred to as a foreign key. Let's take a look at an example. &lt;/p&gt;

&lt;p&gt;Say you wanted to store data using a relational database management system to hold information about all of your pets. Let's make the first table hold general information about each pet. The second, linked table will hold nickname data for each pet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvo92qny5qldcu3uwsyqd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvo92qny5qldcu3uwsyqd.png" alt="Image description" width="800" height="477"&gt;&lt;/a&gt;&lt;br&gt;
As you can see in the tables above, both have a primary key that give each record in the table a unique identifier. The primary key in the Pets table is Pets ID which is used as a foreign key in the Nicknames table to link the nicknames of each pet to the general information about that pet. By having access to both tables, you would know that Georgia's nicknames are Sausage and Angel baby. &lt;/p&gt;

&lt;p&gt;This kind of structure is helpful in reducing any duplication of information which in turn saves storage--an important point in the early uses of RDBMSes. Now, let's talk about the non-tabular systems, also referred to as noSQL or 'not only SQL'&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NoSQL Database Management Systems&lt;/strong&gt;&lt;br&gt;
These management systems store data in a variety of data structures. The main ones include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;document-based: stores data in documents similar to JSON objects where each document contains pairs of fields and values.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;key-value: stores data in key value pairs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;wide-column: stores data in tables with dynamic columns&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;graph: stores data in nodes and edges&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Although each has their own unique features, in general noSQL databases include flexible data models and horizontal scaling. Having flexible data models allows developers to be agile and quickly change requirements. There are no strict schemas that must be followed which allows developers to keep up with the needs of today's fast-paced businesses. Horizontal scaling means you do not need to scale up to a larger server when you have reached capacity. Instead, you can spread out over cheaper commodity servers when necessary.&lt;/p&gt;

&lt;p&gt;Now that we know a bit more about what noSQL DBMSes are, let's take a look at data from the example above refactored using a document-based noSQL DBMS.&lt;/p&gt;

&lt;p&gt;`{&lt;br&gt;
  id: 0o1,&lt;br&gt;
  name:'Georgia'&lt;br&gt;
  breed:'Basset Hound Mix'&lt;br&gt;
  birthday: 3-24-2015&lt;br&gt;
  favNapSpot:'in front of fireplace'&lt;br&gt;
  nicknames: ['Angel baby', 'Sausage']&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;{&lt;br&gt;
  id: 0o2&lt;br&gt;
  name: 'Reggie'&lt;br&gt;
  breed: 'Pit Bull Mix'&lt;br&gt;
  birthday: 7-4-2016&lt;br&gt;
  favNapSpot: 'couch by Mom'&lt;br&gt;
  nicknames: ['Mr. Reggie', 'Brother']&lt;br&gt;
}`&lt;br&gt;
Unlike the RDBMS example, where you would need to join both tables to have access to all the information about a pet, with this example, you only need to access one of the documents to have all of the data on a pet.&lt;/p&gt;

&lt;p&gt;Now that we have a deeper understanding of all things database managements systems, let's compare two popular systems from each type.&lt;/p&gt;

&lt;h2&gt;
  
  
  Comparing
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Relational vs noSQL&lt;/strong&gt;&lt;br&gt;
The main advantage of RDBMSes is that multiple data elements can be accessed at the same time. This allows for multi-record ACID (atomicity, consistency, isolation, durability) transactions which provides a high level of data consistency. On the other hand, it can be very ridged because you must have predefined schemas that set the structure of your data.This means there is a lot of pre-planning that must go into set up and changing that structure is complicated and cumbersome. &lt;/p&gt;

&lt;p&gt;In contrast to these advantages and disadvantages, noSQL DBMSes allows for a lot of flexibility when it comes to data structures. Documents/data elements do not need a pre-defined schema and each document can have a different structure. Although this flexibility is necessary for the evolving needs of fast-paced industries, some argue noSQL DBMSes offer less security and data integrity. &lt;/p&gt;

&lt;p&gt;Scalability is another main difference between the two types. RDBMSes have vertical scalability meaning that you must scale up to a larger server when your have reached your max capacity. Although this can be viewed as a disadvantage because getting a larger server is costly, storage is more conservative in RDBMSes because they were invented much closer to the advent of the internet and computers when storage was costly. On the other hand, noSQL DBMSes have horizontal scalability meaning you can spread over many servers. This is advantageous for many modern businesses that have ever growing data storage needs.&lt;/p&gt;

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

&lt;p&gt;After reading this article, I hope you come away with a better understanding of the database basics. Having this foundational knowledge before diving into more complicated database management and administration is important. We can see that both types of management systems have their pro and cons. RDBMSes make it easy to ensure the security and integrity of large amounts of data and have an intuitive data structure that is easy to understand; whereas, NoSQL DBMSes are better when availability and flexibility of your data is of higher priority.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;What is a database? and What is a DBMS?&lt;br&gt;
&lt;a href="https://spots.augusta.edu/caubert/db/ln/CSCI_3410_lecture_notes.pdf"&gt;https://spots.augusta.edu/caubert/db/ln/CSCI_3410_lecture_notes.pdf&lt;/a&gt;&lt;br&gt;
Relational DBMS&lt;br&gt;
&lt;a href="https://www.techtarget.com/searchdatamanagement/definition/RDBMS-relational-database-management-system"&gt;https://www.techtarget.com/searchdatamanagement/definition/RDBMS-relational-database-management-system&lt;/a&gt;&lt;br&gt;
NoSQL&lt;br&gt;
&lt;a href="https://www.mongodb.com/nosql-explained"&gt;https://www.mongodb.com/nosql-explained&lt;/a&gt;&lt;br&gt;
&lt;a href="https://intellipaat.com/blog/what-is-no-sql/"&gt;https://intellipaat.com/blog/what-is-no-sql/&lt;/a&gt;&lt;br&gt;
Comparing&lt;br&gt;
&lt;a href="https://www.geeksforgeeks.org/difference-between-sql-and-nosql/?ref=lbp"&gt;https://www.geeksforgeeks.org/difference-between-sql-and-nosql/?ref=lbp&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sql</category>
      <category>nosql</category>
      <category>beginners</category>
      <category>database</category>
    </item>
    <item>
      <title>Higher Order Functions</title>
      <dc:creator>Sydney Andre</dc:creator>
      <pubDate>Thu, 17 Aug 2023 17:37:03 +0000</pubDate>
      <link>https://dev.to/saandre0217/higher-order-functions-5ak5</link>
      <guid>https://dev.to/saandre0217/higher-order-functions-5ak5</guid>
      <description>&lt;h2&gt;
  
  
  What are Higher Order Functions?
&lt;/h2&gt;

&lt;p&gt;Simply put, higher order functions are functions that accept single or multiple functions as arguments and/or return functions as their output. The functions that are used as arguments are called &lt;strong&gt;callback functions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We can do this because functions are first class objects. This basically means functions can act just like other datatypes. For example, you can assign a function to a variable which is called a &lt;strong&gt;function expression&lt;/strong&gt;. Additionally, functions can be stored in objects and arrays.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//function expression
let funcVariable = (a, b) =&amp;gt; a + b

//function as an object's value
let funcInObj = {
fullName: (first, last) =&amp;gt; `${first} ${last}`
}
//functions as values in an array
let funcInArr = [(first, last) =&amp;gt; `${first} ${last}`, (age) =&amp;gt; `I am ${age} years old`]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unlike other datatypes, functions not only store data, they often perform an action in your code. By accessing the function assigned to the variable or within the object or array, you can call the function and create an action in your code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//calling a function assigned to a variable
funcVariable(6, 7) //will return 13

//calling a function in an object
funcInObj.fullName('Ilana', 'Wexler') //will return Temperance Brennan

//calling a function in an array
funcInArr[0]('Abbi', 'Abrams') //will return Seeley Booth
funcInArr[1](26) //will return I am 26 years old
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we understand what higher order functions are and why we can use them in this capacity, we will dive deeper into &lt;em&gt;how&lt;/em&gt; to use higher order functions in our code by taking a look at common array methods that are actually higher order functions. &lt;/p&gt;

&lt;h2&gt;
  
  
  Common Higher Order Functions and How to Use Them
&lt;/h2&gt;

&lt;p&gt;.filter(), .map(), and .reduce() are native methods in JavaScript that allow us to easily manipulate datasets using higher order functions. Behind each of these methods are for loops that access each element in the input array so you can call various functions on each value. These methods decrease the number of lines of code we must use and allow for more efficient coding. Below we will dig into how to use each of these methods.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;.filter()&lt;/strong&gt;&lt;br&gt;
The .filter() method is designed to take in an array and a function. The callback function tests each element of the array and will only return the values that pass the function's test as a new array.&lt;/p&gt;

&lt;p&gt;Let's say you have a data set of customers and you want an array of only the customers over 40. The .filter() method would be a great way to get this information.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let customers = [
{name: 'Ilana Wexler',
city: 'New York City',
age: 21
},
{name: 'Temperance Brennan',
city: 'Washington DC',
age: 45
},
{name: 'Abbi Abrhams',
city: 'New York City',
age: 26
},
]

let over40 = customers.filter((current) =&amp;gt; current.age &amp;gt; 40)
console.log(over40) //will log [ { name: 'Temperance Brennan', city: 'Washington DC', age: 45 } ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see if the code above, we are using the filter method on our array of customers with a callback function that is  testing each element to see which customer has an age value over 40. Because of .filter()'s behind the scenes code, this pushes all of the elements that pass this test into a new array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;.map()&lt;/strong&gt;&lt;br&gt;
The .map() method is designed to take in an array and a function and return an array of new values based on the actions of the function. In other words, the callback function is called on each item in the array. These updated values are then pushed into a new array which is returned.&lt;/p&gt;

&lt;p&gt;Let's say we wanted to output a new array of customer objects with an additional property. The .map() method can help us do this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let updatedCustomers = customers.map(current =&amp;gt; {
  return {
    name: current.name,
    city: current.city,
    age: current.age,
    lovesPizza: true
  }
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using the .map() method we are able to create a new array by calling this callback function that adds a new key/value pair to each of the elements of the input array. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;.reduce()&lt;/strong&gt;&lt;br&gt;
The .reduce() method is designed to take in an array, a function, and a seed and return an accumulated value based on the action the function performs on the array. The seed value is optional but should be used if you want to return a value that is not an array. &lt;/p&gt;

&lt;p&gt;The callback function accepts two values, typically referred to as &lt;em&gt;accumulator&lt;/em&gt; and &lt;em&gt;current&lt;/em&gt; but can be labeled with any name. The value of the &lt;em&gt;current&lt;/em&gt; parameter is an individual value from the input array. &lt;/p&gt;

&lt;p&gt;Let's say you wanted to know how many customers in your data set live in New York City, the .reduce() method would be a great way to find this out.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let findNYCResidents = customers.reduce((accumulator, current) =&amp;gt; {
if(current.city === 'New York City'){
accumulator += 1
}
return accumulator
}, 0)
console.log(findNYCResidents) //will return 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.reduce() is a very powerful method that has many uses because of the flexibility the seed value allows. Here we access each value in the array and pass it through our callback function that adds 1 to our accumulator every time a customer passes the callback function's test.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understanding higher order functions is very important in being able to create flexible, efficient code, so I hope you were able to take away a better understanding after reading through!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
      <category>functions</category>
    </item>
  </channel>
</rss>
