<?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 Anthony Fields on Medium]]></title>
        <description><![CDATA[Stories by Anthony Fields on Medium]]></description>
        <link>https://medium.com/@janthonyfields?source=rss-98cbf5676615------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*0VcSHq-5QPEm9eHD_SFRjw.jpeg</url>
            <title>Stories by Anthony Fields on Medium</title>
            <link>https://medium.com/@janthonyfields?source=rss-98cbf5676615------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 19:28:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@janthonyfields/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[Iterables and Iterators]]></title>
            <link>https://medium.com/@janthonyfields/iterables-and-iterators-3ae09393b1f?source=rss-98cbf5676615------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ae09393b1f</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Anthony Fields]]></dc:creator>
            <pubDate>Tue, 24 Apr 2018 04:07:10 GMT</pubDate>
            <atom:updated>2018-11-03T20:57:16.344Z</atom:updated>
            <content:encoded><![CDATA[<p>What’s actually going on when we use a control flow statement like for...of? How does a for…of loop operate when iterating an array for example? If we take a look at what’s going on under the hood when we use this statement, we can learn a little about asynchronous programming and modern JavaScript in the process.</p><p>Take a plain vanilla array of strings, such as ducks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*-wWlkoHIFp9Y9RqYAQtSJg.png" /></figure><p>We can iterate ducks and do something with each value that’s yielded in turn:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*s82GUuxBJ_wjQt7nSNmxxA.png" /></figure><p>And we find on MDN that the reason we can do this is because Array.prototype defines its own default <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/@@iterator">iteration behavior</a>. It does so following the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols">iterable protocol</a>.</p><p><em>“The </em><strong><em>iterable</em></strong><em> protocol allows JavaScript objects to define or customize their iteration behavior, such as what values are looped over in a </em><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of"><em>for..of</em></a><em> construct.” — MDN</em></p><p>This behavior is defined by Array.prototype[@@iterator], a property on the Array prototype that may look a bit weird, but is just a way of referring to the built-in, <a href="https://stackoverflow.com/questions/29492333/what-does-at-at-mean-in-es6-javascript/29492387#29492387">well-known symbol</a> value Symbol.iterator, as it’s defined on Array.prototype.</p><p><em>“In order to be </em><strong><em>iterable</em></strong><em>, an object must implement the </em><strong><em>@@iterator</em></strong><em> method, meaning that the object (or one of the objects up its </em><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain"><em>prototype chain</em></a><em>) must have a property with a </em><strong><em>@@iterator </em></strong><em>key which is available via constant </em><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator">Symbol.iterator</a><em>&quot; — MDN</em></p><p>Symbols like this are used to provide unique property names on an object, preventing those unique names from colliding with any random property names that might get defined. @@iterator is not actually valid JavaScript syntax: retrieving the iterator actually looks like: arr[Symbol.iterator](). We can use this method to retrieve the default iterator on our ducks array:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*VGMoRrgZx9fD87c2B6Sbmg.png" /></figure><p>What’s going on with ducks[Symbol.iterator]()here? First, we can see that we’re accessing the value of a key, a method in this case which we’re invoking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*_hxbhyifdg9NaFsceAG3mg.png" /></figure><p>As we indicated above, Symbol.iterator is a valid key on the ducks array <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">object</a>. The<a href="http://es6-features.org/#SymbolType"> ECMAScript 6 spec</a> states that a Symbol is a unique and immutable data type used as an identifier for object properties. And Array is one of several built-in object types that possesses a default iteration behavior (notably, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator">Object does not</a>). ducks is an Array object, so it includes this key which holds the iterator <em>method</em>, which when invoked as above returns the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator">default iterator</a>. This default iterator is what exposes the values in the array: it’s an interface for obtaining each successive value. Here’s where it gets interesting:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*2rugMiKDP-Xw6HqgGNEB7g.png" /></figure><p>Remember that we mentioned the <strong><em>iterable</em></strong><em> protocol </em>above? Well, there’s a complementary <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol"><strong><em>iterator </em></strong><em>protocol</em></a>.</p><p><em>“The </em><strong><em>iterator</em></strong><em> protocol defines a standard way to produce a sequence of values (either finite or infinite).” — MDN</em></p><p>Basically, an object is an iterator if it implements a next() method that returns an object with two properties: done (a boolean) and value (any value returned by the iterator).</p><p>From MDN: “<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a><em>, </em><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a><em>, </em><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray">TypedArray</a><em>, </em><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map">Map</a><em> and </em><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set">Set</a><em> are all built-in iterables, because each of their prototype objects implements an </em><em>@@iterator method.”</em></p><p>All of these object types behave this way (as well as the DOM NodeList — check out <a href="https://developer.mozilla.org/en-US/docs/Web/API/NodeList/keys">NodeList.keys()</a>and <a href="https://developer.mozilla.org/en-US/docs/Web/API/NodeList/values">NodeList.values()</a> for details) and can be iterated with a for...of loop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*hLX-5wAU_ZzSLH166ZMGBg.png" /></figure><p>Stay tuned for part two of this post where I’ll move to learning about generators (hint: we’re already using a generator with those .next() calls) and what they can teach us about asynchronous operations.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FGQzLMamfOZjVe%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fwater-duck-GQzLMamfOZjVe&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FGQzLMamfOZjVe%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="239" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d5c9a8fb0d2fe8f51229a0da8122653/href">https://medium.com/media/5d5c9a8fb0d2fe8f51229a0da8122653/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ae09393b1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Models, Objects, and Documents]]></title>
            <link>https://medium.com/@janthonyfields/models-objects-and-documents-69515ebe98cc?source=rss-98cbf5676615------2</link>
            <guid isPermaLink="false">https://medium.com/p/69515ebe98cc</guid>
            <category><![CDATA[dom]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Anthony Fields]]></dc:creator>
            <pubDate>Tue, 03 Apr 2018 16:10:10 GMT</pubDate>
            <atom:updated>2019-01-05T22:37:35.462Z</atom:updated>
            <content:encoded><![CDATA[<h4>Layers of the virtual</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pITtRGQSPcWswcZ62gE1dg.png" /></figure><p>What is a virtual DOM? How can we understand what it is, what it does, and what advantages it can provide in rendering user interfaces?</p><p>One reason the notion of the DOM and the “Virtual DOM” can be confusing is that “DOM”, in both cases, actually refers to more than one thing.</p><h4>The DOM is a model</h4><p>It’s an object-oriented representation of an HTML document created by the browser. This in-memory representation is composed of nodes arranged in a tree structure. In a modern web app, the term “document” encompasses everything you see and interact with in the browser window: the user interface. So the DOM is an in-memory representation of a web app’s user interface.</p><h4>The DOM is an API</h4><p>It’s <em>also</em> an <em>interface</em> between your code and the document itself. The Document object exposes methods for interacting with the document. This is what makes a document dynamic rather than static.</p><h4>Is the DOM slow?</h4><p>This question immediately becomes, “relative to what?” Traversal and manipulation of the DOM tree is not always the slowest part of updating a view: as the complexity of a web app increases, DOM manipulation is only part of the challenge and it’s not always the performance bottleneck. Adding, removing and changing DOM nodes is comparable to other manipulations of JavaScript objects. And modern JavaScript engines are fast. What is actually slow are operations the browser must perform to continually present us with an updated version of the view. When a web page UI changes, the browser engine has to recalculate CSS, re-flow the layout of the view, and re-paint the screen. The DOM is only a part of this process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*Mbg5u2U5V6P1h-HbY6VYuQ.png" /><figcaption>Source: Basic Data Flow in Mozilla, MDN</figcaption></figure><p>What actually happens when we manipulate the DOM, such as replacing an element on a page? A brief (incomplete) overview of what the browser does looks like this:</p><p>document.querySelector(&#39;#elementId&#39;).appendChild(newNode)</p><ol><li>Re-parse the HTML</li><li>Update the DOM with the new appended node</li><li>Re-calculate the CSS for the parent and child nodes</li><li>Update the layout coordinates of each element on the screen</li><li>Reflow the layout structure of the updated element and all child &amp; ancestor elements (reflows are expensive)</li><li>Re-paint the display, verifying visibility of all nodes</li></ol><p><em>“Reflows are very expensive in terms of performance, and is one of the main causes of slow DOM scripts, especially on devices with low processing power, such as phones. In many cases, they are equivalent to laying out the entire page again” (</em><a href="http://www.stubbornella.org/content/2009/03/27/reflows-repaints-css-performance-making-your-javascript-slow/"><em>Stubbornella</em></a><em>)</em></p><p>It turns out that the 6 steps above (and more) will be carried out <strong><em>for every single change to the DOM</em></strong>. Append three nodes and this process will repeat three times. The virtual DOM introduces a layer of abstraction that mitigates this issue.</p><h4>Statefulness</h4><p>Components of the (non-virtual) DOM have an <em>internal state — </em>a &lt;select&gt; element having a default value, for example. With respect to the <em>virtual</em> DOM, think of state more generally as simply a value that has the potential to change. Interaction with the UI changes state. State is preserved (and overwritten) as the contents of a location in memory. When state changes, we need to track the change: this is done with a pair of <em>previous state</em> and <em>new state</em>. For example, a checkbox with a previous state of <strong>unchecked</strong> and new state of <strong>checked</strong>. Or a button that changes a value or emits an event. In the end, the <a href="https://en.wikipedia.org/wiki/State_(computer_science)">statefulness</a> of the non-virtual (“real”) DOM is a key reason why virtualizing it increases efficiency. More on why this is the case below.</p><p>When a web application is highly interactive and must respond in “real-time”, states are changing in such a way that the demand on the browser engine to re-flow and re-paint the screen can reach a point where the engine may not maintain an update rate of 60 frames per second, which results in a perceived lag or slow-down of the UI. Browser makers are always working on increasing the efficiency of updates. One way to do this is to minimize and batch together the changes that need to be carried out as outlined in the 6 points above.</p><p>While browsers do this minimizing and batching on a lower level, <strong><em>the virtual DOM is an abstraction of this same idea on a higher level.</em></strong> In this way the virtual DOM can mitigate performance bottlenecks as well. And the term “virtual DOM”, like “DOM”, also refers to more than one thing. So let’s unpack it’s meaning a little.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*cRERmL5Wp7mb3VlDcXjS3g.png" /><figcaption>How the Virtual DOM fits in.</figcaption></figure><h4>The virtual DOM is a JavaScript object</h4><p>The virtual DOM is a JS object, much lighter “weight” than the browser’s Document object. It can be repeatedly re-created with very low overhead in performance terms. And it is re-created, <em>as a pair</em>. To return to the distinction between previous state and new state — this distinction is reflected in the entire virtual DOM object residing in memory. There always exist <em>two</em> virtual DOM objects: one expresses the previous state and one the new state. These two object states are compared by the virtual DOM engine …</p><h4>The virtual DOM is an algorithm</h4><p>The virtual DOM object is coupled with an engine that implements an efficient algorithm. The algorithm is a procedure that reconstructs the entire object for each change in state, then scans it to identify the changes. Then, it performs a <strong><em>diff </em></strong>between the previous object state (as a whole) and the new object state: it computes the difference between the two states to obtain a result that it applies as a <em>batch of changes</em> to the DOM (in React, this diff step is a carefully constructed approximation algorithm <a href="https://calendar.perfplanet.com/2013/diff/">that runs in O(n)</a>, if you’re curious). This result is intended to be the minimum number of changes required to perform an update. The algorithm actually produces something like an approximate minimum:</p><p><strong>Breadth First Search</strong></p><p>Since the virtual DOM object is lightweight, when updates to a parent component are required, all of it’s child components will be re-created as well. This means there’s no need to descend to each node in the tree whose state has changed, only to the first new-state node at a given level. Consequently, breadth-first search can be used when performing a comparison of the two virtual DOM objects. This is part of how the minimum number of changes is computed and batched. If node <strong>B</strong> and <strong>E</strong> below have changed state, when <strong>B</strong> is reached, its entire subtree will be re-created, regardless of any state changes below it. There’s no reason to traverse past <strong>B</strong> in the virtual DOM tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*p89hnISB0b4wDAsUzKM7Aw.jpeg" /><figcaption>Image by Jennifer Bland at <a href="https://www.jenniferbland.com/breadth-first-search-in-javascript/">https://www.jenniferbland.com/breadth-first-search-in-javascript/</a></figcaption></figure><p>So maybe the DOM as such isn’t so slow … but in taking the entire process of udpating a view into account, it starts to become apparent that the virtual DOM can increase efficiency. On top of efficiency, there’s also the gains in developer productivity and happiness to be considered. If you’re working directly on the browser DOM, especially for complex web apps, the most difficult and error-prone task is manipulating that DOM. The virtual DOM approach abstracts away that imperative-driven task and lets us focus on building out applications declaratively using components. It also removes state management from the DOM itself, which is a <a href="https://medium.com/@sstur/the-dom-is-not-a-datastore-7a17b10d6705">very significant achievement on its own</a>. Perhaps a good way to really dive into the subject of virtual DOMs is to work toward a deep understanding of <a href="https://reactjs.org/docs/faq-state.html">state in React</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*dQOdIssqTagROiE5FHQ4aQ.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69515ebe98cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Are Containers?]]></title>
            <link>https://medium.com/@janthonyfields/as-a-new-developer-approaching-the-concept-of-containers-they-can-seem-completely-opaque-and-at-a427782db8f8?source=rss-98cbf5676615------2</link>
            <guid isPermaLink="false">https://medium.com/p/a427782db8f8</guid>
            <category><![CDATA[virtual-machine]]></category>
            <category><![CDATA[virtualization]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Anthony Fields]]></dc:creator>
            <pubDate>Tue, 13 Mar 2018 17:58:58 GMT</pubDate>
            <atom:updated>2018-05-24T18:55:26.985Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*zmiKJUDabF1mHF_uxf6gmA.png" /></figure><p>As a new developer approaching the concept of containers, they can seem completely opaque and at the same time utterly simple. How to get a handle on them? It may help to approach the concept of containerization (which we can say is a particular kind of virtualization) by way of analogy to the code we write and learn to write every day. We can appreciate concepts like abstraction, encapsulation, interface, modularity, portability and re-use. These concepts carry over to the domain of virtualization and containerization and can aid in understanding that domain. This is a high-level, brief overview of “operating-system-level virtualization”, which is what a container accomplishes. On the enterprise level, containerization can offer businesses a powerful way to decouple developer time for building apps from complexities of deployment and infrastructure. This means software can be built faster and shipped more often. Thus as developers, we should have some understanding of what virtualization is and how we can take advantage of it.</p><p>Let’s start with virtualization as it applies to so-called virtual machines. This will provide some context for containers themselves, both in their similarities to and differences from VMs. A virtual machine, then, is typically a comprehensive abstraction of computing resources. It emulates a computer system and provides the functionality of a physical computer. Hardware, networking and storage are all implemented in a typical virtual machine. An operating system and applications can be installed and executed on it, it can talk to the network, and read from / write to its filesystem. With respect to deploying applications, virtual machines provide a way to encapsulate an app and its dependencies into a self-contained unit of functionality. Think of Ruby modules and private methods, or closures (that emulate private methods) and the module pattern in Javascript: these are ways of encapsulating functionality and exposing a limited, generalized interface. Virtual machines also usefully limit exposure: an application and it’s dependencies access the virtual machine’s resources directly, but they access the physical machine only through a limited, generalized interface. This means that the encapsulated app becomes portable.</p><p>The details of the app’s implementation are isolated and anywhere the VM can run, now the app can run (we can re-use the same implementation repeatedly). And a VM can run in a great many contexts, on many different operating systems. Most importantly, VMs can run on server operating systems such as Linux. Multiple instances of VMs can be created and run side-by-side — this is accomplished through a <a href="https://en.wikipedia.org/wiki/Hypervisor"><em>hypervisor</em></a>: a layer implemented in software or hardware that actually carries out the interfacing between VMs and the host computer. VMs are called <em>guest machines </em>and their OS a <em>guest OS</em>. The corresponding host is then a <em>host machine </em>and <em>host OS</em>.</p><p><em>Both VMs and hypervisors have their origins in </em><a href="https://www.idkrtm.com/history-of-virtualization/"><em>IBM time-sharing systems</em></a><em> of the 1960’s.</em> <em>You can use and experiment with VMs easily and for free on Mac OS, Windows or Linux by installing </em><a href="https://www.virtualbox.org/"><em>Virtual Box</em></a><em> and </em><a href="https://www.digitaltrends.com/computing/best-virtual-machine-apps-for-mac-linux-and-windows-pcs/"><em>others</em></a><em>.</em></p><p>In practice, there are two basic types of VM arrangements: “bare metal” or Type 1, and “hosted” or Type 2. The bare metal variant involves a hypervisor that runs directly on the host hardware, without an intervening operating system, and that directly manages the guest operating system(s).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*vF2qCT11Z3AF22reDIUSWg.png" /></figure><p>Each VM encapsulates an operating system, the application and its dependencies, and each is isolated through the management of the hypervisor platform. In the hosted variant, the hypervisor runs on a conventional operating system, and the guest operating system(s) run as processes in the host OS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*FYyZLPbn_Qw0xVVcVcl8aw.png" /></figure><p>In both cases, the guest OS and associated apps/dependencies share the resources of the host machine.</p><h3><strong>Kernel space and User space</strong></h3><p>What then are containers? How do they differ from virtual machines? What are their advantages and disadvantages? To address these questions we need to take our high-level overview one level down in detail. We need to understand a basic fact about operating systems themselves. What we think of as an operating system can be divided into <a href="https://unix.stackexchange.com/questions/87625/what-is-difference-between-user-space-and-kernel-space/87629#87629"><em>kernel space</em> and <em>user space</em></a>. The kernel is the program at the core of the operating system. It connects the rest of the system together and to the hardware through an API of <a href="https://en.wikipedia.org/wiki/System_call">system calls</a>. The kernel’s space in memory is protected from <em>user space</em>, which encompasses all code that runs outside of the kernel. This is a basic separation of concerns. So how is this relevant to containers?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*8tCcdkw2pJucQjgEdZf-gg.png" /></figure><p>What we’ve just discussed above with VMs is a form of <em>hardware virtualization.</em> Containers, in contrast, are a form of <em>operating-system-level virtualization</em>. In this kind of abstraction, a single kernel can accommodate multiple isolated instances of user space (the space where programs like our apps actually run). Containers are a packaging of user space: whereas virtual machines package user space, kernel space and virtual hardware together, containers only package user space. The resources assigned (exposed) to that container from the outside are limited: an encapsulation and separation of concerns. In containerization, the abstraction layer separates out user space from everything else, and thereby makes possible a very lightweight, portable, repeatable package (or <em>image</em>, as it’s properly called in this case). Containers are typically tens of megabytes, whereas virtual machine packages can be multi-gigabyte in size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*-12l2-xnMmNLVdT2oxwRWQ.png" /></figure><p>One of the most common and accessible ways for developers and IT ops to accomplish containerization is by using Docker images (a<em> second post on Docker images is forthcoming). </em>With Docker, developers can not only containerize an entire application, they can modularize parts of their app into separate containers and connect those parts together (for example containerizing a Postgres database and a Rails or Node.js app separately). All this separation and modularization supports scalability and independent updating of components.</p><p>A potential disadvantage of this modularity is manageability. There’s a balance to be struck between breaking functionality into discreet parts and the efficient management of all the resulting moving parts.</p><p>Containers are here to stay, and they bring with them both easy accessibility and a learning curve in order to use them well and wisely. There are a variety of approaches to implementing them, including Docker, Kubernetes, and Heroku. They’re all worth learning about as they serve different use cases. I’ll be diving into the details of these approaches to containerization in future posts. It’s an approach to deployment architecture that bears study …</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*6t2-M71hhiG6nLAs2VqwOA.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a427782db8f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy All The Things!]]></title>
            <link>https://medium.com/@janthonyfields/deploy-all-the-things-7e754c661d38?source=rss-98cbf5676615------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e754c661d38</guid>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Anthony Fields]]></dc:creator>
            <pubDate>Tue, 20 Feb 2018 12:14:30 GMT</pubDate>
            <atom:updated>2018-02-23T10:14:11.327Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*6RoTMA9LGjhjzrr22Y7oZw.jpeg" /></figure><p>When beginning to build web apps to learn and experiment, it’s both useful and expedient to use the local <a href="https://en.wikipedia.org/wiki/Localhost">loopback</a> mechanism on your own machine when loading and reloading your application and responding to requests.¹ Before too long, though, it’s likely you’ll want to start sharing your work with peers (<a href="http://blog.flatironschool.com/7-reasons-you-shouldnt-learn-to-code-alone/">collaboration is important</a>) and observing how it behaves on a network. Getting your app running “in the wild” can energize your creative push to get it to the next level, and you’ll gain valuable knowledge along the way.</p><p><a href="https://www.heroku.com/what">Heroku</a>, a container-based cloud Platform as a Service (<a href="https://en.wikipedia.org/wiki/Platform_as_a_service">PaaS</a>), was founded in 2007. It originally supported only the Ruby programming language and was one of the first cloud platforms.² Today it provides a whole ecosystem of services that support the deployment, management and scaling of apps. It nevertheless remains very accessible to new developers and its services can be utilized on a small scale <a href="https://www.heroku.com/free">for free</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*cm_oTQsK-ecDdu5SnsX-TQ.png" /></figure><p><em>The name “Heroku” is merger of “heroic” and “haiku”. The Japanese theme is a nod to </em><a href="https://en.wikipedia.org/wiki/Yukihiro_Matsumoto"><em>Matz</em></a><em> for creating Ruby. The creators of Heroku did not want the name of their project to have a particular meaning, in Japanese or any other language, and so chose to invent a name. — </em><a href="https://en.wikipedia.org/wiki/Heroku"><em>Wikipedia</em></a></p><p>This is Part 1 of a walk through for getting a Ruby app up and running on Heroku. This app does not use Rails — it’s an effort to build out a rudimentary app using Rack, Sinatra, Thin, and PostgreSQL, and to see how far we can take it and what we can learn before diving into Rails. You’ll need a <a href="https://signup.heroku.com/">free Heroku account</a><a href="https://signup.heroku.com/,">,</a> <a href="http://bundler.io/">bundler</a> (gem install bundler), and a Ruby version &gt;= 2.3.5 at the time of this writing.</p><h4>RUBY VERSION MANAGER</h4><p>With <a href="https://rvm.io/">Ruby Version Manager</a> it’s easy to install multiple versions side by side.³ rvm list will show all Ruby versions installed, including which one is currently in use and which is set to default (with RVM you can use Ruby versions on a per-shell basis).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*6eKr2-Og-Uzi1QBzF8dvmg.png" /></figure><p>You can view all Rubies available to install with rvm list known. The list will include several additional rubies in addition to the <a href="https://en.wikipedia.org/wiki/Ruby_MRI">MRI versions</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*6xU3yuvyX4hriYvLAZp5eg.png" /></figure><p>If you need a newer version you can install it with rvm install [version], for example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*b6XulAiBiYQm5yaYB9nplQ.png" /></figure><p>And switch to it in the current shell with rvm use [version]. Then check which version is current in your environment:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*1pY9rCkpd_XZ3Kw_U5It1A.png" /></figure><p>You can uservm list again to see the version in use in the current shell environment, and see which is the default version for new shells. You can use rvm use to switch back and forth.</p><p>For deploying to Heroku, it’s recommended that you <a href="https://devcenter.heroku.com/articles/ruby-versions">specifiy your app’s Ruby version</a> in your Gemfile. If your bundler version is &gt;= 1.13.x, you can do this by adding ruby &#39;[version]&#39; to it. For example, ruby &#39;2.4.2&#39;.</p><h4>Heroku CLI</h4><p>After creating a free account, the first step to setting up Heroku on your local machine is to <a href="https://devcenter.heroku.com/articles/heroku-cli#download-and-install">install the Heroku Command Line Interface</a> and log in with your new credentials (the email and password you used when signing up). If you use Homebrew, you can just say brew install heroku.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*MToeN5WuvvDujMW5xOcxmg.png" /><figcaption>brew install heroku</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*ihsCv68cf7nelAH6cRdrfA.png" /><figcaption>Enter email &amp; password</figcaption></figure><h4>Dynos and the Procfile</h4><p>In Heroku terminology, a <a href="https://devcenter.heroku.com/articles/dynos">dyno</a> is a lightweight linux <a href="https://techcrunch.com/2016/10/16/wtf-is-a-container/">container</a>. A container encapsulates your application and associates it with an operating system that’s shared among many other containers. They have different configurations, but on Heroku, Web dynos of the “web” process type are what you’ll use for a web application. The process type to use is defined in a Procfile, a file that lives in the root directory of any app you deploy to Heroku. From the <a href="https://devcenter.heroku.com/articles/procfile">docs</a>: <em>“A Procfile is a mechanism for declaring what commands are run by your application’s dynos on the Heroku platform”</em>. For now our Procfile will remain pretty simple with one line of code. We’ll be using the <a href="http://code.macournoyer.com/thin/">Thin</a> web server in this walk through (to use it, add gem &#39;thin&#39; to your Gemfile). To instruct Heroku to use Thin instead of the default Webrick (<a href="https://devcenter.heroku.com/articles/ruby-default-web-server">there’s good reason for this</a>), create a file Procfile (named exactly as shown) in the app’s root directory, and add the line:</p><pre>web: bundle exec thin start -p $PORT -e $RACK_ENV</pre><h4>GITHUB REPOSITORY</h4><p>If your project doesn’t have a github repository, you should set one up to track your changes and share your code. Create a <a href="https://github.com/join">Github account</a> if you don’t have one, then <a href="https://help.github.com/articles/creating-a-new-repository/">create a new repo</a> by clicking the “+” at the top right of any Github page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*Qlzk8UD0hRFFENMy67LYgA.png" /><figcaption>Creating a repository</figcaption></figure><p>Your empty repo will have a Quick Setup page in the Code tab. You’ll need the remote repository url in a moment, which you can copy from this page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*c0DmbTHNXGeEBF1Cnm7_bg.png" /></figure><p>Then from inside the local directory of your app’s project folder, <a href="https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/">add the project</a> to the new repo.</p><p>First, make sure you’re in your app&#39;s root directory and git init: (Initialize your local directory)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*NTcjOy0Jej-nMKrNTVS_Kg.png" /></figure><p>Then, git add . and git commit (note the period after add — this means “all changed files”, which in this case means every file in the project that’s not <a href="https://git-scm.com/docs/gitignore">ignored</a>, since this is a newly created repo).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*ornhYze0SP85rTPqnOhylw.png" /></figure><p>Set the identity of the <a href="https://git-scm.com/docs/git-remote">new remote repository</a> with git remote add origin [url] using the url copied from the Quick Setup page (use the HTTPS link if you don’t have SSH set up). Then verify the new remote with git remote -v:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*bKcin7px_O0CZDQljcwEBg.png" /></figure><p>Finally, <a href="https://git-scm.com/docs/git-push">push</a> the changes to the remote repo, adding an upstream tracking reference:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*QALkz0PhMi5QPvycIaSoNA.png" /></figure><h4>Deploy To Heroku</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F26BkMeKTW96DDUwYE%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F26BkMeKTW96DDUwYE%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F26BkMeKTW96DDUwYE%2Fgiphy-downsized-large.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/f12ceb626f96987ddd59c658b1224266/href">https://medium.com/media/f12ceb626f96987ddd59c658b1224266/href</a></iframe><p>You deploy a Heroku app by setting up and pushing to a separate Heroku <a href="https://git-scm.com/docs/git-remote">git remote</a> that’s also associated with your local git repository. This is in addition to and different from your Github remote repo. One thing this arrangement gives you is a way to continuously integrate changes to the live app on your Heroku remote. For example, as you debug, you’ll be able to both observe changes locally using the loopback mechanism (see below) as well as remotely on the live app. You can make a change, push to your Heroku remote, and observe it’s effect both locally and in the live app before pushing them to your Github remote.</p><p>Now that we have the CLI installed and a Github repo, here’s the procedure to get started deploying to Heroku: first create the (empty) remote Heroku app with heroku create (an app name is optional after create: it will become the <a href="https://doepud.co.uk/blog/anatomy-of-a-url">subdomain</a> in your app’s url), then deploy your code using git push heroku master. If you’re using a PostgreSQL database and not using Rails, you’ll need to manually add the PostgreSQL addon by running a heroku addons:create command as well (it’s not possible to use SQLite on Heroku: <a href="https://devcenter.heroku.com/articles/sqlite3">explanation</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*V4O26k0xvnOX9bHens3zkg.png" /><figcaption>Creating the app</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*eT-UFgr7Gy4VOH8XS5a9Vg.png" /><figcaption>Provisioning PostgreSQL database</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*4gI2OcT1nrktgSspvQnL-Q.png" /><figcaption>Pushing to the Heroku Git remote</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*daS1jtPup17MUbOItG3opg.png" /><figcaption>Deployment successful</figcaption></figure><p>As you work locally, you can run your app with the command heroku local web, which will start the web process defined in your Procfile. Point your browser to http://localhost:5000 and as you make changes to your code, refresh the page to see their effect. To change the port, specify the -p flag, for example, heroku local -p 7000 web (5000 is the default port).</p><p>To test that your remote dyno is working issue the command at your local command line heroku open. Your root view should open in a default browser window. Back in your command line, you can do heroku logs --tail to view logging information and to aid in debugging.</p><p>In part 2, we’ll explore logging, database setup specifics, running a remote console to perform management and maintenance tasks, spinning up and spinning down your dynos, and using a one-off dyno to perform database migrations. Stay tuned to deploy all the things!</p><p>[1] Resources to start learning about serving a Ruby web app: <a href="http://code.macournoyer.com/thin/">thin web server</a>, <a href="https://launchschool.com/blog/growing-your-own-web-framework-with-rack-part-1">rack tutorial</a>, <a href="https://github.com/rack/rack">rack</a>, <a href="https://github.com/rack/rack#rackup">rackup</a>, <a href="https://github.com/rtomayko/shotgun">shotgun</a>, <a href="http://culttt.com/2015/09/16/getting-started-with-sinatra/">getting started with Sinatra</a>, <a href="http://culttt.com/2015/10/14/getting-started-with-active-record-in-ruby-on-rails/">getting started with ActiveRecord</a> (we’ll use these in parts 2 and 3).</p><p>[2] In addition to Ruby, Heroku now supports Node.js, Java, PHP, Python, Go, Scala, and Clojure.</p><p>[3] An in-depth guide to getting a complete Rails environment (including RVM) set up on MacOS High Sierra is <a href="http://railsapps.github.io/installrubyonrails-mac.html">here</a>. Also see RVM: <a href="https://rvm.io/rvm/install">installing</a> , <a href="https://rvm.io/rubies/installing">rubies</a> , <a href="https://rvm.io/workflow/examples">examples</a>, and <a href="https://rvm.io/rvm/basics">basics</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e754c661d38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Retrieval and Sending]]></title>
            <link>https://medium.com/@janthonyfields/retrieval-and-sending-292eb0c1e258?source=rss-98cbf5676615------2</link>
            <guid isPermaLink="false">https://medium.com/p/292eb0c1e258</guid>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Anthony Fields]]></dc:creator>
            <pubDate>Tue, 06 Feb 2018 08:15:17 GMT</pubDate>
            <atom:updated>2019-09-02T19:42:16.059Z</atom:updated>
            <content:encoded><![CDATA[<h4>Metaprogramming and Object#send</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*2GFsS2M1lIxtGk7W6A_Smg.jpeg" /><figcaption>“Happy World” (Ik-Joong Kang) Main Street-Flushing</figcaption></figure><p>Usually, the code we write operates on data (more on this “usually” later). We might query and retrieve data through the use of an API, and use that data to model relations of various kinds through building out classes and modules that represent our data as it’s presented, interacted with, and modified.</p><p>The data we retrieve in order to do such modeling will likely need to be manipulated so that it’s form corresponds to what our models expect to hold and operate on. Further, it’s important that we design this manipulation step for maximum flexibility to accommodate future changes to the data itself.</p><p>Let’s say we’re developing an app that keeps track of the artworks installed in MTA subway and train stations through the <a href="http://web.mta.info/mta/aft/about/">Permanent Art Program</a>, presents location-based information on pieces as you encounter them, and provides resources for supporting the upcoming artists. One basic requirement would be to accommodate future changes to this dataset as artworks are added to stations, as the catalogue of associated artists grows, and as artwork attributes are added or removed. Here we’ll consider the latter kind of change. The <a href="https://data.ny.gov/">Open New York Dataset</a> provides an <a href="https://data.ny.gov/Transportation/Arts-For-Transit-Metropolitan-Transportation-Autho/4y8j-9pkd">API endpoint</a> for the Permanent Art Catalogue. Lets consider a small subset of this available JSON artwork data, and investigate how we can best transform and utilize it.</p><p>We start by retrieving and parsing the JSON data using rest-client and Ruby’s JSON module. <em>Click the filename in the lower left corner to view a scrollable version.</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bdbd769ab85549e2423ac09a4f40e2d9/href">https://medium.com/media/bdbd769ab85549e2423ac09a4f40e2d9/href</a></iframe><p>This gives us the following subset (a single artwork entry):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e7856918b316e2452ed16d82ef1ad406/href">https://medium.com/media/e7856918b316e2452ed16d82ef1ad406/href</a></iframe><p>Then we can begin sketching out an Artwork class that will initialize with a set of attributes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31067de30620dd9401f1e4aecb9ad7dd/href">https://medium.com/media/31067de30620dd9401f1e4aecb9ad7dd/href</a></iframe><p>That’s quite the list of attributes! Not only is it cumbersome and difficult to read, (and kind of downright ugly), what happens if the data itself changes, with keys disappearing or new keys appearing? And can you imagine trying to keep track of the proper order of arguments being passed in (or even just read the code), as Artwork.new() calls are introduced elsewhere in our classes?</p><p>This construction is highly vulnerable to breakage, with potential dangers originating both internally in our code and externally in changes to the data. How can we refactor this Artwork class to be more robust and less vulnerable to breakage?</p><p>Let’s make a first pass to address the order-of-arguments issue. We can make use of keyword arguments which, similar to hashes, allow us to specify a key-value pair as an argument. The key operates as the argument name, the value as it’s stored value. The value is optional (no default is necessary) and can be assigned by passing in values when the method is called. In this construction, we are effectively passing in a hash with empty values:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d076a9ce623eb3b29a8ba810db1588b9/href">https://medium.com/media/d076a9ce623eb3b29a8ba810db1588b9/href</a></iframe><p>This allows us to pass in our arguments in any order, which alleviates one potential vulnerability to breakage as we call the method from elsewhere in our code. But the sheer number of arguments still means that this is a cumbersome method to read and to call. Let’s address that next.</p><p>Since our initialize method as it’s now constructed expects a hash, we separate our argument list out, into a hash stored in a variable:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca71d88de766dbf11bfda87a83a8427d/href">https://medium.com/media/ca71d88de766dbf11bfda87a83a8427d/href</a></iframe><p>and pass in that variable instead:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd64f62889cb1af8c368f0332502f36e/href">https://medium.com/media/fd64f62889cb1af8c368f0332502f36e/href</a></iframe><p>With this approach we can imagine being able to modify a single hash, artwork_attributes (in addition to our attr_accessor symbols), when our arguments need to change in response to a changing dataset. But isn’t this modification still going to be a lot of extra work, especially if the dataset changes frequently? Is that really manageable?</p><p>It turns out there’s another step we can take. Remember our statement that “<em>usually</em>” our code operates on data? It’s also possible for our code to operate on <em>other code</em>, and even <em>write</em> additional code itself, dynamically at runtime! Why would we want to do this? We can see lots of repetition in the code examples above. Through the use of metaprogramming, we can avoid some of this repetition and come closer to conforming to <a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a>. In addition we can cause our code to react to a changing set of data (and correspondingly a changing set of attributes and arguments) without having to make <em>any</em> modifications to our initialize method! Here’s our metaprogramming refactor, let’s have a look and then describe it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/44043c4165b37e9fe765bfda178f8ae4/href">https://medium.com/media/44043c4165b37e9fe765bfda178f8ae4/href</a></iframe><p>Here we’re passing in our subset hash from above as an example (obtained by calling Enumerable#first on our parsed JSON data). In this case it could be any flat (non-nested) hash, with an arbitrary number of attributes. Any fewer or additional keys could be accommodated by adjusting the attr_accessor symbols in one place — our Artwork class. That’s it. No other modifications! Why is this? What’s going on here? N.B. <em>Next edit will add the procedure for refactoring the creation of attr_accessor macros with a similar metaprogramming pattern.</em></p><p>First, we can see that we’re iterating over our hash with Hash#each. So what’s happening inside the block we’re passing to each, on each iteration? Let’s break it down.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/90c018cc8c95c33077537a9fc915afed/href">https://medium.com/media/90c018cc8c95c33077537a9fc915afed/href</a></iframe><p>Within the block, we see key and value arguments passed, to be assigned successive key-value pairs fromsubset on each iteration. Next, we see a method Object#send being called on self. The keyword self always references the current (or default) object. In this case, since self is situated within an instance-method definition of a class, it’s referencing an instance of that class (here, of the Artwork class).</p><p>Object#send will invoke the method specified in it’s first argument. It will invoke it on, or <em>send it to</em> the receiver on which send is called. send provides us a level of <em>abstraction</em>: whatever method comes to occupy send’s first argument, on any particular iteration step through subset, that method will be called on self, the current instance of the Artwork class. This abstraction is the <em>meta</em> at the heart of our metaprogramming example. So how is send working?</p><p>These two setter method calls are the same, in different forms (<a href="http://rubylearning.com/satishtalim/ruby_syntactic_sugar.html">syntactic sugar vs syntactic vinegar</a>):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/599106176bb912365c8f970fb5f0f840/href">https://medium.com/media/599106176bb912365c8f970fb5f0f840/href</a></iframe><p>Keep that in mind for a moment. Let’s look at the last piece of our expression, the argument list passed to Object#send. We said above that send’s first argument is a method, a message to be passed to (invoked on) send’s receiver. Any additional arguments are passed along to the receiver as arguments to the sent method. Since here we have two arguments, (“#{key}=”) and value, (“#{key}=”) will be the method invoked on self (the Artwork instance) and value will be the argument to that method. And though (“#{key}=”) might appear as an odd construction, it’s just a bit of <a href="http://ruby-for-beginners.rubymonstas.org/bonus/string_interpolation.html">string interpolation</a>. It evaluates to “key=” and in the <a href="http://devdocs.io/ruby~2.4/object#method-i-send">Ruby documentation</a> for send we find that:</p><blockquote>“When the method is identified by a string, the string is converted to a symbol.”</blockquote><p>Using our example from the previous snippet, (“#{art_title}=”) becomes :art_title= . Method calls in Ruby are messages being sent to objects (receivers).¹ The messages sent can be either strings or (you guessed it) symbols.² In this case, the message is a symbol. The #art_title= <em>setter</em> method (written by our attr_accessor macro) will execute with an argument of value, which in this case is “Three Statues”. This is exactly the same as our snippet on line 3, above.</p><p>That’s the mechanism by which, on each iteration step, a setter method is invoked together with it’s proper argument for each key-value pair in our hash of artwork attributes, however many keys it may have. The code is much cleaner and more readable, it’s without repetition, and it can gracefully accommodate future changes to the dataset.</p><p>While metaprogramming is a huge and somewhat advanced subject, we can appreciate the power of it in this pattern, a pattern which could be put to use with a great many different APIs. Through operating on and generating code, the code we write can be made to operate more efficiently on data.</p><p>[1]<a href="https://www.rubytapas.com/2012/10/17/episode-011-method-and-message/">Ruby Tapas: Method and Message</a> (check the summary at the bottom)</p><p>[2]Culttt: <a href="http://culttt.com/2015/04/22/what-are-symbols-in-ruby/">What Are Symbols in Ruby?</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=292eb0c1e258" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>