<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Justin Saborouh</title>
    <description>The latest articles on Forem by Justin Saborouh (@pazukunous).</description>
    <link>https://forem.com/pazukunous</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%2F928499%2F3b140632-800a-4b77-8199-b88830faa3ad.png</url>
      <title>Forem: Justin Saborouh</title>
      <link>https://forem.com/pazukunous</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/pazukunous"/>
    <language>en</language>
    <item>
      <title>Slicing</title>
      <dc:creator>Justin Saborouh</dc:creator>
      <pubDate>Mon, 12 Dec 2022 02:46:27 +0000</pubDate>
      <link>https://forem.com/pazukunous/slicing-co</link>
      <guid>https://forem.com/pazukunous/slicing-co</guid>
      <description>&lt;p&gt;When first developing a website, developers would sit together, think of the idea/purpose of the application, then sit through to discuss database schema, front end styling, back end functionality, etc. Essentially splitting up each big "chunk" of software to design and detail the purposes and minimum viable processes it would require and handle. &lt;/p&gt;

&lt;h2&gt;
  
  
  The Horizontal Slice
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PreigRnr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7wqf3intzbqbfwwlchmk.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PreigRnr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7wqf3intzbqbfwwlchmk.gif" alt="Image description" width="879" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above references typical software development planning as &lt;strong&gt;horizontal slicing&lt;/strong&gt;. This isn't a bad approach, and seems fairly practical for development work split amongst a dev team. The only concern is that it does not consider the user's experience and interaction with the product, or as it's called the &lt;strong&gt;User Stories&lt;/strong&gt;. In agile development, especially where the end product is meant for millions of users, it is wise to prioritize and pivot the perspective of development towards the User Experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YcgqpkEZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/niaxn72z7hikxqiki30y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YcgqpkEZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/niaxn72z7hikxqiki30y.png" alt="Image description" width="244" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Splitting your code up into functional layers, like how the cake presents, is great to cleanly organize what and how certain programming is done, but in the end you can imagine that a horizontally sliced cake does not give a user an even bite of the entire product.&lt;/p&gt;

&lt;p&gt;In more practical terms, issues that arise with horizontal slicing include&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A stakeholder not being able to see progress/parts of the project until it is completely finished&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Feedback from the stakeholder can change the product entirely if one small feature doesn't match (since the entire app was already an Minimum Viable Product (MVP)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Evaluation of smaller user stories is delayed until all parts are completed, which hinders data scientists' ability to evaluate success&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Vertical Slice
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A2No8GuE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slopg0bqnxdu4zn46ewp.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A2No8GuE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slopg0bqnxdu4zn46ewp.gif" alt="Image description" width="879" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The main aspect of vertical slicing is thinking in "slices" of user stories. For example, first develop a login/signup feature that stores the encrypted data in the database and can hash it when needed, while simultaneously routing the frontend to handle unauthorized users to a signup page and redirecting them once authorized.&lt;br&gt;
This approach allows you to work on all aspects of the app and only develop what is needed for that initial vertical slice. The backend is developed enough to handle new and existing user calling, and the frontend can handle routing and redirecting from a home page and signup page, vice versa.&lt;br&gt;
This also yields a better showcase to the stakeholder, only showing the minimal pieces developed in perspective of the user so that when the inevitable rash and absurd changes are asked for, it is slightly tolerable since there is less of the app to "rework"&lt;/p&gt;

