<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jonathan Cass</title>
    <description>The latest articles on DEV Community by Jonathan Cass (@joncassdev).</description>
    <link>https://dev.to/joncassdev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F55424%2Fa4ab7b73-e445-4efc-a9fb-7e752ad49ccf.png</url>
      <title>DEV Community: Jonathan Cass</title>
      <link>https://dev.to/joncassdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joncassdev"/>
    <language>en</language>
    <item>
      <title>The Shoemaker's Children: A Developer Allegory</title>
      <dc:creator>Jonathan Cass</dc:creator>
      <pubDate>Wed, 14 Mar 2018 13:38:33 +0000</pubDate>
      <link>https://dev.to/joncassdev/the-shoemakers-children-a-developer-allegory--65g</link>
      <guid>https://dev.to/joncassdev/the-shoemakers-children-a-developer-allegory--65g</guid>
      <description>&lt;p&gt;It was a simple plan: give my personal website a makeover and write a blog post about the process.&lt;/p&gt;

&lt;p&gt;I had built my website shortly after learning about UI frameworks, and while my &lt;a href="https://bulma.io/"&gt;Bulma&lt;/a&gt;-based site was nicer than some, I wasn’t in love with it. Here's the "before" picture:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z5Jt-88i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/sq9u5ca4nqd8mqz0diy5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z5Jt-88i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/sq9u5ca4nqd8mqz0diy5.png" alt='"before" image'&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Additionally, I’m a bit embarrassed to admit that despite my love of &lt;a href="https://en.wikipedia.org/wiki/CI/CD"&gt;CI/CD&lt;/a&gt;, the “release” process for my personal page was to &lt;code&gt;ssh&lt;/code&gt; into a server and perform a &lt;code&gt;git pull&lt;/code&gt;. Not exactly state-of-the-art.&lt;/p&gt;

&lt;p&gt;I started researching static-site frameworks, and thought maybe I would use &lt;a href="https://www.gatsbyjs.org/"&gt;Gatsby&lt;/a&gt; to build my site and deploy it with &lt;a href="https://www.netlify.com/"&gt;Netlify&lt;/a&gt;. With Gatsby I could even blog directly on my own site! Surely this was the modern, best-practice way to develop my page. Then I read &lt;a href="https://dev.to/flexdinesh/create-your-developer-landing-page-with-github-pages---42jk"&gt;this post&lt;/a&gt; by &lt;a class="mentioned-user" href="https://dev.to/flexdinesh"&gt;@flexdinesh&lt;/a&gt;
, and my plans came crashing down. His post showed off an &lt;a href="https://github.com/flexdinesh/dev-landing-page"&gt;elegant developer landing page&lt;/a&gt; that he open-sourced, along with instructions on hosting it on &lt;a href="https://pages.github.com"&gt;GitHub pages&lt;/a&gt;. I was initially reluctant to use his project, because I felt like I should build my own page, but ultimately I realized that it did exactly what I needed and would help me craft a much more interesting post than “here’s how I built my website”. So I present to you: A Developer Allegory.&lt;/p&gt;

&lt;p&gt;If you’re not familiar with &lt;a href="https://en.wiktionary.org/wiki/the_shoemaker%27s_children_go_barefoot"&gt;"the shoemaker's children go barefoot"&lt;/a&gt;, it’s an expression meaning that people often forget professional expertise in their personal lives. This was certainly the case with my personal website - I was neglecting development best-practices left and right. The four that I’m going to talk about in this post are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Continuous Deployment (CD)&lt;/li&gt;
&lt;li&gt;Keep It Simple, Stupid (KISS)&lt;/li&gt;
&lt;li&gt;"Not Invented Here" Syndrome (NIH)&lt;/li&gt;
&lt;li&gt;Don’t Repeat Yourself (DRY)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Continuous Deployment
&lt;/h2&gt;

&lt;p&gt;In continuous deployment, a suite of tests is run every time you commit code to your project’s master branch. If all tests pass, the new build gets deployed. This allows you to get feedback on changes very quickly, and makes releasing code (which is often a risky endeavor) a non-event. There are many ways to add CD to a project, including &lt;a href="https://travis-ci.org/"&gt;Travis&lt;/a&gt;, &lt;a href="https://circleci.com/"&gt;Circle&lt;/a&gt;, &lt;a href="https://jenkins.io/"&gt;Jenkins&lt;/a&gt;, and Netlify. &lt;/p&gt;

