<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Traversing the Internets]]></title>
  <link href="http://samueldowens.github.io/atom.xml" rel="self"/>
  <link href="http://samueldowens.github.io/"/>
  <updated>2013-10-17T09:01:59-04:00</updated>
  <id>http://samueldowens.github.io/</id>
  <author>
    <name><![CDATA[Samuel Owens]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Twenty Four - Include or Extend for a Module?]]></title>
    <link href="http://samueldowens.github.io/blog/2013/10/17/flatiron-school-day-twenty-four-include-or-extend-for-a-module/"/>
    <updated>2013-10-17T08:49:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/10/17/flatiron-school-day-twenty-four-include-or-extend-for-a-module</id>
    <content type="html"><![CDATA[<p>Yesterday I found myself writing my first module. For those who don&rsquo;t know, in ruby a module is a package of methods that you write and store in a seperate place, which you can call on inside a class to include the methods contained within. These are used when you want to have the exact same methods included in multiple places, using a module is cleaner and DRY&#8217;er than repeating the method definitions in every class.</p>

<p>There are two ways to add a module to a class, <strong>include</strong> and <strong>extend</strong>. The <strong>include</strong> keyword will bring the module methods into the class as instance methods, allowing instances of the class to use the methods. The <strong>extend</strong> keyword will bring the module methods into the class as class methods, allowing the class itself to call those methods.</p>

<p>It&rsquo;s important to understand which of these two are appropriate to use on the module and to design and structure your module so that it can be used correctly. If you use the wrong keyword to bring the module into a class you will not end up with the expected functionality. Additionally, modules should be designed and structured with this in mind, separating methods that are intended to be instance methods from those that are intended to be class methods.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Twenty Three - RSpec Musings]]></title>
    <link href="http://samueldowens.github.io/blog/2013/10/16/flatiron-school-day-twenty-three-rspec-bullet-points/"/>
    <updated>2013-10-16T08:36:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/10/16/flatiron-school-day-twenty-three-rspec-bullet-points</id>
    <content type="html"><![CDATA[<p>Todays post is going to be short. I&rsquo;m going to write down some thoughts about RSpec and writing tests.</p>

<p>Write out what you want your tests to do without worrying about the actual syntax for the tests first.
Statements like &ldquo;it &lsquo;should do whatever this test should do&rsquo;&rdquo; do can be followed with pending on the next line.
This allows you to write out all of the ideas with what you would like your code to do without having to worry about any syntax yet.
You can then impliment tests as you&rsquo;re comfortable and write the corresponding code to pass them when the tests are ready.</p>

<p>Sometimes it&rsquo;s helpful to write out skeleton tests, to describe what features a given unit of work should DEFINITELY have without
worrying too much about potential features or tasks that it may need further down the line. Once you get the basics built out on
your files when you come across new functionality that is needed you can go back and add tests and then add the code to get those to pass.
This approach can save some time as you won&rsquo;t need to try and brainstorm every feature you might come across and can instead focus on making
sure your tests are good and that your code passes them. <strong>You can always add more tests later</strong></p>

<p>With the level of complexity of our current projects, writing tests often feels very frustrating. It feels like spending a lot of time writing out
very basic things about the code when we could be actually writing the program. Intellectually I&rsquo;m aware that this work will pay off down the line as projects become
more complex, so in the meantime I need to keep reminding myself that it&rsquo;s not slowing us down, it&rsquo;s preparing us for things to come.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Twenty-Two - SQL Bits]]></title>
    <link href="http://samueldowens.github.io/blog/2013/10/15/flatiron-school-day-twenty-two-sql-bits/"/>
    <updated>2013-10-15T08:34:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/10/15/flatiron-school-day-twenty-two-sql-bits</id>
    <content type="html"><![CDATA[<p>I started working on a <a href="https://github.com/samueldowens/hacker_news_scraper" target="_blank">mini-project</a> yesterday bto reinforce the different topics we&rsquo;re covering in Flatiron. While it&rsquo;s not done-enough to go over in detail yet I wanted to cover a few bits of SQL that I found particularly useful in getting the program to its current state.</p>

<p>The SQL side of the program exists to keep a unique record of articles off of Hacker News that meet certain criteria. The scrape can be run multiple times over multiple days, weeks, etc. so it was important that the SQL side of the program not continuously re-enter the same article over multiple scrapes. Here&rsquo;s what the code looks like&hellip;</p>

<figure class='code'><figcaption><span>database.rb</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="k">class</span> <span class="nc">Database</span>
</span><span class='line'>
</span><span class='line'>  <span class="vc">@@db</span> <span class="o">=</span> <span class="ss">SQLite3</span><span class="p">:</span><span class="ss">:Database</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="s1">&#39;articles.db&#39;</span><span class="p">)</span>
</span><span class='line'>  <span class="vc">@@db</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s2">&quot;CREATE TABLE if NOT EXISTS articles(id INTEGER PRIMARY KEY ASC, title TEXT UNIQUE, url TEXT, parent_url TEXT, points INTEGER);&quot;</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'>  <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">insert</span><span class="p">(</span><span class="n">array</span><span class="p">)</span>
</span><span class='line'>    <span class="n">array</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">article</span><span class="o">|</span>
</span><span class='line'>      <span class="n">sql</span> <span class="o">=</span> <span class="s2">&quot;REPLACE INTO articles(title, url, parent_url, points) VALUES (?,?,?,?)&quot;</span>
</span><span class='line'>      <span class="vc">@@db</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">article</span><span class="o">.</span><span class="n">title</span><span class="p">,</span> <span class="n">article</span><span class="o">.</span><span class="n">url</span><span class="p">,</span> <span class="n">article</span><span class="o">.</span><span class="n">parent_url</span><span class="p">,</span> <span class="n">article</span><span class="o">.</span><span class="n">points</span><span class="p">)</span>
</span><span class='line'>    <span class="k">end</span>
</span><span class='line'>  <span class="k">end</span>
</span><span class='line'>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>


<p>There are a few bits of this code I would like to highlight.</p>

<p><strong>&ldquo;CREATE TABLE if NOT EXISTS&rdquo; &ndash; </strong>This one should be familiar to most Flatiron students already, but since some of our projects and examples have assumed the existance of a table I thought it would be worth mentioning. The &lsquo;if NOT EXISTS&rsquo; part is important to make sure that you are not creating a new table every time the code runs, this code will only execute the first time the program runs, unless the &lsquo;articles&rsquo; table is deleted from the database (this would have to be done manually by the user).</p>

<p><strong>&ldquo;title TEXT UNIQUE&rdquo; &ndash; </strong>This is one that I had to look up what I wanted SQL to do before I could figure out how to do it. This tells the database that while the &lsquo;title&rsquo; column is not the primary key, that it is unique and that SQL should raise an error if something attempts to add an item with the same title as something else to the table.</p>

<p><strong>&ldquo;REPLACE INTO&rdquo; &ndash; </strong>The work-horse piece of code, normally we would use &lsquo;INSERT INTO&rsquo; but in this case, I chose to use &lsquo;REPLACE&rsquo; for two reasons. First, it resolves any conflicting titles by replacing the old entry with the newer one, which makes sure that we only have unique entries in the table. Second since it replaces the old version with the new one, it will update any other data about the article that has changed since the last time the scrape was run (for instance, if the number of points were to change).</p>

<p>These three peices that were previously unfamiliar to me do a lot of work in very little space. Because I don&rsquo;t need to write methods to check for some of the things these take care of automatically, we save a lot of space and the code is easy to read. Thanks for reading, I hope if you&rsquo;re working with SQL these little bits are helpful!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Weekend Three - The Tap Method]]></title>
    <link href="http://samueldowens.github.io/blog/2013/10/14/flatiron-school-weekend-three-the-tap-method/"/>
    <updated>2013-10-14T10:07:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/10/14/flatiron-school-weekend-three-the-tap-method</id>
    <content type="html"><![CDATA[<p><img class="center" src="http://hopsandgrapesonline.com/images/uploads/32762.jpg" title="#1 type of tap at the Flatiron School" alt="#1 type of tap at the Flatiron School"></p>

<p>Today I wanted to talk about a couple ways I think the .tap method in Ruby is useful. The first time a lot of us at Flatiron saw this method, it was used in an RSpec test and threw many of us for a loop trying to figure out exactly what the test was doing. After using the method for a bit, it&rsquo;s become clearer what the tap method is, a shortcut.</p>

<figure class='code'><figcaption><span>Equivalent Code&#8230;</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="k">class</span> <span class="nc">Dog</span>
</span><span class='line'><span class="kp">attr_accessor</span> <span class="ss">:name</span><span class="p">,</span> <span class="ss">:favorite_food</span><span class="p">,</span> <span class="ss">:breed</span>
</span><span class='line'><span class="k">end</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># The Three code samples below all are based on the above class.</span>
</span><span class='line'>
</span><span class='line'><span class="n">clifford</span> <span class="o">=</span> <span class="no">Dog</span><span class="o">.</span><span class="n">new</span><span class="o">.</span><span class="n">tap</span><span class="p">{</span><span class="o">|</span><span class="n">x</span><span class="o">|</span> <span class="n">x</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Clifford&quot;</span><span class="p">;</span> <span class="n">x</span><span class="o">.</span><span class="n">favorite_food</span> <span class="o">=</span> <span class="s2">&quot;Children&quot;</span><span class="p">;</span> <span class="n">x</span><span class="o">.</span><span class="n">breed</span> <span class="o">=</span> <span class="s2">&quot;Big Red Dog&quot;</span><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># The code above and below this comment are equivalent.</span>
</span><span class='line'>
</span><span class='line'><span class="n">clifford</span> <span class="o">=</span> <span class="no">Dog</span><span class="o">.</span><span class="n">new</span>
</span><span class='line'>
</span><span class='line'><span class="n">clifford</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Clifford&quot;</span><span class="p">;</span> <span class="n">clifford</span><span class="o">.</span><span class="n">favorite_food</span> <span class="o">=</span> <span class="s2">&quot;Children&quot;</span><span class="p">;</span> <span class="n">clifford</span><span class="o">.</span><span class="n">breed</span> <span class="o">=</span> <span class="s2">&quot;Big Red Dog&quot;</span><span class="p">;</span> <span class="n">clifford</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># This code is also equal to the code below, in case semi-colons make you uncomfortable...</span>
</span><span class='line'>
</span><span class='line'><span class="n">clifford</span> <span class="o">=</span> <span class="no">Dog</span><span class="o">.</span><span class="n">new</span>
</span><span class='line'><span class="n">clifford</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Clifford&quot;</span>
</span><span class='line'><span class="n">clifford</span><span class="o">.</span><span class="n">favorite_food</span> <span class="o">=</span> <span class="s2">&quot;Children&quot;</span>
</span><span class='line'><span class="n">clifford</span><span class="o">.</span><span class="n">breed</span> <span class="o">=</span> <span class="s2">&quot;Big Red Dog.&quot;</span>
</span><span class='line'><span class="n">clifford</span>
</span></code></pre></td></tr></table></div></figure>


<p><img class="center" src="http://images1.wikia.nocookie.net/__cb20100302194935/clifford/images/c/c3/Showim.jpg" title="Those kids should be screaming and jumping off that roller coaster." alt="Those kids should be screaming and jumping off that roller coaster."></p>

<p>So the three pieces of code above all return the same value with different ways of getting there. The tap method offers a few advantages over the others.</p>

<p>First, you get the same return out of a single line of code. This advantage should be obvious from looking at the code (you can paste the samples into IRB to confirm equality)</p>

<p>Second, you don&rsquo;t need to call the variable to get the return value, which also means&hellip;</p>

<p>Third, you don&rsquo;t have to store the object in a variable at all. This looks like&hellip;</p>

<figure class='code'><figcaption><span>The Following Code Samples return the same value.</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="c1">#Original code from above</span>
</span><span class='line'>
</span><span class='line'><span class="n">clifford</span> <span class="o">=</span> <span class="no">Dog</span><span class="o">.</span><span class="n">new</span><span class="o">.</span><span class="n">tap</span><span class="p">{</span><span class="o">|</span><span class="n">x</span><span class="o">|</span> <span class="n">x</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Clifford&quot;</span><span class="p">;</span> <span class="n">x</span><span class="o">.</span><span class="n">favorite_food</span> <span class="o">=</span> <span class="s2">&quot;Children&quot;</span><span class="p">;</span> <span class="n">x</span><span class="o">.</span><span class="n">breed</span> <span class="o">=</span> <span class="s2">&quot;Big Red Dog&quot;</span><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="c1">#Same return value without having to store the object in a variable</span>
</span><span class='line'>
</span><span class='line'><span class="no">Dog</span><span class="o">.</span><span class="n">new</span><span class="o">.</span><span class="n">tap</span><span class="p">{</span><span class="o">|</span><span class="n">x</span><span class="o">|</span> <span class="n">x</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Clifford&quot;</span><span class="p">;</span> <span class="n">x</span><span class="o">.</span><span class="n">favorite_food</span> <span class="o">=</span> <span class="s2">&quot;Children&quot;</span><span class="p">;</span> <span class="n">x</span><span class="o">.</span><span class="n">breed</span> <span class="o">=</span> <span class="s2">&quot;Big Red Dog&quot;</span><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>This allows you if you are creating a large number of objects and passing them into a larger data structure (hash, database, array) to not have to first store the object in a variable before passing the variable into your data structure, saving steps along the way. With the other ways of making clifford &lsquo;real&rsquo;, you would need to store the object in a variable to be able to manipulate it after it was made, with .tap you can make clifford exist and have traits without ever having to tell the computer to remember him.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Eighteen - Suck It Up, Break Your Code.]]></title>
    <link href="http://samueldowens.github.io/blog/2013/10/11/flatiron-school-day-eightteen-refactor_fu/"/>
    <updated>2013-10-11T08:32:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/10/11/flatiron-school-day-eightteen-refactor_fu</id>
    <content type="html"><![CDATA[<p>I was going to write another small technical post today but that is going to have to wait until tomorrow. Today I wanted to remind myself and anybody who reads this about the mental blocks with regard to refactoring your code. Here at Flatiron we follow the (I think Kent Beck) motto of &ldquo;Make it work, make it right, make it fast.&rdquo; Sometimes this leads to the first working piece of code being pretty ugly. If you&rsquo;ve just spent hours in a team working through pitfalls to get the code working, it may be overwhelming to go ahead and start refactoring the code once its running and/or all your tests are green.</p>

<p>The big thing I wanted to focus on is that provided you&rsquo;re not living in an alternate dimension where there is no Git, you can feel free to burn your working code to the ground and swim in its ashes. You still have that working code in version control, there is nothing intimidating about altering it to where it starts failing tests or stops functioning. Even if you never find a better solution on a given project, you never will if you don&rsquo;t start smashing your code and trying to rebuild them.</p>

<p>In Office Space they took the printer out into a field after one too many &ldquo;pc load letter&rdquo; errors and smashed it to pieces. Unfortunately with hardware, its pretty difficult to put back together. Count yourself lucky that with code that is not the case, you can destroy your project over and over again and roll it back if you aren&rsquo;t making useful progress.</p>

<p>Get over the fear of the red results and break your code, it&rsquo;s liberating.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Seventeen - Class Methods]]></title>
    <link href="http://samueldowens.github.io/blog/2013/10/10/flatiron-school-day-seventeen-class-methods/"/>
    <updated>2013-10-10T08:33:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/10/10/flatiron-school-day-seventeen-class-methods</id>
    <content type="html"><![CDATA[<p>I wanted to write down a little bit about my understanding of how methods work inside of classes and how to know if you want your method to be &lsquo;self.method&rsquo; or just &lsquo;method.&rsquo;</p>

<p>Take the following situation&hellip;</p>

<figure class='code'><figcaption><span>The Dog Class</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="k">class</span> <span class="nc">Dog</span>
</span><span class='line'>
</span><span class='line'>  <span class="kp">attr_accessor</span> <span class="ss">:name</span><span class="p">,</span> <span class="ss">:color</span><span class="p">,</span> <span class="ss">:breed</span><span class="p">,</span> <span class="ss">:number_of_legs</span>
</span><span class='line'>
</span><span class='line'><span class="k">end</span>
</span><span class='line'>
</span><span class='line'><span class="n">fido</span> <span class="o">=</span> <span class="no">Dog</span><span class="o">.</span><span class="n">new</span>
</span><span class='line'><span class="n">fido</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Fido&quot;</span>
</span><span class='line'><span class="n">fido</span><span class="o">.</span><span class="n">color</span> <span class="o">=</span> <span class="s2">&quot;Red&quot;</span>
</span><span class='line'><span class="n">fido</span><span class="o">.</span><span class="n">breed</span> <span class="o">=</span> <span class="s2">&quot;Direwolf&quot;</span>
</span><span class='line'><span class="n">fido</span><span class="o">.</span><span class="n">number_of_legs</span> <span class="o">=</span> <span class="mi">4</span>
</span><span class='line'>
</span><span class='line'><span class="n">other_fido</span> <span class="o">=</span> <span class="no">Dog</span><span class="o">.</span><span class="n">new</span>
</span><span class='line'><span class="n">other_fido</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Not Fido&quot;</span>
</span><span class='line'><span class="n">other_fido</span><span class="o">.</span><span class="n">color</span> <span class="o">=</span> <span class="s2">&quot;Green&quot;</span>
</span><span class='line'><span class="n">other_fido</span><span class="o">.</span><span class="n">breed</span> <span class="o">=</span> <span class="s2">&quot;Regular Wolf&quot;</span>
</span><span class='line'><span class="n">other_fido</span><span class="o">.</span><span class="n">number_of_legs</span> <span class="o">=</span> <span class="mi">3</span>
</span></code></pre></td></tr></table></div></figure>


<p>So we have the class Dog with a few attributes, and we&rsquo;ve created two dogs. Now we&rsquo;re going to create two methods, one to make an individual dog bark and one to make the Dog class bark.</p>

<figure class='code'><figcaption><span>I Should Have Named One of the Dogs Charles BARKley.</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="k">class</span> <span class="nc">Dog</span>
</span><span class='line'>
</span><span class='line'>  <span class="k">def</span> <span class="nf">barkley</span>
</span><span class='line'>    <span class="nb">puts</span> <span class="s2">&quot;I AM TOTALLY BARKING YOU GUYS&quot;</span>
</span><span class='line'>  <span class="k">end</span>
</span><span class='line'>
</span><span class='line'>  <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">bark</span>
</span><span class='line'>    <span class="nb">puts</span> <span class="s2">&quot;THE CONCEPT OF A DOG IS BARKING, RUN FOR YOUR LIVES!&quot;</span>
</span><span class='line'>  <span class="k">end</span>
</span><span class='line'>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>


<p>Now, if we put fido.barkley we will see
&ldquo;I AM TOTALLY BARKING YOU GUYS&rdquo;</p>

<p>If you put fido.bark though, you will get a NoMethodError, because the bark method is defined for the class it was in because we defined it as self.bark, with self referring to the current object its contained within.</p>

<p>So&hellip; If we put Dog.bark we will see
&ldquo;THE CONCEPT OF A DOG IS BARKING, RUN FOR YOUR LIVES!&rdquo;</p>

<p>Similarly, if we were to call Dog.barkley we would again get a NoMethodError because the method is defined without the self demarcation, telling ruby that it is to be used by individual dogs, not by the class as a whole.</p>

<p>So bringing things back around, if you want your overall class to respond to a method, name it as self.method, if you want a specific instance of that class to respond to it, do not have the self in there.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Sixteen - The Pareto Principal]]></title>
    <link href="http://samueldowens.github.io/blog/2013/10/09/the-pareto-principal/"/>
    <updated>2013-10-09T08:36:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/10/09/the-pareto-principal</id>
    <content type="html"><![CDATA[<p>The Pareto principal is also known as the &lsquo;80/20&rsquo; rule. It&rsquo;s a rule I&rsquo;ve heard and seen in various academic endeavours and in business as well. Yesterday was the first time I really looked at it with regard to coding. Avi mentioned during the day that 80% of the work on a project comes in the last 20% of the project and that got me thinking about my work and if the principal applies.</p>

<p>It turns out after looking at my &lsquo;to do&rsquo; list for Flatiron that the only things I have unfinished stand about 80% done. Some are a little further along, some less; but the overwhelming majority of my unfinished work falls right around &lsquo;almost done.&rsquo; It always seems to be that one method I can&rsquo;t get to function correctly, or the one or two tests I just can&rsquo;t seem to get to pass that are holding up some of my work from being completed.</p>

<p>So I&rsquo;ve decided I&rsquo;m going to stop caring about pace. I&rsquo;m not going to find it odd or frustrating anymore when I rush through 80% of a project only to find myself stuck in the mud at the end. I&rsquo;m just going to push through it, knowing that it&rsquo;s completely normal and not something that&rsquo;s going to change.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Fifteen - Structs]]></title>
    <link href="http://samueldowens.github.io/blog/2013/10/08/flatiron-school-day-fifteen-structs/"/>
    <updated>2013-10-08T08:31:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/10/08/flatiron-school-day-fifteen-structs</id>
    <content type="html"><![CDATA[<p>Today I&rsquo;m going to take a break from &lsquo;talking about my day&rsquo; and instead try and explain something technical. Today I&rsquo;m going to talk about structs, a concept in Ruby we haven&rsquo;t actually learned at Flatiron yet. This article is inspired by the presentation on <a href="https://speakerdeck.com/metaskills/ruby-struct/" title="Speaker Deck by Ken Collins">Speaker Deck by Ken Collins</a>, so thanks Ken for getting me thinking about structs!</p>

<p>I&rsquo;m going to try and break down structs into three parts. Concept, Code and Uses&hellip;</p>

<p><b>Concept:</b> A struct is a miniture class, created quickly and at its core it is a class that only has basic getter and setter methods.</p>

<p><b>Code:</b> There are a few ways to create a struct. I think the easiest to do and understand is as follows&hellip;</p>

<figure class='code'><figcaption><span>Struct Creation</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="no">Location</span> <span class="o">=</span> <span class="no">Struct</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="ss">:name</span><span class="p">,</span> <span class="ss">:lattitude</span><span class="p">,</span> <span class="ss">:longitude</span><span class="p">)</span>
</span></code></pre></td></tr></table></div></figure>


<p>That&rsquo;s all there is to it, this quickly creates a Struct Class called Location that keeps track of a locations name, lattitude and longitude coordinates. Which brings us to&hellip;</p>

<p><b>Uses:</b> Structs seem like they are best used for set values for things that don&rsquo;t need to have any class methods. Things like GPS locations seem like a great reason to use a struct instead of another structure. Any time where you know there is a fixed amount of information you need a struct can be a quick and easy way of storing information about those things, I&rsquo;m going to try and use structs more and see if I can&rsquo;t find even more useful ways to implement them!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Weekend Two]]></title>
    <link href="http://samueldowens.github.io/blog/2013/10/07/flatiron-school-weekend-two/"/>
    <updated>2013-10-07T08:38:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/10/07/flatiron-school-weekend-two</id>
    <content type="html"><![CDATA[<p>Weekend two was a lot of fun. I managed to end up pretty comfortable with SQL pretty early in the day and we moved onto some other new and interesting things later.</p>

<p>Namely Nokogiri, this ruby gem for scraping web pages was the big learning focus of my weekend. Our project was to use Nokogiri to scrape the Flatiron student webpage for information on each student and export that data into an SQL database. It took a lot of trial and error playing around with Nokogiri before we figured things out, but by the end my whole group was pretty comfortable navigating the trees of data that is HTML.</p>

<p>We also had to redo the quiz from week one but make it object oriented, having to have classes in each of the previous tests. I thought the difficulty on that assignment was pretty easy but that it was useful in providing repetition in looking at grouping things as a class.</p>

<p>Lastly we were given an assignment called playlister, which was a multi-file, multi-class assignment that had a suite of rspec tests that needed to be passed. I sure hope this was the stretch assignment for the weekend as I spent a lot of time struggling with it.</p>

<p>I&rsquo;m really looking forward to week three. After two weeks I&rsquo;m already amazed at the tools we&rsquo;re beginning to scratch the surface of using. I can&rsquo;t imagine after 10 more weeks how many cool things we&rsquo;ll be able to build. I feel like a child who just learned what a car can do but whose feet can&rsquo;t yet reach the pedals. Once they can it&rsquo;s going to be a fun time!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Eleven]]></title>
    <link href="http://samueldowens.github.io/blog/2013/10/04/flatiron-school-day-eleven/"/>
    <updated>2013-10-04T08:23:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/10/04/flatiron-school-day-eleven</id>
    <content type="html"><![CDATA[<p>Day Eleven kicked off a day of very little actual Ruby. In the morning we worked on a debugging project where we were handed some broken ruby code and the expectations for how it was supposed to work and had to fix it. I really enjoyed that project, as much as I like building new things its also fun to fix broken stuff. After that though, the rest of the day was spent on SQL.</p>

<p>Something I like about Flatiron is that we learn everything from the ground up. The magic of a lot of things like Rails and Active Record will be understood by us as we will have learned to do everything without them. That is exactly how I want to learn to program. That said, it&rsquo;s also a pain in the butt. Writing SQL queries isn&rsquo;t conceptually difficult, though the new syntax creates some conflicts, but writing it in sublime as a .sql file and smashing it into a DB in BASH is a more tedious process than I think is probably necessary. I&rsquo;m about ready for Active Record!</p>

<p>Most of the classes issues seemed to stem from Queries and Joins. Most of the organizing of the databases came pretty naturally to most people I talked to, but there is a lot of syntax with queries/joins that can be pretty confusing. I&rsquo;m going to post a snippit of my code and try and explain it&hellip;</p>

<figure class='code'><figcaption><span>Queries and Joins</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='sql'><span class='line'><span class="k">SELECT</span> <span class="n">project</span><span class="p">.</span><span class="n">title</span><span class="p">,</span> <span class="k">SUM</span><span class="p">(</span><span class="n">pledge</span><span class="p">.</span><span class="n">amount</span><span class="p">)</span> <span class="k">AS</span> <span class="s1">&#39;total_pledge_amount&#39;</span>
</span><span class='line'><span class="k">FROM</span>
</span><span class='line'><span class="n">project</span>
</span><span class='line'><span class="k">INNER</span> <span class="k">JOIN</span>
</span><span class='line'><span class="n">pledge</span>
</span><span class='line'><span class="k">ON</span>
</span><span class='line'><span class="n">project</span><span class="p">.</span><span class="n">id</span> <span class="o">=</span> <span class="n">pledge</span><span class="p">.</span><span class="n">project_id</span>
</span><span class='line'><span class="k">GROUP</span> <span class="k">BY</span>
</span><span class='line'><span class="n">project</span><span class="p">.</span><span class="n">title</span><span class="p">;</span>
</span></code></pre></td></tr></table></div></figure>


<p>So, this query has several parts which I will try and explain correctly one at a time.</p>

<p>The first is SELECT. This is the specific data we want this query to look at. In this case its the &lsquo;title&rsquo; column from the &lsquo;project&rsquo; table and the sum of the &lsquo;amount&rsquo; column from the &lsquo;pledge&rsquo; table. The AS key just renames the result of the SUM function to &lsquo;total_pledge_amount&rsquo; and could be removed and the query would still function. Next is FROM, we are joining from the project table, using an INNER JOIN with the pledge table. I reversed the places of project and pledge and got the same results, so I&rsquo;m not yet sure where it would be important to specify one table in front of another. After that is ON, which is where the JOIN will link the two tables based on a mutual key. In this case its the primary key of project (project.id) and the foreign key in pledge that corresponds with the project primary key (pledge.project_id). Lastly is GROUP BY for which i put &lsquo;project.title&rsquo; this orders the query results alphabetically by the &lsquo;title&rsquo; column in the &lsquo;project&rsquo; table. The result is a list of each project.title and the total amount of pledges that match each projects key.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Ten]]></title>
    <link href="http://samueldowens.github.io/blog/2013/10/03/flatiron-school-day-ten/"/>
    <updated>2013-10-03T08:23:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/10/03/flatiron-school-day-ten</id>
    <content type="html"><![CDATA[<p>Phew, day nine is over and in the rear view mirror and day ten kicked off
with a few hours of self-directed work. It really seemed to come at just
the right time for a lot of us, myself included. I got caught up on a lot
of the things that were giving me trouble and by the end of the day was
really feeling like I was back in the driver&rsquo;s seat with my learning.</p>

<p>I&rsquo;m finally starting to instinctively break things down into smaller chunks.
I was expecting this sort of progress to come with a light bulb over my head,
fireworks or some other sort of stark realization that I had made progress.
Instead it came from solving a problem and looking at my solution and realizing
that I solved it differently than I would have a couple days ago without even
noticing I was doing it.</p>

<p>I&rsquo;m also starting to get a little bit of a handle on refactoring. I managed
to get our pigeon hash problem working and then condensed some of my code
that was running in different parts of the program into a single method at
the end to execute all the sub-methods at once. I&rsquo;m happy that I spotted this
and was able to make my code better without breaking its functionality. After
looking at some of the solutions my classmates came up with however, I still
know that I have a lot of work to do with refactoring as some of their
solutions were brilliant!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Nine]]></title>
    <link href="http://samueldowens.github.io/blog/2013/10/02/flatiron-school-day-nine/"/>
    <updated>2013-10-02T08:23:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/10/02/flatiron-school-day-nine</id>
    <content type="html"><![CDATA[<p>Week two day two was a rough one for me. I&rsquo;m finally starting to feel really stressed by the material. I&rsquo;m spending a lot more time fighting my way through producing what I feel is sub-par code than I&rsquo;d like. I&rsquo;m really hoping that I&rsquo;m reaching the end of a plateau in my learning and will take a jump forward soon. I&rsquo;m having trouble breaking problems down into smaller pieces and still keeping track of everything. I&rsquo;m also having some issues figuring out how to refactor my code from the &lsquo;works&rsquo; stage to the &lsquo;right&rsquo; stage. Week 2 day 3 we get a big chunk of time to catch up on stuff though, so I&rsquo;m hoping that my not feeling confident about my code from the last day or two isn&rsquo;t uncommon and that I come out of Wednesday feeling a bit better.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Eight]]></title>
    <link href="http://samueldowens.github.io/blog/2013/10/01/flatiron-school-day-8/"/>
    <updated>2013-10-01T08:23:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/10/01/flatiron-school-day-8</id>
    <content type="html"><![CDATA[<p>I came out of the weekend feeling like I really knew what I was doing, then Monday happened. At the beginning of the day I was feeling good about my competence level but once we really dug into nested hashes and how to access data inside of them the wheels really came off the rails for a while.</p>

<p>The first few hash projects I was able to get through cobbling together nested do blocks based on .each and the key varient but it was really messy. I felt like I was trying to break a problem down into simpler ones like Avi told us, but coming up with even more complicated answers that usually didn&rsquo;t work.</p>

<p>Then came Hashketball. A giant monstrosity of nested hashes that we had to find a bunch of ways of iterating through to get to the particular piece of data we wanted. At times we also had to compare various types of data that could be found throughout the nested hash jungle, all while trying to avoid the local predators (read: errors, fatigue, frustration). After what seemed like a day and a half but was really probably only a couple hours of fruitlessly banging on my keyboard trying to break the problem down into smaller problems, or try and get elaborate nested blocks to do what I wanted I finally found the heartbreakingly simple answer of how to access the hash how I wanted.</p>

<p>It was so simple I couldn&rsquo;t believe it. Or at least I couldn&rsquo;t believe it until the thought occured to me that rubyists likely have to do this sort of thing and since its ruby there has to be an easy way to do it, that&rsquo;s just the way ruby works.</p>

<figure class='code'><figcaption><span>It looks so simple when you see it&#8230;</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="nb">hash</span> <span class="o">=</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'>  <span class="ss">:hash1</span> <span class="o">=&gt;</span>
</span><span class='line'>  <span class="p">{</span>
</span><span class='line'>    <span class="ss">:hash2</span> <span class="o">=&gt;</span> <span class="mi">1</span><span class="p">,</span>
</span><span class='line'>    <span class="ss">:hash3</span> <span class="o">=&gt;</span>
</span><span class='line'>    <span class="p">{</span>
</span><span class='line'>      <span class="ss">:hash4</span> <span class="o">=&gt;</span> <span class="mi">2</span><span class="p">,</span>
</span><span class='line'>      <span class="ss">:hash5</span> <span class="o">=&gt;</span> <span class="mi">3</span>
</span><span class='line'>    <span class="p">},</span>
</span><span class='line'>
</span><span class='line'>  <span class="p">},</span>
</span><span class='line'>  <span class="ss">:hash6</span> <span class="o">=&gt;</span> <span class="mi">4</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="c1">#so to access the number 3.</span>
</span><span class='line'>
</span><span class='line'><span class="nb">hash</span><span class="o">[</span><span class="ss">:hash1</span><span class="o">][</span><span class="ss">:hash3</span><span class="o">][</span><span class="ss">:hash5</span><span class="o">]</span>
</span><span class='line'>
</span><span class='line'><span class="c1">#this looks at the &#39;hash&#39; created, then accesses deeper levels of the hash by </span>
</span><span class='line'><span class="c1">#calling on keys in [].</span>
</span><span class='line'>
</span><span class='line'>
</span><span class='line'><span class="c1">#you can also iterate through pieces of a hash.</span>
</span><span class='line'>
</span><span class='line'><span class="nb">hash</span><span class="o">[</span><span class="ss">:hash1</span><span class="o">][</span><span class="ss">:hash3</span><span class="o">].</span><span class="n">each_key</span> <span class="k">do</span> <span class="o">|</span><span class="n">key</span><span class="o">|</span>
</span><span class='line'>  <span class="nb">hash</span><span class="o">[</span><span class="ss">:hash1</span><span class="o">][</span><span class="ss">:hash3</span><span class="o">][</span><span class="n">key</span><span class="o">]</span>
</span><span class='line'><span class="k">end</span>
</span><span class='line'>
</span><span class='line'><span class="c1">#This looks through the has to the key :hash3 then looks at each key within and </span>
</span><span class='line'><span class="c1">#returns the value it&#39;s associated with.</span>
</span></code></pre></td></tr></table></div></figure>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Weekend One]]></title>
    <link href="http://samueldowens.github.io/blog/2013/09/30/flatiron-school-weekend-1/"/>
    <updated>2013-09-30T08:23:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/09/30/flatiron-school-weekend-1</id>
    <content type="html"><![CDATA[<p>I&rsquo;m going to wrap Friday-Sunday into one big post.</p>

<p>Friday began my love affair with case statements. They are beautiful creatures that really can save you a lot of code over if/else statements and also read a bit more clearly.</p>

<p>EXAMPLES&hellip;</p>

<figure class='code'><figcaption><span>The case statement looks really clear&#8230;</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="k">def</span> <span class="nf">temperature_bot</span><span class="p">(</span><span class="n">temp</span><span class="p">)</span>
</span><span class='line'>  <span class="n">result</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span>
</span><span class='line'>  <span class="k">case</span> <span class="n">temp</span>
</span><span class='line'>    <span class="k">when</span> <span class="mi">0</span><span class="o">.</span><span class="n">.</span><span class="mi">16</span>
</span><span class='line'>      <span class="n">result</span> <span class="o">=</span> <span class="s2">&quot;cold&quot;</span>
</span><span class='line'>    <span class="k">when</span> <span class="mi">17</span><span class="o">.</span><span class="n">.</span><span class="mi">21</span>
</span><span class='line'>      <span class="n">result</span> <span class="o">=</span> <span class="s2">&quot;comfortable&quot;</span>
</span><span class='line'>    <span class="k">when</span> <span class="mi">22</span><span class="o">.</span><span class="n">.</span><span class="mi">100</span>
</span><span class='line'>      <span class="n">result</span> <span class="o">=</span> <span class="s2">&quot;hot&quot;</span>
</span><span class='line'>    <span class="k">else</span>
</span><span class='line'>      <span class="n">result</span> <span class="o">=</span> <span class="s2">&quot;you&#39;re probably dead&quot;</span>
</span><span class='line'>  <span class="k">end</span>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>




<figure class='code'><figcaption><span>The if statements are a lot more cluttered&#8230;</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="k">def</span> <span class="nf">temperature_bot</span><span class="p">(</span><span class="n">temp</span><span class="p">)</span>
</span><span class='line'>  <span class="n">result</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span>
</span><span class='line'>  <span class="k">if</span> <span class="n">temp</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span> <span class="n">temp</span> <span class="o">&lt;</span> <span class="mi">17</span>
</span><span class='line'>    <span class="n">result</span> <span class="o">=</span> <span class="s2">&quot;cold&quot;</span>
</span><span class='line'>  <span class="k">elsif</span> <span class="n">temp</span> <span class="o">&gt;</span> <span class="mi">16</span> <span class="o">&amp;&amp;</span> <span class="n">temp</span> <span class="o">&lt;</span> <span class="mi">22</span>
</span><span class='line'>    <span class="n">result</span> <span class="o">=</span> <span class="s2">&quot;comfortable&quot;</span>
</span><span class='line'>  <span class="k">elsif</span> <span class="n">temp</span> <span class="o">&gt;</span> <span class="mi">21</span> <span class="o">&amp;&amp;</span> <span class="n">temp</span> <span class="o">&lt;</span> <span class="mi">100</span>
</span><span class='line'>    <span class="n">result</span> <span class="o">=</span> <span class="s2">&quot;hot&quot;</span>
</span><span class='line'>  <span class="k">else</span>
</span><span class='line'>    <span class="n">result</span> <span class="o">=</span> <span class="s2">&quot;you&#39;re probably dead&quot;</span>
</span><span class='line'>  <span class="k">end</span>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>


<p>The difference doesn&rsquo;t seem to be a huge deal when you&rsquo;re scanning over the different code, but the clarity and ease of the case statement makes debugging easier when you&rsquo;re dealing with a larger set of code.</p>

<p>Over the weekend I managed to stay out of Manhattan. I don&rsquo;t know in the long run if this is a good or a bad thing, but I spent the weekend in Brooklyn coding, climbing with some Flatiron folks and managed to have enough time to watch a little football on Sunday.</p>

<p>I was really happy with the assessment we were given over the weekend. I think everybody at Flatiron goes through points in a day when they feel like the &lsquo;dumbest kid in class&rsquo; because they don&rsquo;t get something yet or are having trouble. Somehow, despite this happening to virtually everyone we don&rsquo;t seem to be able to shake that feeling just yet.</p>

<p>Having a solo assessment that goes over the material we&rsquo;ve covered so far went a long way to helping me confirm that I knew what I was doing so far. Not everything came to me right away but I managed to make my way through everything with a little help from google and my new best friend Rubular.</p>

<p>My &lsquo;take away&rsquo; from the weekend is the power of regular expressions. I think all of the code in my weekend homework that I am most proud of used regular expressions to accomplish a lot with very little code. They don&rsquo;t read as easily as normal ruby syntax but you can do some really powerful stuff with regular expressions and it makes them a lot of fun to use.</p>

<p>My goal for this week is to use yield and code blocks better. I was reviewing the Treehouse ruby material to brush up for week two and they showed some very cool ways to organize a chunk of code where the main method organizes and runs the sub-methods and yields to them to do the &lsquo;work&rsquo; to get the goals they want. This reminds me of the Jukebox assignment we worked on last week and makes me think that the program would have been a lot &lsquo;cleaner&rsquo; if I was more comfortable yielding to other methods.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Four]]></title>
    <link href="http://samueldowens.github.io/blog/2013/09/27/flatiron-school-day-four/"/>
    <updated>2013-09-27T08:23:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/09/27/flatiron-school-day-four</id>
    <content type="html"><![CDATA[<p>On day four we really got into Ruby. Most of the day was spent in lectures with a few labs mixed in and was punctuated by most of us being at the campus pretty late working on our homework.</p>

<p>A few takeaways that I need to make sure get ingrained in my head&hellip;</p>

<p>A method always returns the return of the last command it executes. This means if you write a method to manipulate an array and want to call that method later and have it return the manipulated array that you need to call the name of the array at the end of the method in order for the method itself to return that array.</p>

<p>Puts ALWAYS returns nil. So try really hard not to actually put it in a method. Definitely make sure that its not the last thing in an array unless I want the array to return nil.</p>

<p>I also saw syntax I like for short if statements to keep them more compact.</p>

<p>if x == 1
   puts &ldquo;x is 1!&rdquo;
end</p>

<p>is equivalent to</p>

<p>puts &ldquo;x is 1!&rdquo; if x == 1</p>

<p>I think the second iteration of code looks much cleaner and would like to start thinking of short if statements that way before I put them in a block.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Three]]></title>
    <link href="http://samueldowens.github.io/blog/2013/09/26/flatiron-school-day-three/"/>
    <updated>2013-09-26T08:34:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/09/26/flatiron-school-day-three</id>
    <content type="html"><![CDATA[<p>Day Three was the easiest day for me thus far with comprehension. It was mostly a review of and practice with GIT, HTML and CSS with some Ruby at towards the end of the day. I think they&rsquo;re trying to get us a lot of repetition with the basics so that when they really hit the harder stuff full force we&rsquo;ll be less-lost on the basics.</p>

<p>I am the most responsible student I have ever been, albiet through three days. I pay attention in class, work as hard as I can on my projects and do my homework thouroughly right away. Yesterday I woke up feeling like I was starting to get a cold, so I made sure to get plenty of vitamin C and went to bed at 9:30 when I was finished with my work to get a little extra sleep to help combat this cold.</p>

<p>I&rsquo;m not yet sure if this is the sign of maturity, or the complete devotion to a singular focus. I&rsquo;m assuming more of the latter, I am so focused on this program that there is nothing else to be concerned about other than working hard at coding and taking care of distractions that might lead to my inability to focus or work as hard as I want to.</p>

<p>One thing that I did learn today was how to use a splat (*) in method arguments in Ruby. With the little Ruby I know, I really enjoy using arrays to solve problems when I can. Normally I would have the array set up ahead of time and use a method to manipulate the array or the data within to solve a given problem. splat gives you some other options on manipulating similar sets of data however.</p>

<p>You can set up a simple splat method as follows to see how it works:</p>

<p>def splat(*inputs)<br>
puts inputs<br>
end<br></p>

<p>splat(1,2,4,5,6)</p>

<p>This will output the following:</p>

<p>1<br>
2<br>
4<br>
5<br>
6<br></p>

<p>This allows you to take a variable quanitity of inputs (it will also take strings) and manipulate them one at a time before deciding what to do with them. An example of when this might be useful would be if you were pulling a bunch of variable types of data from a database and wanted to sort that data, you could have the pieces get input through a splat method and have the method sort them by type (string, float, integer) into arrays before manipulating or looking at the data in the arrays with further functions.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day Two]]></title>
    <link href="http://samueldowens.github.io/blog/2013/09/25/day-two/"/>
    <updated>2013-09-25T08:36:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/09/25/day-two</id>
    <content type="html"><![CDATA[<p>I&rsquo;m catching up by posting my day two post on the morning of Day 3. Yesterday we spent a ton of time on Git and Github, as well as setting up our environment and getting plenty of practice with BASH. Most of this came fairly easily, though with Git it took me a while to even start to understand the differences between merging and rebasing.</p>

<p>My understanding is that when you create a new branch to work on a feature, other things can happen to the master branch while that feature is still being worked on (like other features or fixes being merged in). If you were to merge a feature in after many changes have happened to the master branch you can run into some conflicts when you try and merge the new branch in. These situations can sometimes be mitigated by rebasing the branch instead, removing it from the branch continuity and placing it back on top of the master branch. My understanding of exactly how this works is still a little incomplete, but I believe it does something like catch the base code up to current for the branch and then add the new feature changes rather than attempting to merge two complete sets.</p>

<p>I&rsquo;ve also decided that I want to do some (completely unqualified) self expirimentation and research into some of the non-computer related aspects of coding. Yesterday after about hour 9 or 10 of coding I started to hit a wall where it was &lsquo;hard&rsquo; to think and I was having to look up simple commands that I know off the top of my head normally. I was also becoming more frustrated more quickly when I ran into issues. I think of this as &lsquo;brain fatigue&rsquo; and would like to see how different factors like sleep, diet and exercise affect this over my time at Flatiron. Hopefully I&rsquo;ll find some ways to combat this issue that I imagine is being run into by more folks than myself.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Flatiron School Day One]]></title>
    <link href="http://samueldowens.github.io/blog/2013/09/24/hello-world/"/>
    <updated>2013-09-24T17:24:00-04:00</updated>
    <id>http://samueldowens.github.io/blog/2013/09/24/hello-world</id>
    <content type="html"><![CDATA[<p>It’s been one day and I can already tell this is going to be a period of weeks that defines my future. The first day of class 003 and the first day in the new Flatiron campus was an amazing experience. A giant space filled with like-minded nerds and geeks from all different backgrounds coming together to code for an intense amount of time.</p>

<p>The best part? At the end of a long-day it hadn’t become a grind. I was laughing just as much when we wrapped up as when we started and wished the staff had let us go a little further as I was really digging into cleaning up the CSS in our project.</p>

<p>I can’t wait to see what the next 12 weeks hold.</p>
]]></content>
  </entry>
  
</feed>
