<?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: Jonathan-Bryant19</title>
    <description>The latest articles on DEV Community by Jonathan-Bryant19 (@jonathanbryant19).</description>
    <link>https://dev.to/jonathanbryant19</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%2F806032%2F4ad6a144-f815-4449-9070-2a82888f8017.jpg</url>
      <title>DEV Community: Jonathan-Bryant19</title>
      <link>https://dev.to/jonathanbryant19</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jonathanbryant19"/>
    <language>en</language>
    <item>
      <title>The Infinite Impact of Technology - My Reasons for Pivoting to Software Engineering</title>
      <dc:creator>Jonathan-Bryant19</dc:creator>
      <pubDate>Thu, 31 Mar 2022 16:40:46 +0000</pubDate>
      <link>https://dev.to/jonathanbryant19/the-infinite-impact-of-technology-my-reasons-for-pivoting-to-software-engineering-57ka</link>
      <guid>https://dev.to/jonathanbryant19/the-infinite-impact-of-technology-my-reasons-for-pivoting-to-software-engineering-57ka</guid>
      <description>&lt;p&gt;I was born before the internet and technology took over, and I'm grateful for that. &lt;/p&gt;

&lt;p&gt;It's not a nostalgic clinging to the past that I can credit for that gratitude, but rather the fact that I'm caught in an endless loop of amazement. Playing video games on a TV was mind blowing to me as a kid because of the fact that I remember a time before that was normal. &lt;/p&gt;

&lt;p&gt;With each new piece of technology that amazement never left. I remember being shocked when my dad showed me how his pager worked. Cell phones came along a little while after and it hit me again. Now, as an adult, I see what's happening with AR/VR, machine learning, and AI and I know the ride is nowhere near over. &lt;/p&gt;

&lt;p&gt;When I was around 12 years old my parents bought me a book on programming. I had absolutely no idea what it was talking about but I kept going back to it over and over again. I never got anything substantial out of that book, but my fascination with the inner workings of technology never left.&lt;/p&gt;

&lt;p&gt;As much as I was fascinated by technology, the thought of making it my career was never fully explored by the time college rolled around. Whether it be fate, circumstance, or a combination of both, I wound up studying psychology and ultimately entered the field of Applied Behavior Analysis (ABA).&lt;/p&gt;

&lt;p&gt;ABA is a set of scientific principles that leverage the fundamentals of learning and motivation in order to change behaviors of social significance. ABA is most well known for its effective use in the treatment of autism and other developmental disorders. I spent nearly 15 years in the field and came to know its inner workings quite well. However, the industry hasn't evolved in ways I expected especially in terms of technology.&lt;/p&gt;

&lt;p&gt;Before I go further, I need to admit that I didn't see the value in the iPad when it first came out. When it was released I felt it was just an oversized cell phone without much utility, and even though I was fortunate enough to receive one for Christmas I didn't use it much.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Then I brought it to work with me one day.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdm7lwis92tlusq9qdd0c.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdm7lwis92tlusq9qdd0c.jpeg" alt="Steve Jobs first iPad"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You gotta understand that working with children with autism has its own unique challenges, chief among them being fleeting attention and motivation. However, the response I got when I started incorporating an iPad into my sessions was incredible. Suddenly, gaining the attention of my clients and keeping them motivated was &lt;strong&gt;much&lt;/strong&gt; easier and sessions were more productive as a result. &lt;/p&gt;

&lt;p&gt;I fully expected to see an onslaught of applications aimed at supporting this niche, but that never happened. Don't get me wrong, there have been tools like &lt;a href="https://www.assistiveware.com/products/proloquo2go" rel="noopener noreferrer"&gt;Proloquo2Go&lt;/a&gt; and &lt;a href="https://centralreach.com/" rel="noopener noreferrer"&gt;CentralReach&lt;/a&gt; that have done great things, but there's so much more that can be done. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5q1me420ywj722pz7cqf.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5q1me420ywj722pz7cqf.jpeg" alt="Proloquo Screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I didn't see what I thought should exist, I began working out my ideas and hired freelancers to help start putting things together. That has been a very slow process, due mainly to the fact that it has been self funded. &lt;/p&gt;