&lt;p&gt;As mentioned above, one of the reasons I wanted to redo my website in the first place was to improve my “release process”. There were a couple of problems with my old process. The first problem was that it was cumbersome: each time I committed changes to my GitHub repository, I had to perform extra steps to get those changes into my “production environment”. The second problem is that those extra steps included a &lt;code&gt;git pull&lt;/code&gt;, which can have unintended consequences as documented &lt;a href="https://grimoire.ca/git/stop-using-git-pull-to-deploy"&gt;here&lt;/a&gt;. I wanted to install a continuous deployment pipeline to make the process simpler and less error prone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep It Simple, Stupid
&lt;/h2&gt;

&lt;p&gt;While Netlify (and the other CI/CD pipeline tools) could certainly handle my simple static-site requirements, they were overkill. I don’t have a test suite to run, and I don’t have complex assets or a build process. I just needed my code changes to be reflected on my website, which, as I learned from &lt;a class="mentioned-user" href="https://dev.to/flexdinesh"&gt;@flexdinesh&lt;/a&gt;
's post, is precisely what GitHub pages does.&lt;/p&gt;

&lt;p&gt;Somewhat mean-spirited in phrasing, &lt;a href="https://en.wikipedia.org/wiki/KISS_principle"&gt;KISS&lt;/a&gt; (Keep It Simple, Stupid) implores us to avoid complexity. It also shows up in extreme programming as &lt;a href="https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it"&gt;YAGNI&lt;/a&gt; (You Aren’t Gonna Need It) and in design via a quote from Antoine de Saint Exupéry: “perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away”. By keeping code, processes, and UI simple, there are fewer places for bugs to hide, and fewer sources of confusion for users and developers alike.&lt;/p&gt;

&lt;h2&gt;
  
  
  "Not Invented Here" Syndrome
&lt;/h2&gt;

&lt;p&gt;I was excited to learn about GitHub pages when I first saw &lt;a class="mentioned-user" href="https://dev.to/flexdinesh"&gt;@flexdinesh&lt;/a&gt;
’s post, and I thought his landing page looked fantastic. Despite that, I made excuses for why I couldn’t use his framework: it won’t be easy to list and link to my projects, I won’t be able to incorporate a blog, there’s nowhere for me to put info about myself, my “how I built a portfolio website” blog post will be redundant with his. I was exhibiting &lt;a href="https://en.wikipedia.org/wiki/Not_invented_here"&gt;"Not Invented Here" Syndrome&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There can be many reasons for this reluctance to use an existing external implementation: cost, pride, fear of the unknown. However, NIH is completely counter to Open Source culture. In Open Source, rather than forcing each developer or team to reinvent the wheel, we can build off of each other's solutions, and ultimately create something greater than any of us could have managed alone. Once I recognized NIH in myself, I was able to fight against it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don’t Repeat Yourself
&lt;/h2&gt;

&lt;p&gt;With Dinesh’s project, I abandoned my plans to publish blog posts on my site, showcase specific projects and apps that I had worked on, and list qualifications and career experience there. The more I thought about that, the more sense it made. I already have dev.to for blog posts, GitHub to showcase my projects, and LinkedIn and a resume to list qualifications and career experience. Why should I duplicate all of that on my website, requiring me to make updates in multiple places whenever any of these changed? I also learned that GitHub allows you to choose which projects you want to showcase on your GitHub profile ("customize your pinned repositories"), which sealed the deal for me.&lt;/p&gt;

&lt;p&gt;This realization that I had been duplicating information reminded me of the &lt;a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself"&gt;DRY principle&lt;/a&gt; in programming. DRY eliminates the need to perform a single update in multiple places, which saves time and prevents errors. Of course, DRY can be (and, in my experience, often is) taken too far. To remove repeated code, developers often create an abstraction layer, but if the repetition was more coincidence than equivalence, this can be dangerous. You can read more in Sandi Metz's post &lt;a href="https://www.sandimetz.com/blog/2016/1/20/the-wrong-abstraction?duplication"&gt;duplication is far cheaper than the wrong abstraction&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap Up
&lt;/h2&gt;

