<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jacob Logan on Medium]]></title>
        <description><![CDATA[Stories by Jacob Logan on Medium]]></description>
        <link>https://medium.com/@jacoblogan98?source=rss-475b106428be------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Z6l7WjRqLFwvAwkcfOZ5gg.jpeg</url>
            <title>Stories by Jacob Logan on Medium</title>
            <link>https://medium.com/@jacoblogan98?source=rss-475b106428be------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 02:29:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jacoblogan98/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How Flatiron Prepared Me to Be a Software Engineer]]></title>
            <link>https://medium.com/@jacoblogan98/how-flatiron-prepared-me-to-be-a-software-engineer-8a3009d9c91?source=rss-475b106428be------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a3009d9c91</guid>
            <dc:creator><![CDATA[Jacob Logan]]></dc:creator>
            <pubDate>Thu, 23 Jun 2022 14:17:57 GMT</pubDate>
            <atom:updated>2022-06-23T14:17:57.550Z</atom:updated>
            <content:encoded><![CDATA[<p>As my time at Flatiron School comes to an end, I want to reflect on my time in the Software Engineering program and mention the non-coding tools/skills that I learned. On top of learning robust full-stack web development, using React and Rails, Flatiron has taught me many valuable skills that will aid my success as I pivot my career into tech.</p><h3>How to Debug</h3><p>While debugging is partially a coding skill, it requires logic that isn’t necessarily tied to coding. Debugging requires critical and analytical thinking regarding the information flow in an app. It also requires knowledge of how to interpret error messages and use that information to guide your search for the issue. While Flatiron mainly teaches you how to utilize the technologies at hand to BUILD apps, they help you develop the critical thinking and a comprehensive understanding of how an app runs in order to help identify problems and fix bugs with ease.</p><h3>How to Find Answers on My Own</h3><p>The course load at Flatiron is massive, which is to be expected, as you learn how to build full-stack web apps in the span of a little over three months, as well as the best practices and trending software architectures. That being said, it’s simply impossible to cover EVERYTHING there is to know about HTML, CSS, Javascript, React, Ruby, and Rails in this time period. Flatiron gives you many resources to utilize in furthering your knowledge in these technologies. On top of that, they teach you how to identify a good source of information, and to better formulate your searches to find desired information. Since I won’t be using this information that I learned forever, I feel secure knowing that I am prepared to find answers on my own in the future if need be.</p><h3>How to Create What is in My Mind</h3><p>One issue I have never had was finding the “what” that I wanted to create. But, I did run into the trouble of finding the “how” to actually create what was in my mind. Flatiron has taught me numerous tools, technologies, practices, and shown me resources that I can use to create almost anything I can think of, with enough practice of course.</p><h3>How to Build My Network</h3><p>Another benefit of going to Flatiron is its career services. Every phase, you have a meeting with the Career Services team to discuss and work on topics such as building your LinkedIn, your resume, your personal “brand”, and how to utilize their career network in the app, Huntr. On top of that, after graduation, you are assigned a career coach who will guide you through your job search, help you optimize you resume, interview skills, etc. One thing that I was lacking before coming to Flatiron was my network, I didn’t even have a LinkedIn. Flatiron’s Career Services taught me how to not only build my LinkedIn page, but how to optimize it so that I appeared in more searches. As of today, I now have over 500 connections on LinkedIn, and my network is continuing to grow. As you may know, the job hunt in tech is more about WHO you know rather than where you apply, so for that, I am grateful that I have learned this skill at Flatiron.</p><h3>How to Learn in a Short Period of Time</h3><p>With the amount of information you need to cover to graduate from Flatiron, with the small timeframe of 15 weeks, you need to learn how to learn quickly. Flatiron’s curriculum is structured in a way that it targets what you need to know in order to move onto the bigger concepts, or how to better understand the structure of what you are creating. That structure helps you avoid bouncing from topic to topic without making any real progress, and definitely helped me cover a lot more ground in 15 weeks than I would have on my own. With that boost in knowledge of software architecture, and knowing how the back-end and front-end interact, I feel comfortable knowing how to guide my future learning in tech.</p><h3>How to Continue Learning</h3><p>In the end, one of the most important skills to have as a software engineer is the ability to continue learning and developing new skills. Flatiron has shown me numerous resources to further and continue my learning, as well as taught me how to identify new skills that would further build my personal “brand”. On top of that, I believe learning new languages and technologies will be easier to grasp now that I understand fundamental concepts of software architecture such as object-oriented programming, RESTful APIs, the Model-View-Controller, and many more topics.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a3009d9c91" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Get Started with Bootstrap in React]]></title>
            <link>https://medium.com/@jacoblogan98/how-to-get-started-with-bootstrap-in-react-c31e4e639dc5?source=rss-475b106428be------2</link>
            <guid isPermaLink="false">https://medium.com/p/c31e4e639dc5</guid>
            <dc:creator><![CDATA[Jacob Logan]]></dc:creator>
            <pubDate>Wed, 22 Jun 2022 23:43:57 GMT</pubDate>
            <atom:updated>2022-06-22T23:43:57.071Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog, I will be walking you through the process of setting up Bootstrap in your React project so that you can utilize its prebuilt components to build a responsive UI. Bootstrap is a popular CSS library that was started at Twitter in the mid-2010s. Since then, it has been evolving and is currently maintained as an open-source project on GitHub. React Bootstrap is a CSS and Javascript library that utilizes both vanilla Bootstrap’s classes, as well as pre-built React components. These pre-built components are well-documented and have a ton of customizability.</p><h3>Installing/Configuration Bootstrap</h3><h4>Installation</h4><p>In order to add Bootstrap to your dependencies, you’ll want to open the terminal in your project directory and run:</p><pre>npm install react-bootstrap bootstrap sass</pre><p>This will install both the React-Bootstrap package, which contains the React components, as well as vanilla Bootstrap, which is useful for further customization and its classes. This command also installs <a href="https://sass-lang.com/">Sass</a>, which is a CSS preprocessor, and will be used for understanding how Bootstrap works, as well as help in customization.</p><h4>Configuration</h4><p>In order to configure Bootstrap in your project, you will want to make an index.scss file, which is a Sass file, that will be used as the stylesheet for your React project. In your index.scss file, you want to place the following line:</p><pre>@import &quot;~bootstrap/scss/bootstrap&quot;;</pre><p>Then, in either your index.js or your App.js file, you will want to import the stylesheet like so:</p><pre>import &#39;./index.scss</pre><p>After typing these two lines, you will have access to all Bootstrap classes and styles in your React project.</p><h4>Customizing Bootstrap</h4><p>But what if you wanted to change the color palette from the default palette? You could change them by adding these lines to your index.scss :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*JPnVbQQFkVU9l1o21hdMzQ.png" /><figcaption>Overriding the default Bootstrap color palette</figcaption></figure><p>In order to understand what is happening here, you need to understand a bit of how Sass works. In Sass, anything starting with a $ is a variable, meaning that it is reusable in functions, mix-ins, and interpolation. This is useful because when you want to change a color, you do not need to change the color in every spot that it is used, you only need to change it in the variable. While simply overriding the values in $theme-colors would add the colors to the palette, you also need to override the colors so that they are used in all of Bootstrap’s functions and mix-ins for rendering out classes and components. Things such as hover and click effects will not work properly with your new palette unless you import the functions, variables, and mix-ins AFTER you override the default color variables.</p><h3>Using Bootstrap in React</h3><p>Now that I have covered configuring Bootstrap within your React application, I will now cover how to use Bootstrap classes and React components to build out your UI.</p><h4>Importing Bootstrap Components</h4><p>When using Bootstrap’s pre-built components, you should opt for importing only what you need, rather than importing the entire Bootstrap library in each React component. For example, if you wanted to import a card and a button from Bootstrap:</p><pre>//importing only the components needed:<br>import Card from &#39;react-bootstrap/Card&#39;;<br>import Button from &#39;react-bootstrap/Button&#39;;</pre><pre>//importing the entire Bootstrap library<br>import { Card, Button } from &#39;react-bootstrap&#39;;</pre><p>While the second choice seems cleaner, in the long run it will lead to massive slowdowns and a very large end product, as Bootstrap is a massive library. After importing, you can use the component like any other React component. An example of a card component with a button might look like:</p><pre>&lt;Card style={{ width: &#39;12 rem&#39; }}&gt;<br>  &lt;Card.Img variant=&quot;top&quot; src=&quot;exampleimg.jpg&quot; /&gt;<br>  &lt;Card.Body&gt;<br>    &lt;Card.Title&gt;This is Card&#39;s Title&lt;/Card.Title&gt;<br>    &lt;Card.Text&gt;<br>      This is the text of a card in React using Bootstrap&#39;s built-in Card component<br>    &lt;/Card.Text&gt;<br>    &lt;Button variant=&quot;secondary&quot;&gt;View Post&lt;/Button&gt;<br>  &lt;/Card.Body&gt;<br>&lt;/Card&gt;</pre><p>As you can see, this is a lot more efficient than creating CSS classes from scratch and fiddling with them until you get something you like. However, understanding how CSS operates helps massively when using Bootstrap’s classes on your custom React components and JSX.</p><h4>Using Bootstrap Classes</h4><p>In React using vanilla Bootstrap is still helpful, especially for formatting and making your layout responsive. By default, Bootstrap has six breakpoints that can be used for changing styling in your app depending on the window size. The default breakpoints are as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IqbCIQ7BKc0tFDB3Rk61UQ.png" /></figure><p>For example, you may want to change your font size, the way your flexbox components stack, or change the margin/padding depending on the window size. Let’s use the example for margin and padding. With margin and padding, the classes start with an m or p respectively. Next, you have the option of either the top, start (left), end (right), bottom, sides (x-axis), or top and bottom (y-axis). Then, you can add a value for which margin/padding you have selected, between 0 and 5. You can also use auto to center them vertically or horizontally. Lastly, you can add the breakpoint at which you want to set that desired margin/padding. All together, some classes might look like:</p><pre>//margin top of 3, at a breakpoint of large:<br>className=&quot;mt-3-lg&quot;</pre><pre>//centered horizontally and vertically at a breakpoint of small:<br>className=&quot;mx-auto-sm my-auto-sm&quot;</pre><pre>//padding bottom of 3 and margin right of 5 at a breakpoint of x-small:<br>className=&quot;pb-3 me-5&quot;</pre><p>If no breakpoint is given, Bootstrap will apply that styling to the breakpoint of extra-small. If there are no other classes with breakpoints listed, that style will be used at every size.</p><h3>Conclusion</h3><p>As you can see, Bootstrap is a library that speeds up the design process of your UI in a React app. While it can be a bit to get acclimated to, it is great to work with and customize once you get comfortable with it. With React Bootstrap you have access to pre-built components, as well as the versatile classes provided in vanilla Bootstrap. On top of that, if you know a bit of Sass, you can easily tweak and customize the default styling of the Bootstrap library to fit your needs. For more resources, I highly recommend the <a href="https://getbootstrap.com/docs/5.1/getting-started/introduction/">Bootstrap</a> docs, the <a href="https://react-bootstrap.github.io/">React Bootstrap</a> docs, and the <a href="https://sass-lang.com/documentation/">Sass</a> docs. Thank you for reading, and I hope this helped you in gaining a better understanding of Bootstrap in React.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c31e4e639dc5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the MVC with Rails]]></title>
            <link>https://medium.com/@jacoblogan98/understanding-the-mvc-with-rails-c5222e7e81d2?source=rss-475b106428be------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5222e7e81d2</guid>
            <category><![CDATA[mvc-frameworks]]></category>
            <category><![CDATA[rails]]></category>
            <dc:creator><![CDATA[Jacob Logan]]></dc:creator>
            <pubDate>Wed, 22 Jun 2022 15:45:46 GMT</pubDate>
            <atom:updated>2022-06-22T15:45:46.380Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is the MVC?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Msnffy6T1Rg2cJ8tNrp77w.png" /></figure><p>The MVC, or Model-View-Controller, is a software design pattern commonly used in web app APIs. In this architecture, the logic that handles the request-response cycle in the back-end is split across three interconnected elements: the model, the view, and the controller.</p><p>A good way to visualize how this system works is to imagine a restaurant. First, we have a chef, which works in the kitchen, and cooks up the food. We also have a waiter, that takes orders back to the kitchen, and food from the kitchen to the dining area. Lastly, we have the table where the food is served to the customer.</p><p>We can think of the model as the chef, as it handles communication with the database, using Active Record. The model also contains validations to ensure the data being sent to the database fits with the desired data of the application.</p><p>The controller works as the waiter, as it transmits the data requests from the client to the model, and then sends the response back when the data is accessed.</p><p>Finally, the view is the table in this restaurant. The view does not handle any programming logic, it simply renders whatever is sent to it by the controller. In a Rails app, you have the option of using the built-in .erbformat in your views folder, or send JSON data to your client-side framework of choice, such as React.</p><h3>Data Flow in the MVC structure</h3><p>In Rails, the MVC structure is set up for you automatically, the views files communicate directly with the controller files, which speak directly with the models. For example, say you have a database table called “blogs”, you would have the following files:</p><ul><li>An app/models/blog.rb model file, which handles database relationships, callbacks, validations, and any custom logic for blog models.</li><li>An app/controllers/blogs_controller.rb controller file, which will contain methods for managing the flow of data, including full CRUD features. The typical methods are index, show, create, update, and destroy.</li><li>An app/views/blogs folder that will contain a different view file for each page the user will have access to. However, in a Rails API application, you won’t have a dedicated views folder.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J_iBiRLURjYTXz5mTwQBzA.png" /><figcaption>An example of the flow of data in an MVC architecture</figcaption></figure><h3>Roles / Separation of Concerns</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lo0Bv5SIGQCHvgDJBLQxJA.png" /></figure><h4>Models</h4><p>At its core, a model file is a Ruby class. When connected to a database, it will inherit from theActiveRecord::Base class, which allows it to interact directly with the database. Since it is a Ruby class, you can also create custom methods, validations, relationships with other classes, and everything else you can do with a normal class. The purpose of the model file is to handle the domain logic that the controllers and views don’t “know about”. If we refer back to the restaurant analogy, the waiter and table don’t see the meal being made, they just handle it once it is prepared.</p><h4>Controllers</h4><p>The controller files connect the models, views, and routes in the app. They are the “waiter” of the app. It takes the order, or the request from the client, and takes it to the kitchen, which is the model. Then, when the food is ready, it takes the food back to the client. Typically, there is a routes file that when the defined end point receives a request from the client, a controller method is called. The controller will then access data using the model, and uses that data to render the correct view, whether that be an .erb file or JSON data.</p><h4>Views</h4><p>In a Rails app, the view has the least amount of logic, as its purpose is to simply render whatever data is sent to it from the controller. The data used in the view layer depends on what kind of app we are creating. In a full-stack Rails application, you can use a .erb file to render html for your view. If you’re using Rails for an API, and rendering the front-end in a different framework, such as Angular or React, you can send a JSON response to be rendered in the front-end. The data used in the view is created by the models, which is then sent by the controller to the view.</p><h3>Conclusion</h3><p>As you can see, Rails is a framework that relies on the MVC structure very strongly, and lays out the groundwork for utilizing this practice. With the separation of concerns of each component, you end up with clean code that is easier to work with and debug. I hope this blog helped in gaining a better understanding of both how the model-view-controller architecture works, and how Rails utilizes these ideas.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5222e7e81d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Active Record to Tame Your Database]]></title>
            <link>https://medium.com/@jacoblogan98/using-active-record-to-tame-your-database-3466fcff9e5?source=rss-475b106428be------2</link>
            <guid isPermaLink="false">https://medium.com/p/3466fcff9e5</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[activerecord]]></category>
            <category><![CDATA[activerecord-association]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Jacob Logan]]></dc:creator>
            <pubDate>Thu, 12 May 2022 14:04:16 GMT</pubDate>
            <atom:updated>2022-05-12T14:15:12.120Z</atom:updated>
            <content:encoded><![CDATA[<p>Throughout the third phase in Flatiron School’s Software Engineering program, we’ve covered a myriad of topics. The main focus of the phase was the language of Ruby and object-oriented programming, but we also delved into other backend technologies, such as SQL, object relational mapping, Active Record, and Sinatra. While Active Record and Sinatra are Ruby gems, they bring a whole new vocabulary of actions and file structure for configuring and running our applications. In this post I will cover how Active Record can streamline the process of building out your database, performing CRUD actions on that data, seeding your data, and building out relationships between your database tables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*_z5EUdE53Yq2MQ4wLiMhsQ.jpeg" /><figcaption>Image Source: <a href="https://www.datamation.com/careers/database-job-market/">https://www.datamation.com/careers/database-job-market/</a></figcaption></figure><h3><strong>What is Active Record?</strong></h3><p><a href="https://guides.rubyonrails.org/active_record_basics.html#what-is-active-record-questionmark">Active Record</a> is a Ruby gem that works as an <a href="https://en.wikipedia.org/wiki/Object%E2%80%93relational_mapping">Object-Relational-Mapper</a>, or ORM. An ORM is used to relate our objects to our database, which allows our database tables to be mapped to objects. Rather than hard-code each SQL query, we can use Active Record alongside our classes and objects to manipulate our databases with much more ease. Active Record also comes with a ton of handy built in methods for performing CRUD actions on our databases.</p><h3>Configuring Active Record</h3><p>To begin using Active Record in your Ruby application, you first need to install the gem, create your database connection, create a table, and link a model to the table. To install the Active Record gem, go to your terminal and type:gem install activerecord. Next, to set up your database connection you run a command called ActiveRecord::Base.establish_connection.</p><pre>ActiveRecord::Base.establish_connection(<br>  adapter: &quot;sqlite3&quot;,<br>  database: &quot;db/students.sqlite&quot;<br>)</pre><p>Once this command is run, the connection is stored as a class variable in ActiveRecord::Base.connection. Next, you need to create a SQL table, you can do this by running the following command:</p><pre>sql = &lt;&lt;-SQL<br>  CREATE TABLE IF NOT EXISTS programmers (<br>    id INTEGER PRIMARY KEY,<br>    name TEXT<br>  )<br>SQL<br><br>ActiveRecord::Base.connection.execute(sql)</pre><p>Lastly, we need to link a model to the database table, like so:</p><pre>class Programmer &lt; ActiveRecord::Base<br>end</pre><p>By making our class a subclass of ActiveRecord::Base, we now have access to the database table through Active Record, along with all of the <a href="https://guides.rubyonrails.org/active_record_basics.html#crud-reading-and-writing-data">methods</a> that come along with it.</p><h3>Creating and Updating Tables with Migrations</h3><p>A handy way of automating the process of creating new tables and updating them is provided with a combination of <a href="https://github.com/ruby/rake">rake</a> tasks and the <a href="https://github.com/sinatra-activerecord/sinatra-activerecord">sinatra-activerecord</a> gem. <a href="https://guides.rubyonrails.org/active_record_migrations.html">Migrations</a> are similar to a type of version control for your database schemas, and you can run them using the built-in rake tasks provided by the sinatra-activerecord gem. To create a new migration, run this command in your terminal:</p><pre>bundle exec rake db:create_migration NAME=create_programmers</pre><p>This will create a new .rb file in your db/migrations folder starting with a time stamp, followed by the name you entered. Inside that file, you will find some pre-built code, such as:</p><pre>class CreateProgrammers &lt; ActiveRecord::Migration[6.1]<br>  def change<br>  end<br>end</pre><p>In order to make a table out of this class, we need to fill out our #change method. There are a couple of handy methods inherited from ActiveRecord::Migration that allow us to modify our schema, including create_table, remove_table, add_column, and remove_column. For this post, I will be focusing on the create_table method. After calling the create_table method, you pass in the desired table name as a symbol, followed by a block of code that is passed the parameter |t| . This parameter is an Active Record migration object that allows us to add different columns to the table. Let’s take a look at a completed migration that makes the table programmers :</p><pre>class CreateProgrammers &lt; ActiveRecord::Migration[6.1]<br>  def change<br>    create_table :programmers do |t|<br>      t.string :name<br>      t.string :programming_language<br>      t.integer :age<br>    end<br>  end<br>end</pre><p>As you can see, following the t we have the data type and the name of the column as a symbol. You may notice that we are missing the primary key, but that is automatically assigned by Active Record once the migration is run. In order to run the migration, and create the table, you run this command in your terminal:</p><pre>bundle exec rake db:migrate</pre><p>Congratulations! You have now used Active Record to create a new SQL table that you can interact with. In order to interact with the database, we need to create a model for the database, which is a class that will define methods that can be used to manipulate/query our data. To create our model, we create a class like so:</p><pre>class Programmer &lt; ActiveRecord::Base<br>end</pre><p>Now we have access to our database and can use <a href="https://guides.rubyonrails.org/active_record_basics.html#crud-reading-and-writing-data">methods</a> to perform CRUD actions on it.</p><h3>Seeding your Database</h3><p>So far, we’ve seen how to create tables, map models to them, and use methods to add data. This stores the data in your local database, but what if you had multiple developers working on the same application, and you wanted consistency in data across the project? Rather than sharing the actual database with other developers, we use migrations and seeds to create the database and fill it with data. Upon opening a copy of the repository, you can run:</p><pre>bundle exec rake db:migrate <br>bundle exec rake db:seed</pre><p>This will run all of the migrations, creating your database, and then seed that database, with the information stored in the seeds.rbfile in your db directory. Some example code in your seeds.rb file might look like:</p><pre>Programmer.create(name: &quot;Jacob&quot;, programming_language: &quot;Ruby&quot;, age: 24)<br>Programmer.create(name: &quot;John&quot;, programming_language: &quot;JavaScript&quot;, age: 22)<br>Programmer.create(name: &quot;Jane&quot;, programming_language: &quot;Python&quot;, age: 27)<br>Programmer.create(name: &quot;Jessie&quot;, programming_language: &quot;C&quot;, age: 25)</pre><p>By running bundle exec rake db:seed, all of these instances will be created and populate the database table. Now, you can use Active Record’s <a href="https://guides.rubyonrails.org/active_record_querying.html">query methods</a> to look through your populated data and save useful queries in methods in your models.</p><h3>Active Record Associations</h3><p>Now that we have seen how to configure Active Record, create migrations, seed our data, and query over our data, it is time to learn to how to create relations between our models. Much like in SQL (a relational database), we have relations between tables, via a foreign key, Active Record provides us with <a href="https://guides.rubyonrails.org/association_basics.html#the-types-of-associations">association macros</a> to build these relationships. If you have used Ruby before, you probably have already seen macros before, such as the attr_reader and attr_accessor macros. The Active Record macros I will be discussing are the has_many and belongs_to methods.</p><h4>One-to-Many Associations</h4><p>Say we have our Programmer model, and say we want each programmer to have many projects, we could create a new table :projects and a new model Project and seed it with data like so:</p><pre>Project.create(name: &quot;Tech Trivia Tango&quot;, programmer_id: 1)<br>Project.create(name: &quot;Mad React&quot;, programmer_id: 1)<br>Project.create(name: &quot;PT Calendar&quot;, programmer_id: 2)<br>Project.create(name: &quot;Dog Walker&quot;, programmer_id: 4)</pre><p>You can see that in the database, there is a one-to-many relationship between programmers and projects. Now, we need to create the relationship between the models. In our Programmer model, we can add:</p><pre>class Programmer &lt; ActiveRecord::Base<br>   has_many :projects<br>end</pre><p>This will create a method, #projects, that can be called on an instance of the Programmer class, and return an array of all project instances associated with that programmer. We can also provide access to what programmer a project instance belongs to by using the belongs_to macro like so:</p><pre>class Project &lt; ActiveRecord::Base<br>   belongs_to :programmer<br>end</pre><p>Similarly, we can now call the method #programmer on any instance of the Project class and get the Programmer instance that is associated with the project.</p><h4>Many-to-Many Associations</h4><p>Now, let’s say that we have many programmers working on many projects together, creating a relationship where a given project has many programmers, and conversely, a given programmer has many projects. We could create this relationship by creating a table through migration called programmer_projects. Then we can create our model and seed the table. Our join model will look like this:</p><pre>class Programmer_Projects &lt; ActiveRecord::Base<br>  belongs_to :programmer<br>  belongs_to :project<br>end</pre><p>Now, in order to access your many-to-many relationship between the Programmer model and your Project model, you can utilize the has_many through: macro. Your updated Project and Programmer classes would look like so:</p><pre>class Programmer &lt; ActiveRecord::Base<br>   has_many :programmer_projects<br>   has_many :projects, through: :programmer_projects<br>end</pre><pre><br>class Project &lt; ActiveRecord::Base<br>   has_many :programmer_projects<br>   has_many :programmers, through: :programmer_projects<br>end</pre><p>Now, we can call the #programmers method on instances of our Project class, and we can call the #projects method on instances of our Programmer class. By creating the join table, and join model, you are able to create many-to-many associations within Active Record to add even more flexibility to your database manipulation and querying.</p><h3>Conclusion</h3><p>In this blog post, I have explained what Active Record is, how to set it up, how to use it to create databases and tables through migrations, how to seed your tables, and how to create associations between your models. For further research, I highly recommend checking out the <a href="https://guides.rubyonrails.org/active_record_basics.html">Active Record docs</a>. Thanks for reading, and follow for more!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3466fcff9e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Git Branching]]></title>
            <link>https://medium.com/@jacoblogan98/understanding-git-branching-5d01f3dda541?source=rss-475b106428be------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d01f3dda541</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[branching-strategy]]></category>
            <category><![CDATA[branching]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Jacob Logan]]></dc:creator>
            <pubDate>Tue, 19 Apr 2022 23:30:40 GMT</pubDate>
            <atom:updated>2022-04-19T23:36:30.570Z</atom:updated>
            <content:encoded><![CDATA[<p>During my time at Flatiron School, I’ve been working with Git, from forking labs, to submitting code challenges, to working on group projects. However, I’ve never really fully quite <em>understood</em> what these commands were doing, or how Git itself was storing the changes made to my repositories. My goal with this blog post is to share what I’ve learned about different types of Git branching, and hopefully it can demystify a few things for you as well, if you too are just entering the world of version control.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*e6EkEBIDZcOmlwPqCnsJKg.jpeg" /><figcaption>Image source: <a href="https://www.perforce.com/blog/vcs/git-branching-model-multiple-releases">https://www.perforce.com/blog/vcs/git-branching-model-multiple-releases</a></figcaption></figure><h3>What is a Git Branch?</h3><p>According to the official documentation from <a href="https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell">Git</a>, it is simply defined by this statement,</p><blockquote>“ Branching means you diverge from the main line of development and continue to do work without messing with that main line.”</blockquote><p>This means a new copy of the main repository is made, and after it is split off of the original path, it is free to be modified, without making permanent changes to the original “main” branch. There are many different branching strategies that different projects utilize, as they each provide different benefits that may fit different workflows better than others. To make a branch, we type:</p><blockquote>git branch &lt;new-branch&gt;</blockquote><blockquote>git checkout &lt;new-branch&gt;</blockquote><p>This excerpt creates a new branch, and switches the path of your commits from the main branch to the newly made branch. After a change is ready to be published permanently to the main branch, we reconvene the branch onto the main, using a merge. A merge is executed by switching over to the branch you want to merge into, and then calling the merge command, like so:</p><blockquote>git checkout main</blockquote><blockquote>git merge &lt;new-branch&gt;</blockquote><p>Now that I’ve covered the basics of what a branch is, and how to create/merge them, I will go over a few common branching strategies that are used in the industry.</p><h3>Trunk-Based Development</h3><p>This type of development is the most straightforward method of Git collaboration. As the name implies, the development is done directly on the “trunk”, or main branch, with no other long-standing extraneous branches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_QSBkbpOZ-MJGOpRkucA4Q.jpeg" /><figcaption>Image source: <a href="https://www.optimizely.com/optimization-glossary/trunk-based-development/">https://www.optimizely.com/optimization-glossary/trunk-based-development/</a></figcaption></figure><p>While this structure is very simple and easy to use, it requires a team that is very efficient and clean in their code. When changes are pushed directly onto the main branch, there is a much larger margin for small bugs to cause more dramatic impacts to the project than some of the more “secure” options. One way to mitigate this issue is to have very stringent testing and analysis before being deployed.</p><p>A staple of trunk-based development is a process called <a href="https://resources.github.com/ci-cd/"><strong>continuous deployment</strong></a>. Continuous deployment is a method of automating the deployment of your application. When working with continuous deployment, after your push passes through automated test scripts, it is automatically deployed with the new change. A major benefit to this automated process is that it is efficient, stable, and allows for smaller changes more often, rather than waiting for one big change to go into effect.</p><h3>Feature Branching/Github Flow</h3><p>Feature branching is still a relatively simple strategy, but offers some more safeguards to keep the main branch safe until changes on a branch are approved through a <a href="https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests"><strong>pull request</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*-JypY26hUj13C-QdexYf7Q.jpeg" /><figcaption>Image source: <a href="https://build5nines.com/introduction-to-git-version-control-workflow/">https://build5nines.com/introduction-to-git-version-control-workflow/</a></figcaption></figure><p>In feature branching, each new feature is made on its own branch, which is then subjected to approval and feedback through a pull request before being tested and merged back onto the main. Typically this type of development has short delivery cycles, meaning that features are made in small chunks, and may only take a couple hours to a day to complete.</p><p>Typically, this method of development utilizes <a href="https://resources.github.com/ci-cd/"><strong>continuous delivery</strong></a><strong>, </strong>which is very similar to continuous deployment, but the automation process ends before the project is pushed to production. This is a safeguard to prevent any possible bugs from slipping through the cracks in the tests. While this is a “safer” method, it also takes more time, and can lead to more delays in production compared to continuous deployment.</p><h3><strong>Forking Strategy</strong></h3><p>This method is very similar to the feature branching method, but instead of building out branches for each feature, individuals <a href="https://docs.github.com/en/get-started/quickstart/fork-a-repo"><strong>fork</strong></a> the main repository. With the forked copy, also called the origin, of the entire repository on their local environment, developers will make changes to that copy, and once the desired effect is created, send a pull request for their new copy to be merged back to the main branch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*NTPIIiRTjBoapWktEqgztw.png" /><figcaption>Image Source: <a href="https://www.tomasbeuzen.com/post/git-fork-branch-pull/">https://www.tomasbeuzen.com/post/git-fork-branch-pull/</a></figcaption></figure><p>This strategy is most common in <a href="https://www.redhat.com/en/topics/open-source/what-is-open-source"><strong>open-source development</strong></a>, where any individual can access the code, and can offer advice or changes, without necessarily being a part of the main developers. The benefit of this method is that only the team of developers of the project are in control of the original repo, and are able to approve or decline any modifications that are proposed from outside sources. This allows for unlimited access and contributions from outside sources, yet keeps the main product completely safe from possible harm or detrimental changes.</p><h3>Release Branching</h3><p>Release branching is similar to feature branching, but instead of short-lived branches that handle small changes, release branches handle major changes to the code, and last for much longer durations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_78B9lNqm5MEinoc6QXoDg.png" /><figcaption>Image Source: <a href="http://releaseflow.org/">http://releaseflow.org/</a></figcaption></figure><p>One caveat of this branching strategy is that it is better suited for low-frequency deployments, or less frequent updates. Since the branches are much longer-lived, and contain much more modifications, it takes a longer time to see those changes be deployed. Things also get a bit more complicated with this method, as communication between teams on a project can be disconnected, as they are working on different long-term changes on the project. This may also lead to <a href="https://www.atlassian.com/git/tutorials/using-branches/merge-conflicts"><strong>merge conflicts</strong></a> if branches are not kept up to date with the main. Ultimately, this method is not optimal for most situations, due to how slow the process can be, and how complicated it is.</p><h3>Git Flow</h3><p>With the Git flow branching strategy, things get even more complicated. Alongside the main branch, a development branch is made, and runs parallel to the main. Rather than making feature and release branches off of the main branch, as seen previously, they are branched off of the development branch instead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*XisKxHPtbqcoK7EYjc_qQw.png" /><figcaption>Image Source: <a href="https://www.campingcoder.com/2018/04/how-to-use-git-flow/">https://www.campingcoder.com/2018/04/how-to-use-git-flow/</a></figcaption></figure><p>With this complexity, there is an immense amount of security, but again, it is also costly for time efficiency and frequent changes. This branching strategy is only suitable for very large-scale projects and companies, where the task of creating these branches, managing all pull requests, and handling the merges can be the sole task of an individual. This method is only warranted by a large task force dealing with massive amounts of information that needs to be completely controlled and handled by “hand”.</p><h3><strong>Conclusion</strong></h3><p>As you can see, there are many different ways branching can be handled in collaborative projects with Git. While it may seem daunting to try to understand which may be the best fit for your needs, I would suggest keeping your structure as simple as possible, and make your changes as small and efficient as possible. While something like trunk-based development may seem appealing due to its simplicity, you need to have an immensely small room for error to actually use this method effectively. On the other hand, something such as the Gitflow strategy will definitely be overkill for a small two-person web app project. The ideal method of handling your development is finding one that keeps things simple enough to allow ease of functionality, while simultaneously keeping your main branch safe from bugs and potential coded “potholes” in your adjustments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d01f3dda541" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>