&lt;p&gt;Around the same time, the company I was working for decided to transition from pen/paper data collection to data collection using tablets. The software exported data in a format that was difficult for employees to manage and the developers recommended we learn to write macros to format the data as needed. I had no idea what a macro was, but I volunteered to give it a shot. &lt;/p&gt;

&lt;p&gt;In retrospect, I think that's the moment everything changed. I felt like that 12 year old kid again, only this time I had the mental faculties of an adult and access to Google. Once I realized what was possible I was hooked. I spent as much time as I could spare working on it for three months, but it was worth it. The end result allowed the company to know everything they need to know about a program in order to make clinical decisions quickly. A process that used to take several weeks suddenly took a matter of minutes. It was a game changer. &lt;/p&gt;

&lt;p&gt;The more I thought about how technology could impact the quality of care the more I felt it was necessary. &lt;a href="https://www.cdc.gov/ncbddd/autism/data.html" rel="noopener noreferrer"&gt;According to the CDC&lt;/a&gt;, 1 in 44 children in the United States are diagnosed with autism annually. With roughly &lt;a href="https://www.cdc.gov/nchs/fastats/births.htm" rel="noopener noreferrer"&gt;3.5 million&lt;/a&gt; births per year, that's approximately 80,000 diagnoses annually. Additionally, the &lt;a href="https://www.beaconhealthoptions.com/autisms-cost/#:~:text=A%20recent%20study%20estimates%20the,four%20years%20of%20treatment%3A%20%24240%2C000." rel="noopener noreferrer"&gt;average annual cost&lt;/a&gt; for ABA services is $60,000. Typically, ABA services begin around 3 years of age and terminate when the child starts school (around 6), which means that &lt;strong&gt;approximately 2 billion dollars&lt;/strong&gt; is spent on ABA treatment annually in the United States. &lt;/p&gt;

&lt;p&gt;So who pays for that?&lt;/p&gt;

&lt;p&gt;In California, insurance companies were mandated to provide coverage for ABA services back in 2012 and most states have followed suit. Although that has ensured access to care, it has also created a dynamic with pressure to keep the cost of care low. &lt;/p&gt;

&lt;p&gt;When all is said and done, there is a clear need to increase the quality and portability of care while decreasing the cost of that care. I believe technology is the means to make that happen and my hope is my shift to software engineering can expedite that goal.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Bust Bugs with the Byebug Bug Debugger</title>
      <dc:creator>Jonathan-Bryant19</dc:creator>
      <pubDate>Thu, 17 Mar 2022 16:48:13 +0000</pubDate>
      <link>https://dev.to/jonathanbryant19/bust-bugs-with-the-byebug-bug-debugger-bf2</link>
      <guid>https://dev.to/jonathanbryant19/bust-bugs-with-the-byebug-bug-debugger-bf2</guid>
      <description>&lt;p&gt;Byebug is a helpful and easy-to-use debugger made for Ruby. It allows developers to use traditional debugging features to help identify what is happening in a program &lt;em&gt;while&lt;/em&gt; it's running. Byebug was created by &lt;a href="https://github.com/deivid-rodriguez/byebug/blob/master/README.md" rel="noopener noreferrer"&gt;David Rodriguez&lt;/a&gt; in hopes of building a better Ruby debugger. &lt;/p&gt;

&lt;p&gt;The core features of Byebug include stepping through a program, setting breakpoints to pause a program, basic REPL functionality, and variable tracking. &lt;/p&gt;

&lt;h2&gt;
  
  
  Starting Byebug
&lt;/h2&gt;