&lt;p&gt;I'm very pleased with the final product, also viewable at &lt;a href="http://www.joncass.com:"&gt;www.joncass.com:&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lGyuu5WW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2o1b3x0denuqtxy94bn8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lGyuu5WW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2o1b3x0denuqtxy94bn8.png" alt='"after" picture'&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As in the shoemaker’s children aphorism, my personal projects often don’t get the love and rigor that I apply at work. While that’s fine for some projects, especially early on when I may not continue with them, I wanted my “web presence” site to have a little extra care put into it. I’m more likely to keep it updated if it’s easy to do so (thanks CD!). I think my new simple (shout-out to KISS) and uncluttered (nice and DRY) page lets me put my best foot forward on the web, even if it was Not Invented Here :).&lt;/p&gt;

&lt;p&gt;Questions or comments? Leave them below!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A big thanks to &lt;a class="mentioned-user" href="https://dev.to/flexdinesh"&gt;@flexdinesh&lt;/a&gt;
 for open-sourcing his dev-landing-page project (and writing about it).&lt;/em&gt;&lt;/p&gt;

</description>
      <category>portfolio</category>
      <category>programming</category>
      <category>principles</category>
    </item>
    <item>
      <title>Moving faster with REPL</title>
      <dc:creator>Jonathan Cass</dc:creator>
      <pubDate>Sun, 25 Feb 2018 20:16:55 +0000</pubDate>
      <link>https://dev.to/joncassdev/moving-faster-with-repl--hk0</link>
      <guid>https://dev.to/joncassdev/moving-faster-with-repl--hk0</guid>
      <description>&lt;h2&gt;
  
  
  Introduction to REPL
&lt;/h2&gt;

&lt;p&gt;Developers like to "move fast and break things." Well, we like to move fast anyway. A "REPL" is a tool I've found that prevents me from getting bogged down working within the context of a large application. Of course, at some point, my new feature or bugfix has to be integrated into the codebase, but starting there adds friction and slows me down. In this post, you'll learn about what REPLs are, and how to use them to work efficiently.&lt;/p&gt;

&lt;p&gt;A REPL is a Read-Evaluate-Print Loop. This concept was first introduced in the Lisp programming language, to allow quick experiments in Lisp. In Lisp, the following is an implementation of a basic REPL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight common_lisp"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;loop&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;read&lt;/span&gt;&lt;span class="p"&gt;))))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reading the commands from the inside out (which is how they are executed in Lisp), you can see where REPL gets its name!&lt;/p&gt;

&lt;p&gt;Generally speaking, you invoke a REPL from the command line. When you start up a REPL, it will take you to a new interface, similar to a command line, but your instructions are interpreted in the language of the REPL. In fact, &lt;a href="https://stackoverflow.com/questions/19728253/how-do-i-get-a-repl-in-bash"&gt;you can think of a command prompt as a REPL for Bash&lt;/a&gt;. Once in a REPL, you can run commands, define variables, write functions, etc. and see the results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Examples: Python and Node
&lt;/h2&gt;

&lt;p&gt;Both Python and Node come with fairly sophisticated REPLs when you install them. Here are some examples you can try!&lt;/p&gt;

&lt;h3&gt;
  
  
  Python
&lt;/h3&gt;