&lt;p&gt;Other benefits include&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data scientists being able to evaluate a lot earlier&lt;/li&gt;
&lt;li&gt;The dev team being more aligned with the stakeholder's ideals and needs without completely forfeiting their own ideals of how the product works behind the scenes.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Both flows of development are great in their own regards. I would even suggest horizontal slicing if you are making a simple app for yourself. But for larger scale, and especially in teams, vertical slicing seems to cover all grounds of management error while still progressing your code&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;Data Science Process Alliance &lt;a href="https://www.datascience-pm.com/vertical-vs-horizontal-slicing-data-science-deliverables/#:%7E:text=Traditional%20software%20approaches%20favor%20developing,value%20streams%20(vertical%20slicing)."&gt;https://www.datascience-pm.com/vertical-vs-horizontal-slicing-data-science-deliverables/#:~:text=Traditional%20software%20approaches%20favor%20developing,value%20streams%20(vertical%20slicing).&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Visual Paradigm &lt;a href="https://www.visual-paradigm.com/scrum/user-story-splitting-vertical-slice-vs-horizontal-slice/"&gt;https://www.visual-paradigm.com/scrum/user-story-splitting-vertical-slice-vs-horizontal-slice/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;mondayBlog &lt;a href="https://monday.com/blog/project-management/vertical-slice/"&gt;https://monday.com/blog/project-management/vertical-slice/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ux</category>
      <category>agile</category>
    </item>
    <item>
      <title>Rails Restful Routing</title>
      <dc:creator>Justin Saborouh</dc:creator>
      <pubDate>Thu, 17 Nov 2022 10:59:41 +0000</pubDate>
      <link>https://forem.com/pazukunous/rails-restful-routing-29m3</link>
      <guid>https://forem.com/pazukunous/rails-restful-routing-29m3</guid>
      <description>&lt;p&gt;When building an interactive full-stack website, there are going to be cases where the user communicates with the server, and the server has to respond with or update the corresponding data. In the simplest of applications, it's the reason why a user can create, read, update, and destroy (CRUD) particular pieces of data. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XyY4rKin--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/09i4te6u9sjtey0wf2vi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XyY4rKin--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/09i4te6u9sjtey0wf2vi.png" alt="The MVC Diagram" width="640" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is one of the many fundamental properties that Rails simplifies for us in web applications. The &lt;strong&gt;User&lt;/strong&gt; sends a request to the &lt;strong&gt;Controller&lt;/strong&gt;, which manipulates the request to be interpretable by the &lt;strong&gt;Model&lt;/strong&gt; so it can update the &lt;strong&gt;View&lt;/strong&gt; and present it back to the &lt;strong&gt;User&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is REST?
&lt;/h2&gt;

&lt;p&gt;REST is REpresentational State Transfer which references an architectural design flow/pattern when routing your HTTP requests. Often times, requests like &lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;POST&lt;/code&gt;, etc are used more than once for a certain controller and the definitions for each varying &lt;code&gt;GET&lt;/code&gt; or &lt;code&gt;POST&lt;/code&gt; request will look and execute messily. To avoid this, the rails backend structures 7 specific route names that translate the HTTP request smoothly once defined in the specific controller.&lt;/p&gt;

&lt;p&gt;For example, a lot of &lt;code&gt;GET&lt;/code&gt; requests without this convention are written in Sinatra with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class ApplicationController &amp;lt; Sinatra::Base

  get '/games' do
    games = Game.all
    games.to_json data
  end

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

&lt;/div&gt;



&lt;p&gt;As you can see, to satisfy a simple &lt;code&gt;SELECT *&lt;/code&gt; statement, a get request is used and must used over and over again to specific different types of &lt;code&gt;get&lt;/code&gt; requests.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ApB7s62P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jbmgoqlirma6gsgc8593.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ApB7s62P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jbmgoqlirma6gsgc8593.png" alt="7 Common Rails Routes" width="880" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Route Setup
&lt;/h2&gt;

&lt;p&gt;In your &lt;code&gt;routes.db&lt;/code&gt; in your Ruby application, this is where the specifications of the different routes per controller are defined.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rails.application.routes.draw do
   resources :games
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Having no particular declarations after the &lt;code&gt;:games&lt;/code&gt; attribute has rails interpret all 7 routes to be implemented. If you only wanted to have a &lt;code&gt;CREATE&lt;/code&gt; route, then you would add&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rails.application.routes.draw do
   resources :games, only: [:create]
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Index | Show
&lt;/h2&gt;

&lt;p&gt;Index and Show in a RESTful context both reference the &lt;code&gt;GET&lt;/code&gt; HTTP pull method. &lt;code&gt;Index&lt;/code&gt; would list the entire index of a certain table, and &lt;code&gt;Show&lt;/code&gt; would represent only one row of that table&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;routes.db&lt;/code&gt;, further clarification is needed&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rails.application.routes.draw do
   resources :games, only: [:index, :show]
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the controller for the respective class (in this case, a &lt;code&gt;game_controller.rb&lt;/code&gt; file), the implementation is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class GameController &amp;lt; ApplicationController
   def index
      render json: Games.all
   end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we tell the database to get all indices of a table and render them back to the Model&lt;br&gt;