&lt;p&gt;There are several ways to start a debugging session with Byebug. If you want to start the debugger from the first line of code, you can run your file from the command line and add the "byebug" prefix: &lt;code&gt;$ byebug /path/to/ruby_file.rb&lt;/code&gt;. Alternatively, adding the keyword &lt;code&gt;byebug&lt;/code&gt; to the source code will trigger a breakpoint and start a byebug session on execution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def printer(n)

    # breakpoint will trigger here
    byebug

    n.times do |i|
        puts "This is round #{i}"
    end
    puts "hello"
    puts "world"

end

printer(10)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Stopping Byebug
&lt;/h2&gt;

&lt;p&gt;Getting out of a byebug session is just as easy as getting into one. You can terminate a byebug session at any time by using the &lt;code&gt;quit&lt;/code&gt; or &lt;code&gt;q&lt;/code&gt; command. However, developers should be mindful that code following the current breakpoint will not execute once the byebug session is terminated using &lt;code&gt;quit&lt;/code&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  Navigating a Byebug Session
&lt;/h2&gt;

&lt;h3&gt;
  
  
  help
&lt;/h3&gt;

&lt;p&gt;It's always great to have quick access to info on what commands you can run while in a byebug session. The &lt;code&gt;help&lt;/code&gt; command will return a list of useable commands. &lt;code&gt;help &amp;lt;command-name&amp;gt;&lt;/code&gt; will return information specific to that command. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F15zj0ya56snwlh4nolef.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F15zj0ya56snwlh4nolef.jpg" alt="byebug help output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  continue
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;continue&lt;/code&gt; command allows the program to continue running after hitting a breakpoint. The program will continue to run until finishing or hitting another breakpoint. Additionally, when an integer is passed as an argument (e.g., &lt;code&gt;continue 5&lt;/code&gt;), the program will execute the number of lines passed as an argument before initiating another breakpoint. Alternatively, the &lt;code&gt;continue!&lt;/code&gt; variation will run the program and ignore any future breakpoints. &lt;/p&gt;

&lt;h3&gt;
  
  
  next
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;next&lt;/code&gt; command will execute the next line of code and only the next line of code. However, the &lt;code&gt;next&lt;/code&gt; command will step over method calls. It will also accept an integer as an argument and will execute the number of lines passed as the argument. &lt;/p&gt;

&lt;h3&gt;
  
  
  step
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;step&lt;/code&gt; is similar to &lt;code&gt;next&lt;/code&gt; with the key difference being that &lt;code&gt;step&lt;/code&gt; will step into (and execute) method calls. Since byebug remembers the last command you entered, simply hitting &lt;code&gt;return&lt;/code&gt;/&lt;code&gt;enter&lt;/code&gt; will continue running the program one line at a time with each press. Combining this feature with byebug's REPL functionality allows developers to access information about a program's state throughout each step of the program's execution. &lt;/p&gt;

&lt;p&gt;In this example, entering &lt;code&gt;next&lt;/code&gt; would cause byebug to skip the loop and jump to line 8. Entering &lt;code&gt;step&lt;/code&gt; will cause the first line of the loop to run. Subsequent &lt;code&gt;step&lt;/code&gt; commands will continue executing the loop. While inside the loop, we can access the value of &lt;code&gt;i&lt;/code&gt; at any time using byebug's REPL functionality.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg1wujkfu3zr193yyhi5u.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg1wujkfu3zr193yyhi5u.jpg" alt="next step example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  restart
&lt;/h3&gt;

&lt;p&gt;As the name implies, &lt;code&gt;restart&lt;/code&gt; will terminate and restart the program in byebug. This could save a few steps as you go through rounds of debugging.&lt;/p&gt;

&lt;h3&gt;
  
  
  irb
&lt;/h3&gt;

&lt;p&gt;It was a surprise to find that you can enter an IRB or VIM session &lt;em&gt;during&lt;/em&gt; a byebug session. Simple type &lt;code&gt;irb&lt;/code&gt; to initiate the session. When you exit IRB, you'll be right where you left off in the byebug session.&lt;/p&gt;