&lt;p&gt;Start up the Python REPL, by typing &lt;code&gt;python3&lt;/code&gt; at your command prompt (in this case, &lt;code&gt;user@comp ~$&lt;/code&gt;) and pressing enter. It will print out some information on your &lt;code&gt;python&lt;/code&gt; installation, and leave you at the REPL prompt (the &lt;code&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;user@comp ~&lt;span class="nv"&gt;$ &lt;/span&gt;python3
Python 3.6.1 &lt;span class="o"&gt;(&lt;/span&gt;default, Apr  4 2017, 09:36:47&lt;span class="o"&gt;)&lt;/span&gt; 
&lt;span class="o"&gt;[&lt;/span&gt;GCC 4.2.1 Compatible Apple LLVM 7.0.2 &lt;span class="o"&gt;(&lt;/span&gt;clang-700.1.81&lt;span class="o"&gt;)]&lt;/span&gt; on darwin
Type &lt;span class="s2"&gt;"help"&lt;/span&gt;, &lt;span class="s2"&gt;"copyright"&lt;/span&gt;, &lt;span class="s2"&gt;"credits"&lt;/span&gt; or &lt;span class="s2"&gt;"license"&lt;/span&gt; &lt;span class="k"&gt;for &lt;/span&gt;more information.
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From here, you can perform computations, define variables and functions, etc:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'hello world'&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;hello&lt;/span&gt; &lt;span class="n"&gt;world&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;print_greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;     &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt; 
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;print_greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'hello world'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;hello&lt;/span&gt; &lt;span class="n"&gt;world&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;print_greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'hello function'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;hello&lt;/span&gt; &lt;span class="n"&gt;function&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Exit with &lt;code&gt;^d&lt;/code&gt; (ctrl+d)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; ^d
user@comp ~&lt;span class="err"&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Node
&lt;/h3&gt;

&lt;p&gt;Enter the Node REPL&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;user@comp ~&lt;span class="nv"&gt;$ &lt;/span&gt;node
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just like in Python, you can perform computations, define variables and functions, etc:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello world&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kc"&gt;undefined&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="nx"&gt;world&lt;/span&gt;
&lt;span class="kc"&gt;undefined&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;printGreeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kc"&gt;undefined&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;printGreeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello world&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="nx"&gt;world&lt;/span&gt;
&lt;span class="kc"&gt;undefined&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;printGreeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello function&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;
&lt;span class="kc"&gt;undefined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Exit with &lt;code&gt;^d&lt;/code&gt; (ctrl+d)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ^d
user@comp ~&lt;span class="err"&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;undefined&lt;/code&gt; that crops up in the Node example is the return value of each statement. If your statement has a defined return value, that will be printed instead, as in the &lt;code&gt;1+1&lt;/code&gt; example. Note also that these REPLs have command history, so you can press “up” to view past commands, even between sessions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementation
&lt;/h2&gt;

&lt;p&gt;The REPL is just like any program that you run from your command line. When you run it, it gives some output and then waits for user input. When a statement is entered, it evaluates the statement, and prints out the result. In both Python and Node, there are built-in modules that can provide a REPL with some injected “context”. You can read &lt;a class="mentioned-user" href="https://dev.to/rpalo"&gt;@rpalo&lt;/a&gt;
’s excellent post &lt;a href="https://dev.to/rpalo/your-own-python-repl-in-twenty-lines-or-less"&gt;here&lt;/a&gt; for how to make use of the Python library &lt;code&gt;Code&lt;/code&gt; to create your own REPL. Here’s how to do it in Node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// include the repl library&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;repl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;repl&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// start it up, with the desired prompt string&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;repl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;gt; &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// inject a couple pieces of context&lt;/span&gt;
&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;This is some text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;greet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`hello &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can save this as &lt;code&gt;my_repl.js&lt;/code&gt; and then start it up and use it as follows (note that &lt;code&gt;text&lt;/code&gt; and &lt;code&gt;greet&lt;/code&gt; are already defined for you because they were injected into the context):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;user@comp ~&lt;span class="nv"&gt;$ &lt;/span&gt;node my_repl.js 
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;
&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;This is some text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Jon&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="nx"&gt;Jon&lt;/span&gt;
&lt;span class="kc"&gt;undefined&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;greetAndCompliment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;   &lt;span class="nx"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;   &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nice code&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kc"&gt;undefined&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;greetAndCompliment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Jon&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="nx"&gt;Jon&lt;/span&gt;
&lt;span class="nx"&gt;nice&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;
&lt;span class="kc"&gt;undefined&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Everyday Uses
&lt;/h2&gt;

&lt;p&gt;I find REPLs most useful when trying out a simple experiment. For example, instead of creating a &lt;code&gt;test.py&lt;/code&gt; script to confirm that default parameters work the way I think they do, I can just fire up the REPL and confirm it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;print_greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greeting&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'hello world'&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;     &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt; 
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;print_greeting&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;hello&lt;/span&gt; &lt;span class="n"&gt;world&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;print_greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'hello overridden default'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;hello&lt;/span&gt; &lt;span class="n"&gt;overridden&lt;/span&gt; &lt;span class="n"&gt;default&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Wrap Up
&lt;/h2&gt;

&lt;p&gt;Now that you’ve learned about REPLs, you might also be interested in &lt;a href="https://en.wikipedia.org/wiki/Unit_testing"&gt;unit tests&lt;/a&gt;, and &lt;a href="https://en.wikipedia.org/wiki/Test-driven_development"&gt;Test-Driven Development&lt;/a&gt;, or TDD. These increase developer velocity in a similar way, by shortening cycle time. They have the added advantage of increasing code quality. For further reading and REPLing, check out the &lt;a href="https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop"&gt;Wikipedia page&lt;/a&gt; or &lt;a href="https://repl.it"&gt;repl.it&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>repl</category>
      <category>python</category>
      <category>node</category>
      <category>velocity</category>
    </item>
    <item>
      <title>Help me validate blog ideas!</title>
      <dc:creator>Jonathan Cass</dc:creator>
      <pubDate>Sat, 27 Jan 2018 17:17:06 +0000</pubDate>
      <link>https://dev.to/joncassdev/help-me-validate-blog-ideas-ofd</link>
      <guid>https://dev.to/joncassdev/help-me-validate-blog-ideas-ofd</guid>
      <description>&lt;p&gt;I'm going to start blogging in 2018. I guess this post is a good start!&lt;/p&gt;

&lt;p&gt;I joined the #BlogMore track in the &lt;a href="https://2018.codenewbie.org/"&gt;#CNC2018&lt;/a&gt; project. The pre-mission was to read about the three different categories of blog posts, and find a great post that fit each category. The three categories are tutorial, explainer, and project: a tutorial post walks the reader through accomplishing a specific task, an explainer post explains some general concept, and a project post describes a project that the author is working on. I turned that "assignment" in a couple days ago, and now have my first mission!&lt;/p&gt;

&lt;p&gt;My first mission is to brainstorm ten ideas, narrow it down to five, and then get feedback from the community on these five ideas to narrow it down to the best three. I've narrowed my brainstorm down to five, but now I need your help to validate my ideas! Here are the five ideas I came up with:&lt;/p&gt;

&lt;p&gt;Tutorial: GitHub&lt;br&gt;
How to set up a new project on &lt;a href="http://www.github.com"&gt;GitHub&lt;/a&gt;, including best practices for READMEs, licenses, git branching, etc.&lt;/p&gt;

&lt;p&gt;Tutorial: React&lt;br&gt;
Creating your first react app using CRA (&lt;a href="https://www.npmjs.com/package/create-react-app"&gt;create-react-app&lt;/a&gt;), and describing the advantages and disadvantages to using CRA.&lt;/p&gt;

&lt;p&gt;Explainer: REPL&lt;br&gt;
Defining a REPL (Read-Evaluate-Print Loop), giving examples of common ones, and why you might want to use one.&lt;/p&gt;

&lt;p&gt;Project: Portfolio&lt;br&gt;
Showing the current state of my personal "portfolio" site &lt;a href="http://www.joncass.com"&gt;joncass.com&lt;/a&gt;, improvements I want to make, and walking through the steps I take to change it.&lt;/p&gt;

&lt;p&gt;Project: Crystal Football&lt;br&gt;
A few months ago, I released an app called &lt;a href="https://assistant.google.com/services/a/id/53bc5e1949cf5456/"&gt;Crystal Football&lt;/a&gt; to the Google Assistant directory. This post would explain that process, and walk through improvements that I would like to make or am making.&lt;/p&gt;

&lt;p&gt;So that's it! I've also posted a poll in the CNC2018 Facebook group. I'd love your feedback on what you'd like to see and why - vote in the Facebook poll or comment below.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>cnc2018</category>
      <category>blogmore</category>
      <category>blogging</category>
    </item>
  </channel>
</rss>