You can also tack on a status code if need be&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;render json: Games.all, status: :ok&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Show&lt;/code&gt; represents the &lt;code&gt;GET&lt;/code&gt; HTTP method as well, but with a parameter (typically an ID of the index you'd like)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def show
   render json: Games.find(params[:id]), status: :ok
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you need to cover for the situation in which the ID wasn't found then you can nest it in an if-else scenario&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def show
   game = Games.find(params[:id])
   if game
      render json: game, status: :ok
   else
      render json: {error: "Game not found"}, status: :not_found
   end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create | Update | Destroy
&lt;/h2&gt;

&lt;p&gt;Once again we specify our &lt;code&gt;routes.db&lt;/code&gt; to include these HTTP requests&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rails.application.routes.draw do
   resources :games, only: [:index, :show, :create, :update, :delete]
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When creating entries, rails can not automatically assume the contents of a &lt;code&gt;POST&lt;/code&gt; request, we need to re-orient the parameters so that the body of the post request can be interpreted to create new entries&lt;br&gt;
Adding this &lt;code&gt;wrap_parameters&lt;/code&gt; declaration tells rails to re-format the data into a &lt;code&gt;[]&lt;/code&gt; array-like format, so that we can break apart what was sent and see if there are extra, or lacking pieces of data&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class GameController &amp;lt; ApplicationController
wrap_parameters format: []
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;CREATE&lt;/code&gt; request 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;def create
   game = Games.create(game_params)
   render json: game, status: :created
end

private
def game_params
   params.permit(:name, :publisher, :release_year, :console)
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The game_params function takes the params and assigns each attribute to be returned as parameters, so it is properly formatted when passed into the &lt;code&gt;create&lt;/code&gt; function&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Update&lt;/code&gt; would replicate the &lt;code&gt;show&lt;/code&gt; route but with a small change when rendering&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def update
   game = Games.find(params[:id])
   if game
      game.update(game_params)
      render json: game, status: :accepted
   else
      render json: {error: "Game not found"}, status: :not_found
   end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Destroy&lt;/code&gt; would be similar to above as well, the only niche is that since there isn't necessarily any data to render back to the Model, you would return &lt;code&gt;head :no_content&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def destroy
   game = Games.find(params[:id])
   if game
      game.destroy
      head :no_content
   else
      render json: {error: "Game not found"}, status: :not_found
   end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Overall, as fundamentally standard CRUD is across all forms of database management/administration, the only extra step needed when adapting to new environments is following the conventions. &lt;code&gt;New&lt;/code&gt; and &lt;code&gt;Edit&lt;/code&gt; would require a form to be presented and rendered, in which case the &lt;code&gt;Create&lt;/code&gt; and &lt;code&gt;Update&lt;/code&gt; definitions would be invoked afterwards.&lt;br&gt;
Happy CRUDing!&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;MVC: Model, View, Controller (&lt;a href="https://www.codecademy.com/article/mvc"&gt;https://www.codecademy.com/article/mvc&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;ThoughtBot: REST Tutorial (&lt;a href="https://thoughtbot.com/upcase/videos/rest"&gt;https://thoughtbot.com/upcase/videos/rest&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;RailsGuides: Rails Routing (&lt;a href="https://guides.rubyonrails.org/routing.html"&gt;https://guides.rubyonrails.org/routing.html&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;MakandraCards: wrap_parameters for your API&lt;br&gt;
(&lt;a href="https://makandracards.com/makandra/46405-rails-wrap_parameters-for-your-api"&gt;https://makandracards.com/makandra/46405-rails-wrap_parameters-for-your-api&lt;/a&gt;)&lt;/p&gt;

</description>
      <category>rails</category>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>SQL and Table Relationships</title>
      <dc:creator>Justin Saborouh</dc:creator>
      <pubDate>Wed, 26 Oct 2022 18:56:26 +0000</pubDate>
      <link>https://forem.com/pazukunous/sql-and-table-relationships-4b0</link>
      <guid>https://forem.com/pazukunous/sql-and-table-relationships-4b0</guid>
      <description>&lt;p&gt;SQL, or Structured Query Language, is the standard language most programs use to CRUD data. Common database structures like SQL Server, Oracle, MongoDB, mySQL, etc use a table-like format with rows and columns to organize data, and since there will be multiple tables with differing representations, it is important to understand how to join and relate these tables together to have efficient, smoother data.&lt;/p&gt;

&lt;p&gt;Some examples of SQL CRUD code include:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE Persons (
    PersonID int,
    LastName varchar(255),
    FirstName varchar(255),
    Address varchar(255),
    City varchar(255)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT FirstName, LastName
FROM Persons
WHERE city="sacramento"
ORDER BY LastName ASC
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;UPDATE Persons
SET Address="N/A"
WHERE city="The Moon"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DELETE
FROM Persons
WHERE city="The Moon"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When planning to make multiple tables and numerous relationships in a schema, it is important for your tables to have a &lt;strong&gt;primary key&lt;/strong&gt; when being created. A primary key is typically and ID that is used to keep track for linking entries between other tables. Once that ID is referenced in another table, it becomes a &lt;strong&gt;foreign key&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t-ikEADR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vdw643mjun4ess4wl659.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t-ikEADR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vdw643mjun4ess4wl659.png" alt="Image description" width="880" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this schema example, the first table showcases dog names as the primary key along with string inputs for the Dry/Wet and Good-Boy columns. The second table has tag numbers with certain dogs' measurements. When these primary keys merge with the final table at the bottom, they are referenced as foreign keys that reference an entirely different table when followed through. &lt;/p&gt;

&lt;p&gt;Depending on how these tables reference each other, you can imagine there would be different types of relationships.&lt;br&gt;
There are two main types of relational databases in SQL&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One-To-Many&lt;/strong&gt; is fairly common in most schemas, and represents that a record in table A can be seen multiple times if joined to another table B. For example, if there is a large list of employees as Table B, and in that table has a foreign key of which supervisor advises a certain employee, you could imagine in a supervisors list as Table B, multiple supervisors would be referenced multiple times, spanning multiple employees.&lt;br&gt;
&lt;strong&gt;Many-To-Many&lt;/strong&gt; is very similar to one-to-many, but using the same example, it would be many-to-many if each employee could have more than one supervisor&lt;br&gt;
&lt;strong&gt;One-to-One&lt;/strong&gt; isn't as commonly seen as one-to-many, as you can simply just join the tables together, but it showcases that a singular record from table A with only relate to a singular record in table B, not duplicates on either pathway of the relation&lt;/p&gt;

&lt;p&gt;When simplifying your schema, it is important to understand how to &lt;strong&gt;join&lt;/strong&gt; your tables properly so the correct relationships and information is recorded over. A &lt;strong&gt;join clause&lt;/strong&gt; combines entries from multiple tables, relative to a certain column that is shared between them.&lt;/p&gt;

&lt;p&gt;There are 4 main types of joins&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NICc0vES--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8x5zb5qzqdjrdlp1u3fz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NICc0vES--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8x5zb5qzqdjrdlp1u3fz.png" alt="Image description" width="880" height="177"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Inner join just returns a new table with matching columns from both tables.&lt;br&gt;
The Left and Right joins will do the same but also include additional columns depending on which table was interpreted.&lt;br&gt;
A Full Outer join just simply returns all the entries where a match is found on either table.&lt;/p&gt;

&lt;p&gt;Sources&lt;br&gt;
W3 Tutorials - SQL Joins &lt;br&gt;
(&lt;a href="https://www.w3schools.com/sql/sql_join.asp"&gt;https://www.w3schools.com/sql/sql_join.asp&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;101 Computing - Relational Databases&lt;br&gt;
(&lt;a href="https://www.101computing.net/relational-databases/"&gt;https://www.101computing.net/relational-databases/&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;SQLShack&lt;br&gt;
(&lt;a href="https://www.sqlshack.com/sql-definition/"&gt;https://www.sqlshack.com/sql-definition/&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;TheSupportGroup&lt;br&gt;
(&lt;a href="https://blog.supportgroup.com/getting-started-with-relational-databases-one-to-one-and-many-to-many-relationships"&gt;https://blog.supportgroup.com/getting-started-with-relational-databases-one-to-one-and-many-to-many-relationships&lt;/a&gt;)&lt;/p&gt;

</description>
      <category>sql</category>
      <category>ruby</category>
      <category>database</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Data Fetching for Live React Apps</title>
      <dc:creator>Justin Saborouh</dc:creator>
      <pubDate>Thu, 06 Oct 2022 07:52:21 +0000</pubDate>
      <link>https://forem.com/pazukunous/data-fetching-for-live-react-apps-39no</link>
      <guid>https://forem.com/pazukunous/data-fetching-for-live-react-apps-39no</guid>
      <description>&lt;p&gt;When starting your adventure of web development and programming, most of the starter apps and concepts are understood through single-page, static applications. This means that these apps are going to be same no matter what machine it's hosted on, and don't typically require an internet connection.&lt;/p&gt;

&lt;p&gt;However, as seen with most of our day-to-day applications, there is always a sense of live-updating and client-server interaction to give the user a unique experience when using these apps. This is introduced in React as Data Fetching.&lt;/p&gt;

&lt;p&gt;The method of updating and populating data on a webpage is defined as an &lt;strong&gt;AJAX call&lt;/strong&gt;. React applications have a built-in library for these calls called &lt;strong&gt;window.fetch&lt;/strong&gt;. With this fetch command, we can make calls to gather additional data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fetch('http://example.com/ingredients.json')
  .then((res) =&amp;gt; res.json())
  .then((data) =&amp;gt; console.log(data));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first parameter pertaining to the fetch invocation tells React where to gather the information from. Prioritizing the destination to be a json file will return less steps converting the data received. The result isn't technically the json body but a promise that will eventually turn into a response &lt;code&gt;res&lt;/code&gt; element that is converted to json format. Then, with the last &lt;code&gt;.then&lt;/code&gt; statement, we can finally instruct what to do with the gathered data.&lt;/p&gt;

&lt;p&gt;The first time we can appropriately program a fetch command is in conjunction with the useEffect() hook. After the first stage of a page rendering, which is simply loading the DOM elements and basic HTML, another 'reload' is ran where most components are rendered, as well as text content and image sources. Here is where we'd want to call the useEffect hook to gather any outside data we'd need to use.&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, { useState, useEffect } from "react";
function App() {
  const [recipesList, setRecipesList] = useState([]);

  useEffect(() =&amp;gt; {
    fetch("http://api.open-cooking.org/recipes.json")
      .then((res) =&amp;gt; res.json())
      .then((data) =&amp;gt; {
        setRecipesList(data.recipes);
      });
  }, []);

  return &amp;lt;div&amp;gt;{peopleInSpace.recipes((recipe) =&amp;gt; recipe.ingredients)}&amp;lt;/div&amp;gt;;
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The example code here let's us call a fetch during the initial 'second' load of a React application, sets the data to a readable json format, and adds the data to our state variable of recipesList.&lt;/p&gt;

&lt;p&gt;Another time to call a fetch argument is during an event signal for any DOM element. Let's say you needed to retrieve and load data after a button or an event was clicked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function handleClick() {
  fetch("http://api.open-notify.org/recipes.json")
    .then((res) =&amp;gt; res.json())
    .then((json) =&amp;gt; setData(json));
}

return &amp;lt;button onClick={handleClick}&amp;gt;Click to Fetch!&amp;lt;/button&amp;gt;;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On click, the button will call a function that accesses data from a URL and assigns it to a state variable.&lt;/p&gt;

&lt;p&gt;These are the two primary scenarios to call and fetch data from external sources. With this expanded perspective of react building, we can build slightly more advanced applications that are interactive with the user to alter and retrieve data.&lt;/p&gt;

&lt;p&gt;Resources&lt;br&gt;
AJAXs and APIs - React (&lt;a href="https://reactjs.org/docs/faq-ajax.html#example-using-ajax-results-to-set-local-state"&gt;https://reactjs.org/docs/faq-ajax.html#example-using-ajax-results-to-set-local-state&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Using the Fetch API - mdn web docs (&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Using the Effect Hook - React&lt;br&gt;
(&lt;a href="https://reactjs.org/docs/hooks-effect.html"&gt;https://reactjs.org/docs/hooks-effect.html&lt;/a&gt;)&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>Scope in JavaScript</title>
      <dc:creator>Justin Saborouh</dc:creator>
      <pubDate>Tue, 20 Sep 2022 04:35:12 +0000</pubDate>
      <link>https://forem.com/pazukunous/scope-in-javascript-2f5e</link>
      <guid>https://forem.com/pazukunous/scope-in-javascript-2f5e</guid>
      <description>&lt;p&gt;Scope in JavaScript, and in programming as a whole, is a cornerstone fundamental to grasp in order to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Avoid any potential errors and bugs regarding undefined variables and modifications&lt;/li&gt;
&lt;li&gt;Produce cleaner code that inadvertently manages and limits memory usage&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Scope can be defined as &lt;strong&gt;the visibility of values and expressions that can be used in the current context&lt;/strong&gt;. Most developers when first starting out typically have variables and expressions defined &lt;strong&gt;globally&lt;/strong&gt; so there won't be any issues when just learning the fundamentals. However, over time when your code becomes more and more dense with many layers of pathing, there will be moments where you don't necessarily intend to execute every line of code because of overlapping or interference when accessing and modifying values (in a non-threaded context)&lt;/p&gt;

&lt;p&gt;In JavaScript, there are 3 primary areas of scope&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Global Scope&lt;/em&gt;&lt;br&gt;
Any definition that is not under any function or block (the {} that contains code) is defined to be in the global parameter of scope. Anything declared globally can be used and modified anywhere&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const greeting = "Hello World"
function sayHello(){
   console.log(greeting)
}
console.log(greeting)
//The greeting will be logged twice as it was accessed twice; 
//once in the function and another in the global scope
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Function Scope&lt;/em&gt;&lt;br&gt;
Definitions that are stated inside the block of a function. Only in the context of said function, are the declarations significant. Any variable created in the function scope can only be referenced in that scope. However, any modifications made to a variable above the level of this scope can be considered since the above rule applies for that scope's context.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let greeting = "Hello World"
function sayHello(){
   let newGreeting = "Hello Human"
   console.log(newGreeting)
}
console.log(newGreeting)
//This will result in an error despite a declaration of
//newGreeting, as the function was never called in a global
//scope
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let greeting = "Hello World"
function sayHello(){
   newGreeting = "Hello Human"
   console.log(newGreeting)
}
sayHello()
console.log(greeting)
//Now there will be two logs to the function
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Block Scope&lt;/em&gt;&lt;br&gt;
Block Scope can be treated similarly to function scope, except variable declarations in a block scope can be referenced in children beneath the block. This scope is typically found in conditional statements such as if and switch cases.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sayHello(name){
   console.log(`Hello ${name}`)
let gender = 'boy'

if (baby === 'boy'){
   let name = 'Mark'
   sayHello(name)
}
else if(baby === 'girl'){
   let name = 'Alice'
   sayHello(name)
}

//This example showcases the 'name' variable being passed down
//through the block scope to the function scope of sayHello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Overall, scopes should be learned through a hierarchical system, where the global scope is above the function scope, which parents the block scope. Variables defined through any scope should be predefined with the &lt;code&gt;let&lt;/code&gt; or &lt;code&gt;const&lt;/code&gt; tag, as the &lt;code&gt;var&lt;/code&gt; tag can allow variables to be referenced in the scope's parents.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Gy4dCLZT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.stevethedev.com/storage/app/uploads/public/5aa/d54/a47/5aad54a47d2e0123286333.png/" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Gy4dCLZT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.stevethedev.com/storage/app/uploads/public/5aa/d54/a47/5aad54a47d2e0123286333.png/" width="600" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Scope - MDN Web Docs "&lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Scope"&gt;https://developer.mozilla.org/en-US/docs/Glossary/Scope&lt;/a&gt;"&lt;/p&gt;

&lt;p&gt;JavaScript Scope - Steve the Dev "&lt;a href="https://www.stevethedev.com/blog/programming/javascript-scope-primer"&gt;https://www.stevethedev.com/blog/programming/javascript-scope-primer&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;JavaScript Variable Scopes - JavaScript Tutorial&lt;br&gt;
"&lt;a href="https://www.javascripttutorial.net/javascript-variable-scope/#:%7E:text=JavaScript%20has%20three%20scopes%3A,Block%20scope%20(started%20from%20ES6)"&gt;https://www.javascripttutorial.net/javascript-variable-scope/#:~:text=JavaScript%20has%20three%20scopes%3A,Block%20scope%20(started%20from%20ES6)&lt;/a&gt;"&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>scope</category>
    </item>
  </channel>
</rss>