&lt;p&gt;These commands only begin to scratch the surface of what you can do with byebug. I'd recommend the following resources if you want to take a deeper dive on how to use this fantastic Ruby debugging tool.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/deivid-rodriguez/byebug/blob/master/README.md" rel="noopener noreferrer"&gt;The Byebug GitHub Repo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://fleeblewidget.co.uk/2014/05/byebug-cheatsheet/" rel="noopener noreferrer"&gt;ByeBug Command Cheatsheet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://rubygems.org/gems/byebug/versions/11.1.3" rel="noopener noreferrer"&gt;Ruby Gems Byebug Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Methods to the Madness - My First 10 Ruby Challenges</title>
      <dc:creator>Jonathan-Bryant19</dc:creator>
      <pubDate>Thu, 10 Mar 2022 04:38:29 +0000</pubDate>
      <link>https://dev.to/jonathanbryant19/methods-to-the-madness-my-first-10-ruby-methods-ej6</link>
      <guid>https://dev.to/jonathanbryant19/methods-to-the-madness-my-first-10-ruby-methods-ej6</guid>
      <description>&lt;p&gt;There's no better way to learn a new programming language than just writing code. Having just transitioned from JavaScript to Ruby for the first time, I found myself struggling to find the right method for the job. &lt;/p&gt;

&lt;p&gt;Websites like &lt;a href="https://leetcode.com/"&gt;LeetCode&lt;/a&gt; and &lt;a href="https://www.codewars.com"&gt;codewars&lt;/a&gt; are great for grinding out practice, so I decided to start logging which methods I needed to use and how often. To my surprise, I didn't wind up using the same method more than once across the first 10 Ruby problems I came across on &lt;a href="https://www.codewars.com"&gt;codewars&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Some of these answers I came up with on my own while several others were listed under "Best Practices". Here's my running list of common Ruby methods. I'll update the list as I continue to complete problems in hopes of curating a list of some of the most common and fundamental Ruby methods.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;delete&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.codewars.com/kata/52fba66badcd10859f00097e"&gt;Problem for Context&lt;/a&gt;&lt;br&gt;
&lt;a href="https://ruby-doc.org/core-2.4.1/Array.html#method-i-delete"&gt;Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;delete&lt;/code&gt; method takes an object as an argument and deletes everything from &lt;code&gt;self&lt;/code&gt; that is equal to the object. I used the &lt;code&gt;delete&lt;/code&gt; method below to remove all vowels from a given string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def disemvowel(str)
  str.delete "aeiouAEIOU"
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;slice!&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.codewars.com/kata/56bc28ad5bdaeb48760009b0"&gt;Problem for Context&lt;/a&gt;&lt;br&gt;
&lt;a href="https://ruby-doc.org/core-2.4.1/Array.html#method-i-slice-21"&gt;Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;slice!&lt;/code&gt; method differs from &lt;code&gt;slice&lt;/code&gt; in an important way. &lt;code&gt;slice&lt;/code&gt; returns the element at a specified index while &lt;code&gt;slice!&lt;/code&gt; deletes the element at the specified index and returns the deleted object. I used &lt;code&gt;slice!&lt;/code&gt; to remove the first and last characters in a string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def remove_char(s)
  s.slice!(0)
  s.slice!(-1)
  s
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;even?&lt;/code&gt; and &lt;code&gt;odd?&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.codewars.com/kata/53da3dbb4a5168369a0000fe"&gt;Problem for Context&lt;/a&gt;&lt;br&gt;
&lt;a href="https://apidock.com/ruby/Integer/even%3F"&gt;Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These are extremely simple methods that can be called directly on integers (since everything in Ruby is an object). I'm used to using &lt;code&gt;% 2&lt;/code&gt; in JavaScript to determine if a number is even or odd, but Ruby simplifies that process immensely. I used &lt;code&gt;.even&lt;/code&gt; in a ternary to solve this problem:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def even_or_odd(number)
  number.even? ? "Even" : "Odd"
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;method&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.codewars.com/kata/57356c55867b9b7a60000bd7"&gt;Problem for Context&lt;/a&gt;&lt;br&gt;
&lt;a href="https://ruby-doc.org/core-2.5.3/Method.html"&gt;Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is one that I have to keep reading the documentation on. As I understand it, &lt;code&gt;method&lt;/code&gt; can be called on an object and, in doing so, creates an object that can be used to invoke a method elsewhere. Here's an example provided by the documentation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Thing
  def square(n)
    n*n
  end
