<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sandy Edwards on Medium]]></title>
        <description><![CDATA[Stories by Sandy Edwards on Medium]]></description>
        <link>https://medium.com/@sedwardscode?source=rss-fd94990afd28------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*W7ll0UAgY3T4jw34B0d_AQ.jpeg</url>
            <title>Stories by Sandy Edwards on Medium</title>
            <link>https://medium.com/@sedwardscode?source=rss-fd94990afd28------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 05:54:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sedwardscode/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Object Oriented Design Principles]]></title>
            <link>https://medium.com/@sedwardscode/object-oriented-design-principles-2aa788021b96?source=rss-fd94990afd28------2</link>
            <guid isPermaLink="false">https://medium.com/p/2aa788021b96</guid>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[object-oriented]]></category>
            <dc:creator><![CDATA[Sandy Edwards]]></dc:creator>
            <pubDate>Tue, 08 Jan 2019 00:25:00 GMT</pubDate>
            <atom:updated>2019-01-08T00:27:03.861Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0e6fFQQRvkZ1LkeAHAMx7w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/-K6JMRMj4x4?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Florian Klauer</a> on <a href="https://unsplash.com/search/photos/objects?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>This week I’m going to talk about the fundamentals of object oriented design. There are a few key concepts we need to understand if we want to master the art of designing applications in an OO style.</p><h3>Encapsulation</h3><p>The first principle of object oriented programming is encapsulation. Encapsulation is the act of making certain portions of an object’s state private, so that they cannot be accessed by anything other than the object itself. This is important because often times when we are building an application there are certain variables or methods that should not be altered from the outside, say by a user for example. These pieces of state are essential to the functionality of the project, and manually altering them could potentially break it or cause undesired results.</p><h3>Abstraction</h3><p>Abstraction is a concept that is very frequently thought about in programming in general. It is also closely tied with encapsulation. Imagine you have a microwave. The microwave has a button that says start, and numbers to set the time for how long you’d like the microwave to run. The logic of how the microwave actually deals with storing the user’s input, starting itself, and running until it has reached the correct amount of time is hidden from the user. All the user sees is a nice button based interface that’s easy to understand. This is abstraction.</p><p>Abstraction removes access to all parts of an object that don’t need to be accessed from the outside. That way everything that interacts with the object has a much easier time doing so, and theres no risking of breaking the internal functionality of the object itself.</p><h3>Inheritance</h3><p>Inheritance allows us to keep our code DRY (don’t repeat yourself) by creating objects that can inherit functionality and state from parent objects. This is only necessary if the child object is a type of the parent that has more specific functionality needed to differentiate it from other types of that parent class. For example: Cars, trucks and vans are all types of a parent Vehicle class. A vehicle can drive, stop and hold passengers. Each child of the vehicle class needs to be able to do all of the things that it’s parent can, but also has it’s own unique properties. A van can hold more passengers than a car, but a car can drive faster than a van.</p><h3>Polymorphism</h3><p>Polymorphism, when translated from Greek literally means “Many Shapes”. It’s just another way to describe the power of inheritance. One class of item can have many different “shapes” or child classes, with their own unique abilities. Thus object oriented classes that use inheritance are polymorphic in nature.</p><p>Thats all for now! Until next time…</p><h3>Good Code // Good Life</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2aa788021b96" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Diving Deeper Into MergeSort]]></title>
            <link>https://medium.com/@sedwardscode/diving-deeper-into-mergesort-70981ba8550d?source=rss-fd94990afd28------2</link>
            <guid isPermaLink="false">https://medium.com/p/70981ba8550d</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[coding-interviews]]></category>
            <category><![CDATA[sorting-algorithms]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Sandy Edwards]]></dc:creator>
            <pubDate>Mon, 31 Dec 2018 23:04:41 GMT</pubDate>
            <atom:updated>2019-01-01T22:18:54.999Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s New Years Eve 2018, and what better way to start the new year with a deeper, solid understanding of how the MergeSort algorithm works? (he said in a room full of non-programmers who responded with a mix of confused faces and groans/eye-rolls).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*ZLBrHmJSoMZBPXyCzPiUbg.gif" /></figure><p>But really, going into software engineering interviews MergeSort is an essential tool to understand if you want to display a deeper knowledge of algorithms. That being said, I’m going to go deeper into my last post which was a quick overview of how to implement MergeSort in Javascript.</p><h3>Draw 👏 It 👏 Out👏</h3><p>MergeSort relies heavily on recursion. When dealing with complex recursive code, I find I can grasp it most quickly by creating a diagram of how the call stack handles and combines the results of the various repetitive function calls being made.</p><p>First off, here’s the code from the last post for review:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_SPTPgZs3geAbPlVjmV9IQ.png" /></figure><p>And here’s a diagram I created of how it works with a simple input of the array:</p><pre>[3, 1, 2]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*sW5cWHi8S_P7DZI9zymhZA.png" /></figure><p>If you follow the tree of recursive function calls, you’ll see that the mergeSort function progressively splits the array into smaller and smaller pieces until they are a length of 1. Then the arrays of one are merged and progressively sorted all the way up the stack.</p><p>Drawing diagrams like this can really help you to step through an algorithm and make sense of what the code is actually doing. I highly recommend it any time you get that textbook programmer feeling that you can’t quite wrap your head around what’s going on behind the scenes with your code.</p><p>Until next time,</p><h3>Code // Life</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70981ba8550d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing MergeSort in Javascript]]></title>
            <link>https://medium.com/@sedwardscode/implementing-mergesort-in-javascript-4323e489c6a0?source=rss-fd94990afd28------2</link>
            <guid isPermaLink="false">https://medium.com/p/4323e489c6a0</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sandy Edwards]]></dc:creator>
            <pubDate>Tue, 25 Dec 2018 04:27:53 GMT</pubDate>
            <atom:updated>2019-01-18T17:25:54.079Z</atom:updated>
            <content:encoded><![CDATA[<p>Today I’m going to show you how to implement the popular mergeSort algorithm using Javascript. Sorting algorithms have a tendency to be demanding in terms of time complexity, but mergeSort happens to be one of the most efficient ones out there.</p><p>MergeSort depends on a helper method and a recursive structure that is somewhat difficult to wrap your head around at first, so spend some time with this one. I find it helpful to walk through each step that the algorithm takes using a short test data set to fully grasp what the recursion is accomplishing. Here is the code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V75Jc3CsSQfWMBW1KdoYsA.png" /></figure><p>That’s all there is to it! I’ll cover more on how this actually works in my next post. Thanks so much for reading.</p><h3>Code // Life</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4323e489c6a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Properly Test a Rails API with Rspec]]></title>
            <link>https://medium.com/@sedwardscode/how-to-properly-test-a-rails-api-with-rspec-f15cbe1dfd11?source=rss-fd94990afd28------2</link>
            <guid isPermaLink="false">https://medium.com/p/f15cbe1dfd11</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[rspec]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Sandy Edwards]]></dc:creator>
            <pubDate>Tue, 18 Dec 2018 00:11:56 GMT</pubDate>
            <atom:updated>2018-12-18T00:20:24.461Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qkI4ZIQ3-W06Svv_lo7atQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/XzuJuyYLjmE?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Joshua Fuller</a> on <a href="https://unsplash.com/search/photos/red-gemstone?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Hi, programming world! Today I’m going to cover what I consider to be the best way to handle writing tests for the GET, POST, PUT and DELETE routes on your RESTful Ruby on Rails API.</p><h4>A Few Good Gems</h4><p>In order to run our tests, populate them with dummy data and then clean the temporary database, we will need to add a few new gems to the development, test namespace in our gemfile.</p><pre>group :development, :test do<br>  gem &#39;rspec-rails&#39;, &#39;~&gt; 3.6&#39;<br>  gem &#39;faker&#39;<br>  gem &#39;factory_bot_rails&#39;<br>  gem &#39;database_cleaner&#39;<br>end</pre><p>Add the gems listed above and run bundle install in your terminal while in the API’s root folder.</p><h4>File &amp; Folder Setup</h4><p>Ruby on Rails creates a tests folder by default. Since we will be using the Rspec gem for our Rails API’s tests, we’ll want to get rid of that folder and proceed to initialize an rspec directory in our Rails via the terminal. Run the following code in the command line:</p><pre>rails generate rspec:install</pre><p>This will create a spec folder in the root of your project that initializes with a rails_helper.rb and spec_helper.rb file.</p><p>By default, Rspec resets or ‘cleans’ the database after each test method is ran. However, in some of our methods we will be seeding data in a way that Rspec does not know how to properly clean up. Because of this, we will be using the database-cleaner gem to insure that none of our test data overlaps and causes false negatives in our tests.</p><p>Inside the spec/rails_helper.rb file, set the line of code that reads:</p><pre>config.use_transactional_fixtures = true</pre><p>to:</p><pre>config.use_transactional_fixtures = false</pre><p>Below that line, we’ll add the configs for the database-cleaner.</p><pre>config.use_transactional_fixtures = false</pre><pre>config.before(:suite) do<br>    DatabaseCleaner.clean_with(:truncation)<br>  end</pre><pre>config.before(:each) do<br>    DatabaseCleaner.strategy = :transaction<br>  end</pre><pre>config.before(:each, :js =&gt; true) do<br>    DatabaseCleaner.strategy = :truncation<br>  end</pre><pre>config.before(:each) do<br>    DatabaseCleaner.start<br>  end</pre><pre>config.after(:each) do<br>    DatabaseCleaner.clean<br>  end</pre><pre>config.before(:all) do<br>    DatabaseCleaner.start<br>  end</pre><pre>config.after(:all) do<br>    DatabaseCleaner.clean<br>  end</pre><h4>Factory Setup</h4><p>Once those steps are complete, we can begin setting up a factory file which will contain some methods for dynamically creating dummy seed data for our tests. Create a file in your spec folder called factories.rb.</p><p>Inside the factories.rb file, we’ll add some code to create a dummy random Question instance in our database.</p><pre>FactoryBot.define do<br>  service_array = [&quot;Test Service&quot;, &quot;Test Service Two&quot;]<br>  letter = [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;]</pre><pre>factory :random_question, class: Question do<br>    question { Faker::Lorem.question }<br>    answer { Faker::Lorem.sentence }<br>    service { service_array.sample }<br>    number { Faker::Number.between(1, 2) }<br>    letter { letter.sample }<br>  end<br>end</pre><p>Here we are using the Faker gem library for generating dummy data. For a full list of Faker data options, see the docs: <a href="https://github.com/stympy/faker">https://github.com/stympy/faker</a></p><p>We’ve created a method that generates a Question instance with a random lorem ipsum question, answer, random number, and samples from our service and letter arrays.</p><h4>And Now for the Tests</h4><p>Create a folder called requests in the spec folder, this is where we will create our test files.</p><p>Make a test file for the the get all tests route called get_questions_spec.rb. Be sure to include the ‘_spec.rb’ at the end, as this allows Rspec to detect it as a test file.</p><p>Inside the file, add this code:</p><pre>require &#39;rails_helper&#39;</pre><pre>describe &quot;get all questions route&quot;, :type =&gt; :request do<br>  let!(:questions) {FactoryBot.create_list(:random_question, 20)}</pre><pre>before {get &#39;/api/v1/questions&#39;}</pre><pre>it &#39;returns all questions&#39; do<br>    expect(JSON.parse(response.body).size).to eq(20)<br>  end</pre><pre>it &#39;returns status code 200&#39; do<br>    expect(response).to have_http_status(:success)<br>  end<br>end</pre><p>First, we create 20 random questions in the database using the factory bot. Then we right a few assertions testing the size of the get API call’s response, and status code.</p><p>Next, create a post_question_spec.rb file for the new question route.</p><pre>require &#39;rails_helper&#39;</pre><pre>describe &quot;post a question route&quot;, :type =&gt; :request do</pre><pre>before do<br>    post &#39;/api/v1/questions&#39;, params: { :question =&gt; &#39;test_question&#39;, :answer =&gt; &#39;test_answer&#39;, :service =&gt; &#39;test_service&#39;, :number =&gt; 2, :letter =&gt; &#39;a&#39; }<br>  end</pre><pre>it &#39;returns the question&#39; do<br>    expect(JSON.parse(response.body)[&#39;question&#39;]).to eq(&#39;test_question&#39;)<br>  end</pre><pre>it &#39;returns the question\&#39;s answer&#39; do<br>    expect(JSON.parse(response.body)[&#39;answer&#39;]).to eq(&#39;test_answer&#39;)<br>  end</pre><pre>it &#39;returns the question\&#39;s service&#39; do<br>    expect(JSON.parse(response.body)[&#39;service&#39;]).to eq(&#39;test_service&#39;)<br>  end</pre><pre>it &#39;returns the question\&#39;s letter&#39; do<br>    expect(JSON.parse(response.body)[&#39;letter&#39;]).to eq(&#39;a&#39;)<br>  end</pre><pre>it &#39;returns the question\&#39;s number&#39; do<br>    expect(JSON.parse(response.body)[&#39;number&#39;]).to eq(2)<br>  end</pre><pre>it &#39;returns a created status&#39; do<br>    expect(response).to have_http_status(:created)<br>  end<br>end</pre><p>Here we are making an API call to the new Question route with fake seed data and testing if the response matches the provided data.</p><p>Next, for the update Question route create put_question_spec.rb.</p><pre>require &#39;rails_helper&#39;</pre><pre>describe &quot;PUT /api/v1/questions/:id&quot; do</pre><pre>before(:each) do<br>    <a href="http://twitter.com/question">@question</a> = create(:random_question)<br>  end</pre><pre>it &#39;updates a question&#39; do</pre><pre><a href="http://twitter.com/new_question">@new_question</a> = Faker::Lorem.question<br>    <a href="http://twitter.com/new_answer">@new_answer</a> = Faker::Lorem.sentence</pre><pre>put &quot;/<a href="/service/mailto:api/v1/questions/#{&lt;a%20href=">@question</a>.id&quot;&gt;api/v1/questions/#{<a href="http://twitter.com/question">@question</a>.id}&quot;, params: {question: <a href="http://twitter.com/new_question">@new_question</a>, answer: <a href="http://twitter.com/new_answer">@new_answer</a>}</pre><pre>expect(response.status).to eq(202)<br>    expect(Question.find(<a href="http://twitter.com/question">@question</a>.id).question).to eq(<a href="http://twitter.com/new_question">@new_question</a>)<br>    expect(Question.find(<a href="http://twitter.com/question">@question</a>.id).answer).to eq(<a href="http://twitter.com/new_answer">@new_answer</a>)<br>  end<br>end</pre><p>Here we send a PUT request to the API with some generated Faker data and assert that the response matches the original data.</p><p>Finally, the DELETE question route. Inside delete_option_spec.rb add this code:</p><pre>require &#39;rails_helper&#39;</pre><pre>describe &quot;delete question route&quot; do<br>    before(:each) do<br>        <a href="http://twitter.com/question_one">@question_one</a> = create(:random_question)<br>        <a href="http://twitter.com/question_two">@question_two</a> = create(:random_question)<br>    end</pre><pre>it &#39;should delete the question&#39; do</pre><pre>get &quot;/api/v1/questions&quot;<br>      expect(response.status).to eq(200)<br>      expect(JSON.parse(response.body)).to eq([YAML.load(<a href="http://twitter.com/question_one">@question_one</a>.to_json),YAML.load(<a href="http://twitter.com/question_two">@question_two</a>.to_json),])</pre><pre>delete &quot;/api/v1/questions/#{<a href="http://twitter.com/question_one">@question_one</a>.id}&quot;<br>      expect(response.status).to eq(204)</pre><pre>get &quot;/api/v1/questions&quot;<br>      expect(JSON.parse(response.body)).to eq([YAML.load(<a href="http://twitter.com/question_two">@question_two</a>.to_json)])<br>    end</pre><pre>end</pre><p>Just as we did with the other routes, we create an API request with some Faker data and compare the response with the original data.</p><p>And that should do it for testing your Rails API!</p><p>Thanks for reading…</p><h3>Love Code // Love Life</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f15cbe1dfd11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Ace Cultural Phone Interviews]]></title>
            <link>https://medium.com/@sedwardscode/how-to-ace-cultural-phone-interviews-7cd65eb26010?source=rss-fd94990afd28------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cd65eb26010</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[interviewing]]></category>
            <category><![CDATA[interview-tips]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Sandy Edwards]]></dc:creator>
            <pubDate>Mon, 10 Dec 2018 16:00:02 GMT</pubDate>
            <atom:updated>2018-12-10T19:45:53.105Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h4rY9ZnA4g7qW3vOmOjp_Q.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/JYGnB9gTCls?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Alexander Andrews</a> on <a href="https://unsplash.com/search/photos/phone?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>I’m going to switch gears a bit from my usual tech focused content this week to tell you a little bit about what I’ve learned about behavioral interviews in tech and how to put your best foot forward. Obviously the content of how you respond to questions will be specific to your own background, personality and experiences but hopefully this blog can provide a little guidance for things to keep in mind as you present yourself to potential employers.</p><h4>KISS (Keep It Simple, Stupid)</h4><p>When conducting a cultural interview, typically the interviewer is just trying to get a sense for who you are, what your background is, what you’re passionate about, etc. They want to have a feel for your values and personality by the end of the conversation.</p><p>That being said, remember this is a <strong>conversation </strong>between two human beings. Your primary objective should be to be present, be yourself and engage with your interviewer. These are fundamental values to keep in mind if you want to have a good conversation with anyone, not just when you’re being interviewed.</p><p>What you want to avoid is <strong>overcomplicating</strong> your answers and behaving as if you’re providing long, written responses to the questions. This is not how people speak to each other in real life! I know it’s tempting to want to explain every detail of your background and what makes you the most amazing candidate in the universe, but imagine if you did that on a first date with a potential love interest?</p><p>Going on and on about yourself comes off as desperate, pushy and will cause your interviewer to be easily distracted and lose interest in the conversation. Give them short, to the point answers that come from the heart and you’ll connect well.</p><h4>Do Your Research</h4><p>The most fundamental thing to focus on when you’re job-seeking and actively interviewing is <strong>preparation is the key to success</strong>. Take time to read as much as you can about the company and the role you’re interviewing for.</p><p>Prepare yourself by typing up answers to commonly asked questions (<strong>Can you explain what our company does? Why do you want to work for this company? Why are you a good fit for the role?</strong>).</p><p>As I mentioned before, these answers will not serve as phrases to memorize and recite during the interview. This is just a great way to gather your thoughts and conceptualize the best versions of your answers.</p><h4>Prepare Your Battle-station</h4><p>If the interview is over the phone, you want to be sure you have a quiet, comfortable place to sit with your computer. Load up your resume and the document that holds all your prepared answers to questions. You can reference your answers if you’re blanking on a question, but DO NOT read from them word for word. Human beings are really good at detecting whether something is scripted or genuine. Your interviewer <strong>will</strong> know the difference.</p><p>Keep your resume open for reference just in case the interviewer wants to speak about a specific area. They will more than likely be looking at your resume as well so it’s really valuable to be on the same page.</p><h4>Dress for the Job / Get the Job</h4><p>This may seem a little hokey, but I find it really helps put me in the right state of mind. I like to dress for phone interviews exactly as I would if the interview was in person. In my experience, my appearance greatly effects my confidence, and confidence carries through very clearly over the phone. If you’re sloppy, sleepy and still in your pajamas you will not come across as well as you would in your interviewing attire.</p><h4>Be Yourself</h4><p>Finally, the most cliche piece of advice out there, but still a really important one. Just<strong> be yourself</strong>! Your interviewer is just a regular person too, and getting to know someone always goes over best when you are your full, honest self. Don’t be afraid to share tidbits about your personal life if the vibe seems right. I like to mention my hilarious french bulldog named Jellybean if the moment strikes. It’s a great way to show the interviewer that I’m a fun, caring and positive person, and I love animals.</p><p>Good luck with your interviews and remember…</p><h3>Love Code // Love Life</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cd65eb26010" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS Preprocessors: What? Why?…How?!]]></title>
            <link>https://medium.com/@sedwardscode/css-preprocessors-what-why-how-7bc5a7a564de?source=rss-fd94990afd28------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bc5a7a564de</guid>
            <category><![CDATA[css-preprocessors]]></category>
            <category><![CDATA[sass]]></category>
            <category><![CDATA[less]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Sandy Edwards]]></dc:creator>
            <pubDate>Mon, 03 Dec 2018 23:00:34 GMT</pubDate>
            <atom:updated>2018-12-03T23:02:37.529Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dN9oVWszhr_TdFhEldWVeQ.png" /><figcaption>Photo by <a href="https://unsplash.com/@lishakov">Andrej Lišakov</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><p>A lot of entry level developers struggle with CSS, given it’s narrow logical functionality when compared to programming languages like Javascript, Java, Python, Ruby etc. A code newbie might find themselves wanting to hack out a conditional statement or a loop to create some dynamic styling in vanilla CSS, only to come to the rude awakening that this just isn’t possible without a little help from some other tools. That’s where CSS Preprocessors come in to save the day!</p><h3><strong>What is a CSS Preprocessor?</strong></h3><p>CSS Preprocessors are tools that extend the functionality of vanilla CSS by adding a wide variety of logical syntax such as you might see in a normal programming language. Preprocessors take code written with this new and versatile syntax, and then compile it into traditional CSS that the browser can work with. The 3 most well-known CSS preprocessors are SASS (or SCSS) LESS and Stylus. For the purposes of this blog I’ll be only be providing examples of code written in SASS.</p><h3>Why should I bother with a CSS Preprocessor?</h3><p>There are a lot of reasons why CSS preprocessors are a very important tool for front end and full stack developers, particularly those who are working on a large and complex code base.</p><ol><li><strong>The DRY Principle</strong></li></ol><p>Any decent software engineer should be well aware of the fundamental pillar of coding best practices known as DRY, or Don’t Repeat Yourself. In case your new to the acronym, what it means is that a programmer should always strive to avoid rewriting any bit of code within their application. This is often solved by taking a piece of code that may have been repeated in the app and turning it into a reusable helper function or variable.</p><p>CSS Preprocessors allow you to keep your code DRY because they give you access to things like variables, mixins and extends which allow you to replace repeated css rules with something reusable.</p><p><strong>2. Complex Logic</strong></p><p>Preprocessors give you access to some logical syntax you would find in your favorite programming language of choice, so that you can create dynamic styling that responds to the output of the logic.</p><p>This includes loops, If/Else statements, and visual nesting of CSS rules.</p><p>Overall, preprocessors allow for CSS styling that is efficient and concise in terms of how it is written and powerful and dynamic in its ability to perform more complex logical operations.</p><h3>Preprocessors in Action:</h3><p>Here are the primary features within a CSS Preprocessor:</p><h4>Variables</h4><p>Variables can be created to reuse data multiple times within your stylesheet:</p><pre>$color-one: #AAF700;</pre><pre>div {<br>     background-color: $color-one;<br>}</pre><h4>Nesting</h4><p>Many programmers probably find it frustrating that you can’t create a nested visual hierarchy of CSS elements that inherit from one another. Preprocessors give you this functionality:</p><pre>$font-size: 24px;</pre><pre>ol {<br>    margin: 10px 0;</pre><pre>    li {<br>        padding: 5px 5px;<br>    }<br>}</pre><p>Here all list items that are inside of an ordered list will receive the given padding.</p><h4>Mixins</h4><p>Mixins allow you to take a prewritten set of CSS rules and plug it in inside of any CSS element’s styling. This is excellent for cutting down on repeated code.</p><pre>@mixin hugediv($height) {<br>     height: $height;</pre><pre>     &amp;:hover {<br>         background-color: #F5F5F5;<br>     }<br>}</pre><pre>#my-favorite-div {<br>     @include hugediv(900px);<br>}</pre><p>Here we have a mixin that allows us to pass in an argument that will then be used as the height of the object within the reusable CSS rule.</p><h4>Extends</h4><p>Extends let you share the entire list of CSS rules of one element with any other element of your choice. Hence the name “Extends” because elements can extend their full styling to other elements.</p><pre>.dinosaur-div { <br>       background-image: url(https://medium.com/&#39;https://dino.com/trex.jpg&#39;);<br>       background-repeat: no-repeat;<br>       background-size: cover;<br>}</pre><pre>#some-other-div {<br>       @extend .dinosaur-div;<br>}</pre><p>Now the element with the id #some-other-div inherits all of the styling of the dinosaur div!</p><h4>If/Else Statements</h4><p>Preprocessors give your styling the ability to dynamically alter itself depending on certain conditionals.</p><pre>$my-variable: true;</pre><pre>@if $my-variable == true {<br>        $color-one: blue;<br>} @else {<br>        $color-one: red;<br>}</pre><p>If the variable $my-variable is set to true, another SASS variable called $color-one will be set to blue, otherwise it will be set to red.</p><h4>Color Functions</h4><p>Preprocessors support a wide variety of built in functions for altering a color dynamically.</p><pre>saturate($color, $amount)<br>desaturate($color, $amount)<br>lighten($color, $amount)<br>darken($color, $amount)<br>adjust-hue($color, $amount)<br>opacify($color, $amount) <br>transparentize($color, $amount)<br>mix($color1, $color2, [$amount])<br>grayscale($color)<br>complement($color)</pre><h4>Loops</h4><p>Iteration becomes possible within a preprocessor by using loop syntax:</p><pre>@for $i from 1 through 100 {<br>        .content-div#{$i} {<br>            background-color: darken(blue, 0% + $i);<br>        }<br>}</pre><p>This loop would give divs with class name .content-div1 through .content-div100 gradually lighter blue background colors.</p><h4>Imports</h4><p>You can easily combine multiple stylesheets into one without rewriting any code by importing them.</p><pre>@import &quot;mixins/mixin.scss&quot;;<br>@import &quot;card.css&quot;;</pre><h4>Math</h4><p>Preprocessors allow for arithmetic to be written anywhere within a CSS rule without the need for the calc() function used in vanilla CSS.</p><pre>my-div {<br>        width: (100vw / 3);<br>}</pre><p>That’s pretty much all that’s included within the glory of CSS Preprocessors. Thanks for reading!</p><h4>Love Code // Love Life</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bc5a7a564de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Simple Explanation of MVC]]></title>
            <link>https://medium.com/@sedwardscode/a-simple-explanation-of-mvc-d2020af66a2f?source=rss-fd94990afd28------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2020af66a2f</guid>
            <category><![CDATA[mvc]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Sandy Edwards]]></dc:creator>
            <pubDate>Tue, 27 Nov 2018 01:17:15 GMT</pubDate>
            <atom:updated>2018-11-27T01:17:15.357Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SVYnC9r0QP0DltrY90je-g.jpeg" /></figure><p>The acronym MVC is a software architectural design pattern that stands for:</p><p><strong>Model View Controller</strong></p><p>Sounds a bit odd if you’re not familiar with the pattern, but essentially the purpose of MVC is to separate the functionality of a piece of software into three main parts. This allows us to create easy to comprehend code bases that are organized in a logical and intuitive manner. Thus, many programmers can collaborate on a project within the MVC pattern and easily contribute without much confusion in terms of the software’s functionality.</p><p>Some examples of frameworks that implement the concepts of MVC are…</p><p><strong>Ruby on Rails (Ruby), Sinatra (Ruby), Laravel (PHP), Codeigniter (PHP), Zend (PHP), Express (JS), Backbone (JS), Angular (JS), Django (Python), Flask (Python).</strong></p><h4>Model</h4><p>The model aspect of the MVC can be considered the brain of the application, this is because it handles the bulk of the logic. The model typically pulls and manipulates data from a database and then provides it to the controller.</p><h4>View</h4><p>The view is the area of the application that renders what the user actually sees on the screen. This typically consists of HTML and CSS with all necessary dynamic data being provided by the controller.</p><h4>Controller</h4><p>The controller receives inputs from the user through the view and then communicates with the model in order to make database requests. The necessary response data is then passed by the controller to the view for rendering.</p><p>That about sums up the basics of MVC, so until next time ya’ll…</p><h4>Love Code // Love Life</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2020af66a2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Traversing a Binary Search Tree]]></title>
            <link>https://medium.com/@sedwardscode/traversing-a-binary-search-tree-a19b8e759d35?source=rss-fd94990afd28------2</link>
            <guid isPermaLink="false">https://medium.com/p/a19b8e759d35</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[breadth-first-search]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[depth-first-search]]></category>
            <dc:creator><![CDATA[Sandy Edwards]]></dc:creator>
            <pubDate>Mon, 19 Nov 2018 18:23:11 GMT</pubDate>
            <atom:updated>2018-11-19T18:30:20.458Z</atom:updated>
            <content:encoded><![CDATA[<h3>Binary Search Trees &amp; Tree Traversal</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*chJi2hZP1iZYpFUe_St4Cg.png" /></figure><p>Today I’m going to cover the two most common ways of traversing, or iterating through the contents of a data structure known as a <strong>Binary Search Tree</strong>. These are known as Breadth First Traversal (BFT) and Depth First Traversal (DFT). But before we get started…</p><h4><strong>What is a Binary Search Tree?</strong></h4><p>A binary search tree is a data structure composed of nodes which each contain a piece of data, and a reference to two child nodes, the left child and the right child. The left child node’s data must always be smaller than the data of the parent node, and the right child node’s data must be larger than that of the parent node. Also, something important to note, when creating a binary search tree we must define a root node, which represents the base of the tree and thus the midpoint of all of the other nodes’ values. We end up with a tree structure of nodes, each with two children at the most.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*z6MZM8_BYR8X6Ykk8GsrZQ.png" /></figure><p>As you can see, the right side of the tree contains nodes with data values that are all larger than the root node, and the left side contains nodes with data values that are all smaller than the root node.</p><h4><strong>Breadth First Traversal (BFT)</strong></h4><p>Breadth first traversal is a technique for traveling through a tree data structure by moving progressively left to right through each row of nodes and down to the next row after the current row is complete. Here’s a nice illustration for clarity:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*7mSlAtz-fjb2c0VDYqYEkQ.gif" /></figure><p>We travel from the root node ‘F’ down to the next row and reach ‘B’ then ‘G’, then continue to the next row and hit ‘A’, ‘D’, then ‘I’ and so on. Breadth first search is a great tool to reach for if you are looking to find a node that is somewhat close to the root node.</p><h4>Depth First Traversal (DFT)</h4><p>Depth first traversal, the other common tool for moving through the elements of a tree, is done by first traveling down the left most branch of the tree until it hits the bottom of the tree. Once at the bottom, it will operate on each sibling of the left most child of the tree. Then the process will travel back up to the closest parent node, then operate on the next child of that node and all of its descendants. It continues to move down each path of the tree to the very bottom until all paths have been traveled. A bit confusing when written, but here’s a clear diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*rVOmS-wCaPHT9w3tLfZ1SA.gif" /></figure><p>If you follow the path of the dotted line, the depth first traversal path is easy to grasp. It moves from left to right, looking for the deepest point of each branch and continuing on. Depth first search is great if you are searching for a node in your tree that could be very deep down in the tree structure.</p><p>That concludes my walk through of binary tree traversal! Hope this helps you climb some digital trees like the Donkey Kong you truly are.</p><h3>Love Code // Love Life</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a19b8e759d35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing a Binary Search in Javascript]]></title>
            <link>https://medium.com/@sedwardscode/implementing-a-binary-search-in-javascript-8e4e725eb6aa?source=rss-fd94990afd28------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e4e725eb6aa</guid>
            <category><![CDATA[binary-search]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Sandy Edwards]]></dc:creator>
            <pubDate>Mon, 12 Nov 2018 22:20:02 GMT</pubDate>
            <atom:updated>2018-11-19T17:23:56.346Z</atom:updated>
            <content:encoded><![CDATA[<p>It can be difficult for junior level software engineers to conceptualize efficient ways of searching through large sets of data that go beyond simply iterating through each element in the data set and comparing it with a target input, also known as a linear search. An excellent way to add a great deal of efficiency to any search algorithm that deals with a sorted data set is to use a technique called <strong>Binary Search</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NADRR2d0DGcBvPFg144Crg.png" /></figure><p>The concept of a binary search is simple. First you calculate the midpoint, the left most element and the right most element in the dataset. To start the left element will be defined as the first item, and the right will be the last.</p><p>Once we’ve assigned these variables, we can begin making comparisons to initiate the binary search. The gist of the primary logic of this algorithm is to compare our target number with the current midpoint. If the target is less than the midpoint, we redefine our search boundaries of left and right to be 0 and one less than the midpoint. Thus we are splitting the number of elements we’re searching through in half and only continuing the search for the left half of the original dataset. This same logic is applied to the right half of the dataset if the target is larger than the midpoint. Within either of these cases we must then redefine the midpoint as the middle index between our new left and right indices. This halving and comparison continues until the midpoint either matches the target value, or the target is not found.</p><p>It’s pretty plain to see how this technique can speed up a search, primarily because the body of data that you’re dealing with halves in size with every iteration of the loop. A linear search has a linear runtime complexity or O(n), and a binary search has an average runtime complexity of O(log n). Thus, the bulk of the time consuming logic within the binary search occurs at the start of the algorithm regardless of the input size, and the number of remaining operations becomes smaller and smaller with each iteration. So our binary search’s time complexity does not grow equally in size with the amount of inputs. It is substantially smaller than O(n) for large datasets.</p><h4>So that concludes my verbal explanation of a binary search. Let’s see some code!</h4><p>Below I’ll provide two examples of great implementations of a binary search in Javascript. The first is done with a basic while loop, and the other displays how the algorithm can be solved using recursion. Check it out:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a8cM4Zg5CTccyMVhSIc-XQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_R0v9t03yCHFGT4rJ3Jckw.png" /></figure><p>And there you have it! Feel free to write me if you have any questions. Until next time people…</p><h3><strong>Love Code // Love Life</strong></h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e4e725eb6aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Modern Server Technology Guide]]></title>
            <link>https://medium.com/@sedwardscode/modern-server-technology-guide-8daabc217dfa?source=rss-fd94990afd28------2</link>
            <guid isPermaLink="false">https://medium.com/p/8daabc217dfa</guid>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Sandy Edwards]]></dc:creator>
            <pubDate>Mon, 05 Nov 2018 21:43:10 GMT</pubDate>
            <atom:updated>2018-11-19T17:20:49.318Z</atom:updated>
            <content:encoded><![CDATA[<p>As a developer it’s really important to understand how modern server technology is used and how to apply server tools in the right way when scaling an application. This blog will serve as an introductory guide to how servers commonly interact with one another in order to render a dynamic web page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pfDH-JsxgJrMgI5Xb9TcDg.png" /></figure><h3><strong>What is a server?</strong></h3><p>A server is typically a high powered computer that handles the processes a network needs to function. This can vary from database management, running application logic, processing HTTP requests, encryption and security, and email management.</p><p>If the network or application you want to build is somewhat small in size and you have no plans for scaling the project, one server can typically handle all of these responsibilities at once. This is referred to as Virtual server architecture, because it allows more than one server to run on the same machine. However, if you would like to scale your project and ensure that it will not fail under a heavy user load, there is a different more structured approach to setting up your network.</p><h3><strong>Servers for Scaling</strong></h3><p>Before we talk about our local server network, we have to understand what a DNS server is. DNS servers (Domain Name Servers) are essentially phone books for web page IP addresses. When you type <a href="http://www.google.com/">www.google.com</a> into your browser search bar, a DNS server somewhere in the world receives the request, locates Google’s IP address and redirects you to the server network that contains Google’s web application.</p><p>Once the DNS server has redirected the user to the correct server network based on the site’s IP address, the app’s local network is typically made up of three parts.</p><ol><li><strong>HTTP server:</strong></li></ol><p>An HTTP server receives the HTTP request and assesses whether the request is simple enough to be handled by itself (request for a graphic for example), if the request involves rendering a file built by our application’s front end framework it will pass the request to the next server which is the…</p><p><strong>2. Application server:</strong></p><p>The App server interprets the request and runs any corresponding logic required to display the particular web page route that was requested. If any activity from the request involves accessing or altering the database, the App server will the communicate with our final server, the Database server. Upon receiving the information required from the Database server, the App server will provide the HTTP server with the code required to display the page.</p><p><strong>3. Database Server:</strong></p><p>The Database server stores all of the application’s data, and allows for alteration, or rendering of any information stored by the application in order to provide the correct user experience. The Database server is the final link in the server chain and is only accessed by the App server when necessary.</p><h3>Division of Labor</h3><p>Servers are split up into these independent responsibilities in order to allow for the maximum access to processing resources when dealing with a heavy load of application usage. These individual servers can easily manage their individual tasks at scale much more reliably and efficiently than a single Virtual server.</p><h3>Cloud Storage</h3><p>An increasingly popular way of managing data and functionality nowadays often involves hosting pieces or the entire application offsite in the cloud. This essentially means that instead of hosting your application locally inside of your onsite servers, you would outsource the application hosting to an organization that provides cloud server functionality. Thus, their servers would instead deal with whichever portion of computing you provide to them. Probably the most common approach to server management today would be a hybrid approach, or a mixture of local server usage and cloud hosting.</p><p>It’s always exciting to learn a little bit more about what’s going on behind the scenes on the ever growing and ever more complexity internet we all know in love. That’s all for this week folks, until next time…</p><h3>Love Code // Love Life</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8daabc217dfa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>