end
thing = Thing.new
meth  = thing.method(:square)

meth.call(9)                 #=&amp;gt; 81
[ 1, 2, 3 ].collect(&amp;amp;meth)   #=&amp;gt; [1, 4, 9]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, calling &lt;code&gt;method&lt;/code&gt; on &lt;code&gt;thing&lt;/code&gt; allows the &lt;code&gt;square&lt;/code&gt; method to be called later on. I used &lt;code&gt;method&lt;/code&gt; to build a basic calculator:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def basic_op(operator, value1, value2)
  value1.method(operator).(value2)
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;split&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.codewars.com/kata/57cebe1dc6fdc20c57000ac9"&gt;Problem for Context&lt;/a&gt;&lt;br&gt;
&lt;a href="https://ruby-doc.org/core-2.4.0/String.html#method-i-split"&gt;Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;split&lt;/code&gt; is a handy method to keep in your back pocket if you ever need to iterate over a string. &lt;code&gt;split&lt;/code&gt; takes a delimiter as an argument and separates a string into substrings based on that delimiter. I used &lt;code&gt;split&lt;/code&gt; to break apart a sentence string into individual words in order to determine which word was shortest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def find_short(s)
  lengths = []
  s.split(" ").each do |w|
    lengths.push(w.length)
  end
  return lengths.min
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;min&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.codewars.com/kata/577a98a6ae28071780000989"&gt;Problem for Context&lt;/a&gt;&lt;br&gt;
&lt;a href="https://ruby-doc.org/core-2.4.0/Range.html#method-i-max"&gt;Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;min&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt; are simple range methods that return the maximum or minimum value in a range, respectively. They're exceptionally easy to use and much more straightforward than their JavaScript counterparts. I used &lt;code&gt;max&lt;/code&gt; and &lt;code&gt;min&lt;/code&gt; to write a few simple range functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def min(list)
  list.min
end

def max(list)
  list.max
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;to_i&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.codewars.com/kata/557cd6882bfa3c8a9f0000c1"&gt;Problem for Context&lt;/a&gt;&lt;br&gt;
&lt;a href="https://ruby-doc.org/core-2.4.0/Range.html#method-i-max"&gt;Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;to_i&lt;/code&gt; will convert a string to an integer when called on a string. Again, calling the conversion method directly on the object itself makes running the conversation very simple. I used &lt;code&gt;to_i&lt;/code&gt; to parse an integer from a string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def get_age(age)
  age[0].to_i
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>You down with OOP? Yeah you know me!</title>
      <dc:creator>Jonathan-Bryant19</dc:creator>
      <pubDate>Fri, 25 Feb 2022 04:21:37 +0000</pubDate>
      <link>https://dev.to/jonathanbryant19/you-down-with-oop-yeah-you-know-me-471m</link>
      <guid>https://dev.to/jonathanbryant19/you-down-with-oop-yeah-you-know-me-471m</guid>
      <description>&lt;h2&gt;
  
  
  A Beginner's Attempt at Explaining Object Oriented Programming
&lt;/h2&gt;

&lt;p&gt;Wikipedia is great, but when I attempted to look up Object Oriented Programming I was confused after a single sentence:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code...&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Actually, I made it five words in before I had questions if I'm being honest with myself. What's a "programming paradigm"? Once again, Wikipedia to the rescue:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Programming paradigms are a way to classify programming languages based on their features.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ok, so OOP is a collection of features that leverages the concept of objects. In this post, I'll attempt to explore what an object is along with the main features of OOP.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's An Object?
&lt;/h2&gt;

&lt;p&gt;The second half of Wikipedia's definition alludes to the idea that objects are made up of data and code. Generally speaking, objects are a collection of data in the form of properties/attributes and code in the form of procedures/methods. &lt;/p&gt;

&lt;p&gt;In other words, an object is made up of code that allows the object to do things along with data that gives the object some kind of state.&lt;/p&gt;

&lt;p&gt;Think of a motorcycle as an example. If the motorcycle is the object, there might be a method to turn the engine on, speed up, slow down, and turn off. Additionally, there may be data to tell us what color it is, how fast it's going, etc. Ultimately, the object "motorcycle" is a collection of these properties and methods. &lt;/p&gt;

&lt;h2&gt;
  
  
  Where Do Objects Come From?
&lt;/h2&gt;

&lt;p&gt;An important idea in OOP is the relationship between objects and classes. A class acts like a template for the data and methods associated with the objects the class creates. If our motorcycle is the object, the Harley factory could be the class. The factory stores all the information needed to create a new motorcycle. &lt;/p&gt;

&lt;h2&gt;
  
  
  What Are the Main Features of OOP?
&lt;/h2&gt;

&lt;p&gt;The dynamic between classes and objects allows for the implementation of features that are advantageous when engineering software. &lt;/p&gt;

&lt;p&gt;As part of its programming paradigm, OOP has four main features: Encapsulation, Abstraction, Inheritance, and Polymorphism.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Encapsulation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At this point I just start thinking of things in terms of boxes. The class is a giant box that has a bunch of info regarding how to create objects. Each object the class creates is also its own box. Within each of these classes and object containers is info about that container's state and how it can behave. &lt;/p&gt;

&lt;p&gt;Encapsulation is the idea that the information in these containers can be either public or private. The ability to define those privileges gives us the power to define how objects interact with one another. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Abstraction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The bigger a program gets, the more difficult it can be to manage. Let's say it's first thing in the morning and you want/need a cup of coffee. Would you rather build a coffee maker from a pile of parts, or push a button and get on with your day? &lt;/p&gt;

&lt;p&gt;Abstraction is the process of stripping away the complex inner workings of a particular feature and exposing only the critical details of an object to its client. The class/object relationship creates a dynamic that allows abstraction to occur. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inheritance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Often times we have objects that are similar, but not identical. The class/object relationship allows for the creation of objects that vary slightly from one another, but creating those objects would be difficult if done individually. Doing so would require lots of repetitive code. Enter inheritance: the ability for objects to inherit code from other objects. &lt;/p&gt;

&lt;p&gt;Let's say we want to build a bunch cars, trucks, and busses. We could build each one from scratch, but that would require a lot of repetition. Instead, we could start with a parent class that has all the info shared by each vehicle (e.g., 4 tires, an engine that turns on and off, brakes, etc.). We can then create more specific classes that &lt;em&gt;inherit&lt;/em&gt; all that info from the parent class, but also contain their own specific properties and methods. Using this method, both a sports car and a minivan could &lt;em&gt;inherit&lt;/em&gt; the same code from a parent class, eliminating the need to rewrite all that code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Polymorphism&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Polymorphism is the ability to exist in different forms. In the world of OOP, it refers to a dynamic that allows for flexibility with how methods are executed. &lt;/p&gt;

&lt;p&gt;It's like filling a glass with water from a pitcher. The water itself doesn't change when you pour it into a glass, but the water is flexible enough to adapt to its new container. &lt;/p&gt;

&lt;p&gt;We demonstrate polymorphism by writing code that is flexible in its implementation. For example, a motorcycle might inherit a method for turning on, but that method could be implemented in different ways (e.g., push start, key turn, kick start, etc.). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lqRmJesB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21gvg0ahv996gm2wir1u.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lqRmJesB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21gvg0ahv996gm2wir1u.jpeg" alt="Bruce Lee water quote" width="564" height="846"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://simple.wikipedia.org/wiki/Object-oriented_programming"&gt;Wikipedia: Object-oriented programming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://funtech.co.uk/latest/explain-object-oriented-programming-to-kids"&gt;How to Explain Object-Oriented Programming to Kids&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.freecodecamp.org/news/object-oriented-programming-concepts-21bb035f7260/"&gt;How to explain object-oriented programming concepts to a 6-year-old&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.indeed.com/career-advice/career-development/what-is-object-oriented-programming"&gt;The Four Basic Concepts of OOP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dailyjobopening.in/2021/11/02/top-50-oops-object-oriented-programming-interview-questions-answers/"&gt;Top 50 OOP Interview Questions &amp;amp; Answers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>todayilearned</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Six Steps to Tackle Any Algorithm</title>
      <dc:creator>Jonathan-Bryant19</dc:creator>
      <pubDate>Sun, 30 Jan 2022 21:10:41 +0000</pubDate>
      <link>https://dev.to/jonathanbryant19/six-steps-to-tackle-any-algorithm-28a4</link>
      <guid>https://dev.to/jonathanbryant19/six-steps-to-tackle-any-algorithm-28a4</guid>
      <description>&lt;p&gt;One of the best things about programming is experiencing that moment when everything clicks, the program works, and the problem is solved. I love that feeling and I don't think I'm alone. &lt;/p&gt;

&lt;p&gt;You know what sucks though? That moment when the code doesn't work, you have no idea why, and you're being timed. That's not a good feeling and, again, I don't think I'm alone. &lt;/p&gt;

&lt;p&gt;I recently started a software engineering bootcamp at &lt;a href="https://flatironschool.com/"&gt;Flatiron&lt;/a&gt; and have had a steady diet of both feelings over the past few weeks. However, as part of the curriculum I recently received an algorithm for solving algorithms. At first I thought the extra work was, well, just extra work, but having a mental framework to leverage when the way forward isn't clear has proved to be invaluable. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.codewars.com/kata/523f5d21c841566fde000009/train/javascript"&gt;Here&lt;/a&gt; is a coding challenging I worked through on &lt;a href="//www.codewars.com"&gt;Codewars&lt;/a&gt;. Honestly, this is a challenge I would have passed on until recently, but armed with a handy problem solving framework I managed to solve it. &lt;/p&gt;

&lt;p&gt;Here's how I broke down the problem, step by step. &lt;/p&gt;

&lt;h2&gt;
  
  
  1. Rewrite the Problem in Your Own Words
&lt;/h2&gt;

&lt;p&gt;Here is the question as written on Codewars: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Your goal in this kata is to implement a difference function, which subtracts one list from another and returns the result.&lt;/p&gt;

&lt;p&gt;It should remove all values from list a, which are present in list b keeping their order.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Rewriting helps clarify several things, in particular the input and output data types. I've found it's helpful to look at any test conditions, if provided, to see if there are special circumstances to consider (e.g., blank arrays, invalid inputs, etc). I rewrote the problem as follows:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You are given two arrays of numbers as inputs. Take each number in the second array and remove all instances of that number from the first array. Return an array of the remaining numbers. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  2. Write Your Own Test Cases.
&lt;/h2&gt;

&lt;p&gt;This doesn't mean you actually have to write code for unit tests. Simply writing a few instances of the input and expected output of a function can help ensure all expectations of the challenge are considered.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function arrayDiff(a, b) {

}

arrayDiff([1,2,2,2,3,4], [2])
// returns [1,3,4]

arrayDiff([1,2,3,3,4,4], [3,4])
// returns [1,2]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Pseudocode the solution.
&lt;/h2&gt;

&lt;p&gt;Personally, this is one of the most valuable steps for me. Writing out how to approach the problem step by step in plain english provides an outline for how to go about solving the problem. This is especially critical as the complexity of the challenge increases. &lt;/p&gt;

&lt;p&gt;Another reason to pseudocode is to demonstrate how you would approach a problem even if you can't ultimately solve it. If I were given a problem I'm unable to solve in an interview, &lt;em&gt;I'd rather show the interviewer what I know than sit there in a catatonic stupor.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*
1. Iterate through the first array and look for the first value of the second array (maybe a for loop?).
  a. If the value exists in the first array, delete it (maybe using splice?). 
2. Repeat the process for each value in the second array (I might need a nested loop here). 
3. Return a single array of values.
*/ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Code a solution.
&lt;/h2&gt;

&lt;p&gt;Now that we have an outline, it's time to put some code together. Here's what I had for my first attempt at completing step 1:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function arrayDiff(a, b) {
  for ( i = 0; i &amp;lt; a.length; i++) {
    if (a[i] === b[0]) {
      a.splice([i], 1)
    }
  }
  console.log(a)
}

arrayDiff([1,2,2,2,3,4], [2])
// returns [1,2,3,4]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This looked promising at first, but I wasn't getting consistent results using my tests. I found that using &lt;code&gt;splice()&lt;/code&gt; this way allowed for repeats to slip through the cracks because of the way the placement of values in the array shift every time &lt;code&gt;splice()&lt;/code&gt; is used. To prevent this I iterated through the array backwards:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function arrayDiff(a, b) {
  for ( i = a.length -1; i &amp;gt; -1; i = i - 1) {
    if (a[i] === b[0]) {
      a.splice([i], 1)
    }
  }
  console.log(a)
}

arrayDiff([1,2,2,2,3,4], [2])
// returns [1,3,4]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This solves step 1 for me, but the function does not allow for the b array to be longer than one number. All I need to do at this point is figure out how to loop through the second array. This was my attempt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function arrayDiff(a, b) {
  for ( j = 0; j &amp;lt; b.length; j++)
    for ( i = a.length -1; i &amp;gt; -1; i = i - 1) {
      if (a[i] === b[j]) {
        a.splice([i], 1)
      }
    }
  console.log(a)
}

arrayDiff([1,2,3,3,4,4], [3,4])
// returns [1,2]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It works! At this point I have code that does it's job, but there are two more steps before I'm ready to submit. &lt;/p&gt;

&lt;h2&gt;
  
  
  5. Clean Up the Code
&lt;/h2&gt;

&lt;p&gt;A quick review of the function helps to ensure indentations and variable names are clear and clean. I don't have any variables to worry about but my &lt;code&gt;i&lt;/code&gt; and &lt;code&gt;j&lt;/code&gt; variables really should be switched. Also, I can iterate through the loop backwards by changing &lt;code&gt;j = j - 1&lt;/code&gt; to &lt;code&gt;j--&lt;/code&gt;. I'll also change my &lt;code&gt;console.log&lt;/code&gt; to &lt;code&gt;return&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;function arrayDiff(a, b) {
  for ( i = 0; i &amp;lt; b.length; i++)
    for ( j = a.length -1; j &amp;gt; -1; j--) {
      if (a[j] === b[i]) {
        a.splice([j], 1)
      }
    }
  return a
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Consider Optimization
&lt;/h2&gt;

&lt;p&gt;At this point in my learning I'm just beginning to explore optimization. I wasn't a fan of using a nested loop and I was fairly sure there was a better way to go about solving this. &lt;/p&gt;

&lt;p&gt;One of the things I love most about Codewars is the feedback you get after submitting a correct solution. I've had many &lt;em&gt;forehead slap&lt;/em&gt; moments after seeing a solution much easier than my own. &lt;/p&gt;

&lt;p&gt;Here's what Codewars provided as the top answer under "Best Practices":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function array_diff(a, b) {
  return a.filter(e =&amp;gt; !b.includes(e));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This was definitely a forehead slap moment. I hadn't considered using &lt;code&gt;filter()&lt;/code&gt; in conjunction with &lt;code&gt;includes()&lt;/code&gt;. Also, this was also the first time I've seen the bang operator used with an array method. &lt;/p&gt;

&lt;p&gt;I'll just go ahead and repeat this process a few thousand times and I think I'll be well on my way to increasing my proficiency as a programmer.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
