<?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 Richard Scheiwe on Medium]]></title>
        <description><![CDATA[Stories by Richard Scheiwe on Medium]]></description>
        <link>https://medium.com/@rscheiwe?source=rss-dda095519fa8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7aW-um4sCXCZwRxT4H6YXw.jpeg</url>
            <title>Stories by Richard Scheiwe on Medium</title>
            <link>https://medium.com/@rscheiwe?source=rss-dda095519fa8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 07:26:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rscheiwe/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[BeakerX and Python for Data Visualization]]></title>
            <link>https://medium.com/data-science/beakerx-and-python-for-data-visualization-b143f960c93c?source=rss-dda095519fa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b143f960c93c</guid>
            <category><![CDATA[jupyter-notebook]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[computers]]></category>
            <dc:creator><![CDATA[Richard Scheiwe]]></dc:creator>
            <pubDate>Fri, 12 Oct 2018 04:03:06 GMT</pubDate>
            <atom:updated>2018-10-14T17:45:24.402Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*BPo471kiXGeeF9WSln5c6g.png" /></figure><p><a href="http://jupyter.org/">Jupyter Notebooks</a> provide data engineers with a formidable tool to extract insights from troves of data on the fly. Typically, Pythonistas use the notebooks for quickly compiling code, testing/debugging algorithms, and scaling program executions; a robust Javascript kernel (<a href="https://github.com/n-riesco/ijavascript">here</a>) is also now available for the notebooks as IJavascript, but of course even notebook-used Javascript still adheres to the single-assignment constraint for variable declarations. As a result of Jupyter’s ascension with Python installation packages, Jupyter Notebooks have rapidly grown to be the default playground for Python learning and data science, and data visualization is becoming more of an accessible window into large-scale datasets and predictive mappings.</p><p><a href="http://beakerx.com/">BeakerX</a> is an open-source project initiated by <a href="https://www.twosigma.com/">Two Sigma</a>, an investment management firm that foregrounds machine-learning and distributed computing for their investment decisions. One of Two Sigma’s <a href="https://opensource.twosigma.com/">many</a> open-source projects, BeakerX is by far the most robust and community-contributed, with a multifaceted objective to expand the Jupyter ecosystem.</p><p>Whereas the project — more so a grouping of Jupyter extensions — at first glance appears to augment Jupyter Notebooks’ plotting and generalized data-visualization inventory, it also adds polyglot support to the Notebooks; with BeakerX’s installation, a user may initiate a notebook in JVM languages and others (Groovy, Scala, Clojure, Kotlin, Java, SQL, and, of course, Python). Or, as can be seen below, the mixture of Python and Javascript (via Jupyter’s magics and autotranslation) combines to create D3.js interactive visualizations from Python-manipulated datasets:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zRdUgYDdF3MV-z9Uhf8jdA.png" /><figcaption>Python and Javascript in the same notebook — for a future post?</figcaption></figure><p>Which, sooner or later, gives us:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F1eAZVhMwu33OKqmHKy%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F1eAZVhMwu33OKqmHKy%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F1eAZVhMwu33OKqmHKy%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="406" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb68f40dbc95df29d834c4c653e2bb4b/href">https://medium.com/media/fb68f40dbc95df29d834c4c653e2bb4b/href</a></iframe><p>However, the visualization and interactivity functionality of BeakerX is what the project was made for, and we’ll be walking through an interactive example to show its ease of use. (And, although many of the examples in BeakerX’s official <a href="https://hub.mybinder.org/user/twosigma-beakerx-6vipmfp4/notebooks/StartHere.ipynb">binder</a> are written in Groovy, we’ll be focusing on Python here.)</p><h4>Installation</h4><p>First, be sure PATH is correctly declared (this is <em>in re</em> MacOS installations). Python and Anaconda on MacOS may not execute as expected at times, especially if your machine is housing more than one version of Python (e.g., Python 2.7 &amp; 3.6); Pandas may be in one location while the executable Python version is in another (in which case you can just alias the necessary version via the terminal). I’ve found that the following ensures things are pointing in the right direction before attempting to conda install, the preferred method of installation for BeakerX.</p><pre>~ $ export PATH=~/anaconda3/bin:$PATH</pre><p>Once that’s handled, run the following lines, one after another, and they should execute and install the relevant libraries without any issues:</p><pre>~ $ conda create -y -n beakerx &#39;python&gt;=3&#39;<br>~ $ source activate beakerx<br>~ $ conda config --env --add pinned_packages &#39;openjdk&gt;8.0.121&#39; <br>~ $ conda install -y -c conda-forge ipywidgets beakerx</pre><p><strong>(<em>NB. BeakerX works with Python versions &gt; 3.4.)</em></strong></p><p>From there, initialize your Jupyter Notebook at localhost:8888 from either the Anaconda Navigator or your terminal,</p><pre>~ $ jupyter notebook</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ZSJXHgxS4E63ZqUoMs9RA.png" /><figcaption>Take note of the available JVM languages, in addition to Python 3 and SQL</figcaption></figure><p>Once initialized, I like to run the following code to check everything’s in order:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wlSV_w8H3TYTvt45RTL59w.png" /></figure><p>And we’re ready to go…</p><h4>The Project</h4><p>The best way to get acquainted with BeakerX functionality is to parse the official binder and start with a familiar data-visualization technique, like time-series outputs, heatmaps, or histograms, all of which are probably familiar to data scientists through <a href="https://seaborn.pydata.org/">Seaborn’s</a> matplotlib-based library or the <a href="https://bokeh.pydata.org/en/latest/">Bokeh</a> library. We’re going to focus on a smaller part of the Python-based Output Container example, <a href="https://hub.mybinder.org/user/twosigma-beakerx-vjxvf84c/notebooks/doc/python/OutputContainers.ipynb">here</a>.</p><p>We’ll be using Python and Pandas to create an interactive scatterplot from about 300 rows of data, and it’ll ultimately look like this:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FWNwMfmrRYHPiYy3Tk9%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2FWNwMfmrRYHPiYy3Tk9&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FWNwMfmrRYHPiYy3Tk9%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="329" frameborder="0" scrolling="no"><a href="https://medium.com/media/679f4eebb615df65f2fea6e2ec3d1ffa/href">https://medium.com/media/679f4eebb615df65f2fea6e2ec3d1ffa/href</a></iframe><p>The data is BeakerX’s own, found at its GitHub repo, <a href="https://github.com/twosigma/beakerx/blob/master/doc/resources/data/interest-rates.csv">here</a>. There’s a minimized version of the data for easier testing purposes, but I’ll be using the complete version, which only runs 314 rows long, so that a fuller plot is generated.</p><p>(One thing to briefly note: Bokeh’s interactivity is in itself robust and fulfilling, and <a href="https://github.com/bloomberg/bqplot">bqplot</a> — via Bloomberg — likewise presents standardized 2D visualization options. But BeakerX more suitably integrates with the Spark cluster-computing framework, and a <a href="https://mesosphere.com/blog/dcos-tensorflow-jupyter-beakerx/">brief tutorial </a>shows the ease with which TensorFlow and neural network integration is achieved with BeakerX at the helm.)</p><p>Nonetheless, we’ll be focusing on a simple scatterplot, as mentioned, for introductory purposes. So first, we have to read the data, via Pandas, and print the first 5 lines to check if everything’s in order:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aNZo75kC28LYpMFYqI7CHA.png" /><figcaption>Did we import Pandas?</figcaption></figure><p>The astute reader will notice we <em>only </em>ran import beakerx (or, alternatively, from beakerx import *). Yet, we’re able to run Pandas without importing…</p><p>Looking at the source code reveals BeakerX incorporates Pandas into its build, which provides autocompiled functionality of pd.dataframe and other Pandas calls.</p><p>Without knowing the Pandas library, it might be easy to overlook a lot of the shorthand code allowed by BeakerX when Python-based Notebooks are generating visualizations or handling data. Thus, it helps to know what pd references, even though read_csv is fairly self-explanatory. (Just make sure the .csv is in a reachable directory!) BeakerX, in this context, relies on Pandas, but it also augments Pandas’ base methods with even more spreadsheet-like action. As can be seen below, greater flexibility is imported with BeakerX’s handling of the Pandas library, for (much) easier visualization purposes. This time, running df.head(20) for the first 20 rows of data:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F5Ut4XkY3KUIbNODFwi%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F5Ut4XkY3KUIbNODFwi%2Fgiphy.mp4&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F5Ut4XkY3KUIbNODFwi%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="329" frameborder="0" scrolling="no"><a href="https://medium.com/media/c6cb05ba2a31a1b52b039cf89260a312/href">https://medium.com/media/c6cb05ba2a31a1b52b039cf89260a312/href</a></iframe><p>Next, we’ll handle aesthetics:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zU4gbMcXjzun5Teoaft5TQ.png" /></figure><p>And the code to handle the plotting:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g32yAjBprmnf0ZUkj1EWrA.png" /></figure><p>Familiarity with Pandas certainly helps when it comes to plotting like this, but it’s a safe bet that if you’ve used Jupyter Notebooks, you’ve done the fundamentals when it comes to Pandas, its dataframes, and some kind of plotting. IPython was designed to handle such things with ease. But for a brief rundown…</p><p>We set our dataframe as df, and where we’re calling plot.add to construct the plot, we’re likewise calling as Points and Line arguments the x and y axes for the data. Thus, df.y1 is the y1 column in the df dataframe; df.y30 is the y30 column in the df dataframe. Etc. Also, we’re setting the setShowLegend boolean to True for illustrative purposes, and hovering over the items in the legend causes the respective data points to illuminate or hide, depending on the chosen actions.</p><p>Ultimately, this yields a neat, interactive (see .gif above) plot in just a few lines of Python, thanks to BeakerX:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m3HXENXOu-Wglzsics7E2w.png" /></figure><p>(For the full notebook, see <a href="https://nbviewer.jupyter.org/gist/rscheiwe/4960901d17412c59daba78520aba9e42">this Gist</a>, or the official binder <a href="https://hub.mybinder.org/user/twosigma-beakerx-d1gcmh6m/notebooks/doc/python/OutputContainers.ipynb">here</a>.)</p><h4>Conclusion</h4><p>With polyglot functionality and Notebooks magics built in, BeakerX is a powerhouse of efficiency and workflow, and it’ll be great to see more dev towards neural network processing, especially via TensorFlow or distributed-computing frameworks. Such advances will allow more novice programmers to easily and intuitively understand the complex inner-workings of AI programming.</p><p>But in my opinion, what makes it most exciting is that it’s open source, one of many Two Sigma initiatives at work to further the data science community. A number of <a href="https://github.com/twosigma/beakerx/issues">active issues</a> are available for everyone to dig into and get to work with.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b143f960c93c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/beakerx-and-python-for-data-visualization-b143f960c93c">BeakerX and Python for Data Visualization</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Case for Timsort]]></title>
            <link>https://medium.com/@rscheiwe/the-case-for-timsort-349d5ce1e414?source=rss-dda095519fa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/349d5ce1e414</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Richard Scheiwe]]></dc:creator>
            <pubDate>Fri, 24 Aug 2018 13:57:49 GMT</pubDate>
            <atom:updated>2018-08-24T13:57:49.872Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*RvGUp4V4tQ_dMeQl.png" /></figure><p>Timsort is a sorting algorithm recently devised by its creator, Tim Peters, in 2001. It’s a popular algorithm in Python for its efficiency and speed, and so has become the <em>de facto</em> sorting algorithm for that language, in addition to being adopted in Java; whenever the .sort() method is called in Python, it is implementing Timsort, as is Java. Given the nature of <em>how </em>other sorting algorithms were created (e.g., in the “lab”, or academia), many view Timsort as the most realistic, real-world-ready sorting algorithm available since it approaches an array of items as though said array reflects real-world instances: Some data will already be sorted, some will not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Vm6RJ1W0oroOuNEw.jpg" /><figcaption>Tim Peters at PyCon</figcaption></figure><p>Peters is something of a guru to Pythonistas for his 20 principles of software writing, <em>Zen of Python, </em>which outline a typical Pythonista’s philosophy for coding<em>. </em>If a programmer were to call import this in the command line or anywhere Python code is executable, they’d be met with the following philosophy of Python’s coding style, Tim’s 20 principles:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/0*C1mYlhH9vWQ1XUEA.png" /></figure><p>Much in contrast with other programming language “philosophies,” Peters’s <em>Zen of Python </em>emphasizes a singular way of writing solutions to problems, whether algorithms or processes. In line with this, the Timsort sorting algorithm is based on both Insertion Sort and Merge Sort, either of which is particular to the size of the array to-be sorted; the former is great for smaller lists while the latter is more suitable for larger arrays. Most notably, Perl’s coding style is, i fact, an stark contrast to Python’s, so much so that the former’s motto is, “There’s more than one way to do it” (TMTOWTDI, or <em>Tim Toady</em>). We can further see this sentiment reflected in principle 14, “Although that way [the previous principle’s way] may not be obvious at first unless you’re Dutch.” Though cryptic in reference, it is generally assumed that this ambiguous, “Zen-like” principle is a reference either to Python’s progenitor, Guido van Rossum, or even (more likely) to Edsger W. Dijkstra, an early pioneer of computer systems. The latter wrote,</p><blockquote>I thought that it was a firm principle of language design — out of concern for programming as a human activity — that in all respects equivalent programs should have few possibilities for different representations (possibility for differences ideally not going beyond the arbitrary choice of identifiers and the arbitrary ordering of syntactically unordered components). Otherwise completely different styles of programming arise unnecessarily, thereby hampering maintainability, readability and what have you.</blockquote><p>Timsort’s time complexity is recorded at <em>O(n log (n))</em>, making it’s average time complexity equal to that of Quicksort and Mergesort; in best-case scenarios, whether negligible or not, Timsort will typically outperform both Quicksort and Mergesort in time complexity, though it is arguably relegated to cases where data is considered nearly sorted (e.g., real-world data) given Timsort’s stable characteristics.</p><p>The source code for Timsort is officially in C, though a simplified, Pythonic version is of use (courtesy of Nanda Javarma):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a76c32d92a4332b0cb16f4d1b716ed2e/href">https://medium.com/media/a76c32d92a4332b0cb16f4d1b716ed2e/href</a></iframe><p>As can be seen in the code, Timsort makes use of either Insertion sort or Mergesort, contingent on the length of the array. In cases where the array is less than 64 elements, Insertion sort is incredibly fast and, in the case of Timsort, a particular type of the insertion algorithm is utilized, Binary Insertion Sort (hence, lines 1–19). In Binary Insertion Sort, the number of comparisons is reduced by employing binary search methods on the array, which locates the midway point of an array and, given whether or not the item-to-be-inserted is greater than or less than the midway point, you choose the appropriate half and halve that half and recursively repeat the process until the correct location is determined. Performance under the conditions of Binary Insertion Sort is determinately faster than normal Insertion Sort since less recursion is employed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*GsAl2vJXLrG8a9a8.gif" /></figure><p>Timsort may not seem impressive since in many cases it could potentially implement a standardized, “lab-created” algorithm for sorting. However, given the fact that most datasets in the real world extend beyond 64 elements nowadays, Timsort’s uniqueness and power become clearer.</p><p>Timsort makes use of what are called “runs.” In a dataset, a <em>natural run </em>is a state of the array wherein at least two consecutive elements are currently (relative to the array’s global and local states) in either ascending or descending order. Should the two elements not be in correct ascending order, they are simply reversed in place. Timsort makes a first-pass across the array in search of such runs, while concurrently seeking to identify a <em>minrun</em>, or the minimum size of an ordered list within the list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/0*9J7j17iPNp3E04iR.png" /></figure><p>If, say, the minrun is equal to or less than 64 elements, Timsort knows to reduce itself to Binary Insertion sort, which guarantees the implementation of merging only in cases where the “weight” of a minrun is too much (e.g., cases where merging cannot be efficiently implemented because the number of minruns is greater than the power of two). In such cases where the array is greater than 64 elements, the first-pass natural-run search determines said natural runs for the sake of merging. It is ideal to delay merging until the optimized time, given the fact that an array may not be fully reduced to its set of runs without the algorithms “knowledge” of exclusive or excluded elements, not to mention the array’s size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/0*lOusTwLwfzA3M2aB.gif" /></figure><p>Though merging is a fairly standardized procedure with consummate documentation, Timsort’s unique “galloping” functionality extends its optimization beyond mere Merge sort variants. As noted, Timsort was created with real-world implications in mind: Data, especially if pulled from a .csv file, is bound to be partially ordered.</p><p>Per Peters’s own words:</p><blockquote>Still without loss of generality, assume A is the shorter run. In galloping mode, we first look for A[0] in B. We do this via &quot;galloping&quot;, comparing A[0] in turn to B[0], B[1], B[3], B[7], ..., B[2**j - 1], ..., until finding the k such that B[2**(k-1) - 1] &lt; A[0] &lt;= B[2**k - 1]. This takes at most roughly lg(B) comparisons, and, unlike a straight binary search, favors finding the right spot early in B (more on that later)...Galloping compromises by getting out fast if there isn&#39;t a long winning sub-run, yet finding such very efficiently when they exist.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*q5lYEI1RgRuNFN_h.png" /></figure><p>In galloping mode, Timsort takes two runs (called “sub-runs” in the above quote, say X and Y) and checks, via binary search, if Y[0] could fit into X. If so, the entirety of the run is placed at the found position given the fact that the two runs are accordingly sorted due to the created of runs in Timsort’s previous step(s). Should Y[0] not fit in to Xat Y[0], then the process is reversed and Timsort attempts to insert X[0] into Y. (Also, take note of the integer 9 from image 1, above, to image 2, below.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*tQAmlZPVcmcYLKaX.png" /></figure><p>The above images illustrate a successful example of galloping being executed, but if there is no ultimate gallop implemented within the first few steps, galloping mode is exited. Since this process is repeated numerous times over, and since the algorithm can take note of whether galloping has been routinely successful or not, it makes it easier to deny galloping or reenter galloping, respectively.</p><p>Ultimately, data is never without some inherent, ordered structure; it is highly improbable that a natural run of more than two integers is not inherent to the dataset. Whereas Insertion sort and Merge sort appeal given their performance and their academic rigor, Timsort is more pragmatic.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=349d5ce1e414" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jumping to Heroku on Rails with daily-nasa.herokuapp.com]]></title>
            <link>https://medium.com/@rscheiwe/jumping-to-heroku-on-rails-with-daily-nasa-herokuapp-com-f4b40e861032?source=rss-dda095519fa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4b40e861032</guid>
            <category><![CDATA[heroku]]></category>
            <dc:creator><![CDATA[Richard Scheiwe]]></dc:creator>
            <pubDate>Thu, 02 Aug 2018 18:38:24 GMT</pubDate>
            <atom:updated>2018-08-02T18:38:24.840Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-_73HmGGGQ5hmFKh" /><figcaption>“An old document cabinet with small drawers” by <a href="https://unsplash.com/@jessedo81?utm_source=medium&amp;utm_medium=referral">jesse orrico</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Heroku is a cloud-application platform (CAP) that handles multiple programming languages and the PostgreSQL management framework for the sake of application deployment and data storage. Companies from Citrix to Invisalign utilize Heroku’s at-scale deployment capabilities in order to manage their hosting and server needs, but even novice programmers may take advantage of Heroku’s easy deployment system and have their web apps appear on the internet within minutes.</p><p>Below is a snapshot of the web application I built using Ruby on Rails and JavaScript, then deploying onto the internet via Heroku. The site is a single-page application that makes an API call to NASA’s APOD API, which returns that day’s planetary object’s data; every time someone reloads the page, the API request goes out and returns the appropriate data, which includes the object’s title, date/time of request, image, and a short explanation of the object written by NASA astronomers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zhMhtIEbCycnM8QMhTkv5Q.png" /></figure><p>There is little to change when creating a Rails app that you plan to run on Heroku’s servers and one that you don’t. The main issue, as many know, is that Heroku can’t handle SQLite3; it only runs PostgreSQL. Since Rails apps default to SQLite3, it’s best to initialize your new Rails app with a PostgreSQL server running and as the database.yml file.</p><p>After making sure PostgreSQL is installed and that your server is running, enter the following into your terminal:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/42c0651e45e08d4435709cad1e7982a2/href">https://medium.com/media/42c0651e45e08d4435709cad1e7982a2/href</a></iframe><p>where you replace daily-nasa with the name of your choice for your app.</p><p>Once the app is created and you’ve got it running how you’d like it to run, you’ll want to head over to Heroku and familiarize yourself with the documentation they have regarding Ruby deployment on Heroku servers. Heroku works by spinning “dynos”, which are basically what they call “servers”, to an extent. It doesn’t cost anything to deploy on Heroku; if you keep your data storage under 10K rows of data, then you’ll be able to use their services for free; also, if not a lot of people visit your website (and, therefore, not a lot of requests are being made to your Heroku-hosted domain), then you’ll be free and clear of charges. Heroku’s dynos are utilized by individual web apps based on the number of visitors a Heroku-hosted site has; the more visitors, the more servers that are directed towards the site.</p><p>Again, once the app is ready for deployment, you install Heroku’s CLI since you’ll need it to interact with Heroku GIT servers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f394cb7cdd922a75c93a8c050de40019/href">https://medium.com/media/f394cb7cdd922a75c93a8c050de40019/href</a></iframe><p>Once installed, you’ll be prompted to login and, once successful, you can go ahead and create your new Heroku app:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9fc766c5691dc4260e994d310b222dc/href">https://medium.com/media/f9fc766c5691dc4260e994d310b222dc/href</a></iframe><p>And verify the GIT connection has been established:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8333991d30fed38509b5d20792c65e8b/href">https://medium.com/media/8333991d30fed38509b5d20792c65e8b/href</a></iframe><p>Finally, push to their GIT servers:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/166006565700b97a45fab50563f0448c/href">https://medium.com/media/166006565700b97a45fab50563f0448c/href</a></iframe><p>At this point, some errors might be thrown; it’s typically where people encounter a lot of problems because a Rails app requires many, many gems, but these gems are being constantly updated and they don’t always seamlessly integrate with Heroku. Either Heroku servers have yet to be updated, or the gems have yet to be updated. Furthermore, asset compiling in the pipeline is a headache for many.</p><p>In order to debug any issues, first check your database.yml in config. It should look something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4ef2bc5394c310b19fecb2c56a90931c/href">https://medium.com/media/4ef2bc5394c310b19fecb2c56a90931c/href</a></iframe><p>As can be seen, this database.yml file is specifically set to PostgreSQL, rather than SQLite. In this case, the database is specific to daily-nasa.herokuapp.com, even though the site <em>doesn’t </em>use a database.</p><p>Another common pitfall relates to the Uglifier gem, which is pre-installed with a Rails app creation. In the config &gt; environments &gt; production.rb file, the following line <em>must </em>be included:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d73707cd09e791eb433533e893f06899/href">https://medium.com/media/d73707cd09e791eb433533e893f06899/href</a></iframe><p>And the following line, which is the asset compilier, must be set to <em>true; </em>otherwise, assets (like images) won’t compile upon Heroku GIT pushing:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e37d93d77a061c42be08486a98c3dd71/href">https://medium.com/media/e37d93d77a061c42be08486a98c3dd71/href</a></iframe><p>Finally, the following must be included in package.json re: node and yarn gems, so that the package.json file looks like the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a885a70b30649a0cea46f0b9f6f1a864/href">https://medium.com/media/a885a70b30649a0cea46f0b9f6f1a864/href</a></iframe><p>With these alterations, there shouldn’t be any git push Heroku master errors, hopefully, and you’ll be greeted with a live server on your Heroku dashboard,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8GVZ6T6oiQZvU9iqZgErxA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4b40e861032" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Thoughts on the Coming (Software) Apocalypse]]></title>
            <link>https://medium.com/@rscheiwe/thoughts-on-the-coming-software-apocalypse-32d790c75e83?source=rss-dda095519fa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/32d790c75e83</guid>
            <category><![CDATA[iran]]></category>
            <dc:creator><![CDATA[Richard Scheiwe]]></dc:creator>
            <pubDate>Thu, 19 Jul 2018 18:30:05 GMT</pubDate>
            <atom:updated>2018-07-19T18:30:05.234Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The quiet revolution of TLA+ and specification languages in programming</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*3a_3e1VkJjW9BjwcF1Q9Kw.jpeg" /><figcaption><em>An example of modal logic, the parent-class of temporal logic.</em></figcaption></figure><p><em>TLA+ is a specification language meant to universally oversee the proper functioning of programs written in other languages; it is meant to also address the problem that the more complex machinery becomes, the more complex the software solutions.</em>¹<em> As a result of this complexity, a simple disruption of a line of code among millions of other lines of a program’s code is liable to break the entire program. Regardless the state of self-checks and potential functional redundancies, programs for a car’s brakes system or a city’s electromechanical grid, for example, are more prone to catastrophic failure given the necessary developments towards complexity.</em></p><p>Protestors swarmed Tehran’s main streets and square as an individual — or group of individuals — somewhere in the world upgraded a previously released version of their computer virus for another deployment. Months or years before, the first version of their virus inserted itself into the run directories of a piece of machinery deep within an Iranian nuclear facility, probably through an engineer’s naive use of a USB drive.² Confusion settled into the operating room of Iran’s nuclear facility at Natanz; engineers were fired for not being able to remedy the fact that centrifuges were breaking down and shattering at an abnormal rate. As with any virus and its initial implementation, none were the wiser: systems continued to run smoothly, and the computers’ native security features signaled nothing amiss.</p><p>Stuxnet 1.001 is the infamous, weaponized computer virus that leveled a thousands of Iranian nuclear centrifuges by spreading through simple, almost naive social engineering; in the process, it threatened a Chernobyl-like event in the Middle East. Though there have never been any official confirmations as to the creator or creators of the virus, <a href="https://arstechnica.com/tech-policy/2012/06/confirmed-us-israel-created-stuxnet-lost-control-of-it/">most agree</a> that digital fingerprints lead to a combined effort on the parts of the United States and Israel. The idea behind the hack was ingenious, from a statecraft-innovation standpoint: Given that the Iranian nuclear reactors utilize basic PLC (programmable logic controller) Siemens-made motors for centrifuge systems, and given that said motors run thanks to lines of code, destabilizing the methods of the code’s proper functioning would cascade a series of breakdowns which ultimately could disrupt the proper functioning of the nuclear reactors themselves.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4f75574fb7e89d8c72bd849e6d1ba067/href">https://medium.com/media/4f75574fb7e89d8c72bd849e6d1ba067/href</a></iframe><p>Forensic research on the virus revealed many prior versions with increasingly aggressive payloads. According to the researches at Symantec, they had never encountered a virus with the abilities to affect real-world, kinetic changes. The above is a partially recompiled snippet of the Stuxnet virus, reverse engineered by <a href="https://github.com/Christian-Roggia/open-myrtus">Christian Roggia</a> and Amr Thabet. It is estimated that the virus took anywhere from 2–3 years to compile, which doesn’t include the testing and refactoring necessary of any software.</p><p>Data breaches make headline news, but only the ones that are either known to or acknowledged by the victims of these data breaches. The growing accumulation of data — especially personal data on individuals’ finances — requires deeper security measures so that such data is easily communicable to a company’s interests while remaining “black boxed”, or out-of-reach to those on the outside who seek to acquire private financials and turn them into personal, black-market profit. Whereas Stuxnet logged every node it came into contact with and stored within its coding a vast amount of data, that data was not its primary target. The virus managed to read the data it accumulated if only to “know” when to deliver its payload; so, as it has been deduced, the virus lay dormant in the Natanz systems for 13 days while it waited to activate itself and deliver the appropriate code that would ultimately destroy thousands of Iranian centrifuges.</p><p>Of course, the problem inherent to viruses is that once released, they become maliciously ungovernable. Supposedly, the Israelis broke confidence with the United States and deployed a more aggressive version of Stuxnet, which rapidly spread through computers worldwide. The greatest concentration of Stuxnet incidents was found in Iran and the broader Middle East, but it soon made its way to American industrial systems. Though the weaponized software had intended targets initially, Stuxnet spread beyond the confines of its original domains and into the United States’ industrial complex. The Natanz uranium enrichment facilities were specifically targeted after a carefully planned, test-driven seeding of at least five other facilities in the preceding weeks.³ In short order, the virus destroyed about one-fifth of Iran’s nuclear centrifuges. It mattered little, however, in the following months. After proving its ingenuity and accomplishing its objectives, Stuxnet went rogue, soon unveiling itself in systems worldwide in which its creators had never intended for it to be found.</p><h4>Temporal Logic of Actions</h4><p>Specification languages are unique in programming because they behave more so as predicate (symbolic) logic relates to language, meaning, judgements, and/or existentials; they are abstracted to an ideal level and generalized for the sake of universality, again as ideally as possible. The following principle, the Law of Non-Contradiction, is necessarily true in all cases and all possible worlds: <strong>⊢<em>.∼(p.∼ p) </em></strong><em>. </em>In short, the principle states that if “<em>A is B”</em>, then it is not possible for <em>“A is not B”</em> simultaneously. (For example, “Richard and Justine are both taller than each other at the same time.”) It is <em>axiomatic</em>, meaning that it is self-evidently true and irrefutable.⁴ Further, logic is <em>formal </em>or a<em> formalized method, </em>in the sense that the <em>form</em> of arguments or declarative statements is standardized over the <em>content </em>of the arguments or statements. “If <em>p </em>then <em>q</em>” (<em>P → Q</em>), which is a basic statement of causality, technically <em>has no content</em>; it only pragmatically matters when applied to real-world or empirical scenarios (“If I eat, then I won’t be hungry”).</p><p>Referring to the opening illustration of modal logic at the top of this article:</p><ul><li>a<em> necessarily true proposition </em>is <em>P = </em>“2 + 2 = 4,” which is true in the <em>actual </em>world and should be true in all <em>possible </em>worlds (<strong>☐<em>P</em></strong>);</li><li>a <em>true proposition</em>, however, is <em>only </em>true in the <em>actual </em>world, like<em> B = </em>“Barack Obama became president in 2009.” It need not be true in <em>all </em>possible worlds. (Or, <strong>♢¬<em>B</em></strong>);</li><li>importantly, a <em>possible proposition </em>is true in <em>at least </em>one possible world. So, <em>M= </em>“Mitt Romney became president in 2009 is a possible proposition since he did, in fact, run against Barack Obama and had the chance to win the election. (Or, <strong>♢<em>M.</em></strong>)</li></ul><p>Temporal logic is a broad term that covers logical approaches to temporality, mostly under the system of modal logic, or the logic of what’s possible and/or actual. Computer scientists leverage linear temporal logic (or, LTL), which made inroads into computer science in the late seventies and early eighties thanks to the work of Amir Pnueli and Leslie Lamport, especially the latter’s paper, “‘Sometime’ Is Sometimes ‘Not Never’.” As a subset of computational tree logic, LTL is a useful, formalized tool for verifying the running and properties of reactive systems, or programs which receive an input, perform computations with functions and/or algorithms, and delivers an output.⁵ Recently, it has found its place in artificial intelligence as a means to program temporal knowledge in artificial systems.</p><p>Considered a “natural meeting point” between philosophy and computer science, temporal logic formally describes the majority of computational processes since the same variable (<em>x)</em>, for example, may be assigned a different number depending on the execution time of the program.⁶ Temporal logic was introduced into computer science by Amir Pnueli, who would go on to win two Turing awards for his subsequent work on temporal logic in computing systems. Pnueli’s innovation led to “a unified approach to program verification… which applies to both sequential and parallel programs,” according to his paper, “The Temporal Logic of Programs”.</p><p>Lamport first augmented Pnueli’s work on temporal logic with his (Lamport’s) invention, TLA (or, temporal logic of actions), a mathematical-reasoning system using logic and simple mathematical operators to determine the precise chain-of-events as they <em>s</em>hould occur in a process. TLA simply combines the logic of temporality with the logic of actions. The logic of actions is broadly construed as a method of formalizing causal dependencies and inferences, primarily; if <em>P </em>is understood as always leading to <em>Q</em>, then the action of <em>if P then Q </em>holds universally. It is easy to see, hopefully, how temporal logic folds into the logic of actions given that actions transpire <em>within </em>a temporal framework, never without riding the passage of time. Thus, causality is an integral, if not defining aspect of the logic of actions and, as such, temporal logic.</p><blockquote>“In the 15th century, people used to build cathedrals without knowing calculus, and nowadays I don’t think you’d <em>allow</em> anyone to build a cathedral without knowing calculus. And I would hope that after some suitably long period of time, people won’t be allowed to write programs if they don’t understand these simple things.” — Leslie Lamport</blockquote><p>In the context of computer science, specification languages check for a program’s operational functionality, primarily — and exhaustively — determining a program’s functioning soundness and whether any design flaws may exist upon the program’s implementation. At every step of a program’s routine, the result is anticipated in the program’s coding.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e429beb2204e82f7cfd3d5320dbe12b/href">https://medium.com/media/3e429beb2204e82f7cfd3d5320dbe12b/href</a></iframe><h4>From Academics to Implementation</h4><p>As Nancy Levenson has written, “the problem is that we are attempting to build systems that are beyond our ability to intellectually manage.” Bugs in complex algorithms may only emerge in the rarest of cases, but their emergence may be devastating to not only a piece of software like a video game but also a city’s entire electrical grid.</p><p>The problem, as noted above, is that electromechanical systems rely on millions of lines of code in order to run smoothly; whereas a phone system may have been run by operators pulling and pushing plugs between a limited number of connections, now the digitization of communication necessitates a dependency on greater automation among an exponentially larger, almost unlimited number of connections. If, say, a suite of software programs that runs the way a city’s electrical grid functions, consists of 50,000,000 lines of code, it might take a certain chain of minuscule events to rupture the proper functioning of the electrical grid. As has been noted by many experts, there is no possible way to know <em>where </em>the problem lay <em>until </em>something breaks. Then — and only then — are engineers able to sift through the millions of lines of code to decipher the problem.</p><p>Lamport wished for TLA to be mathematically simple, expressing logical relationships within the TLA framework as elegantly as possible. Upon honing Pnueli’s work, Lamport used TLA as the foundation of the specification language TLA+, likewise his own invention. As Lamport notes, TLA “provides an elegant way to formalize and systematize all the reasoning used in <em>concurrent system verification</em>” (emphasis added). Though broaching fields of philosophy and mathematics, both TLA and TLA+ are meant to be understood within the confines of computer science since they apply to <em>designed </em>reactive systems, or the input-computation-output process noted above.</p><p>The following code example is one of the most basic implementation of a TLA+ systems check that can be performed. It defines the state and behavior of a one-byte clock, alternating between <em>ticks </em>and <em>tocks</em>, which should exhibit the behavior of alternating between <em>1</em>s and <em>0</em>s, for the purposes of illustration.</p><p>First, the perpetually ticking clock is specified:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/605105b9e8e0d134b734b3e7a1c8c4fd/href">https://medium.com/media/605105b9e8e0d134b734b3e7a1c8c4fd/href</a></iframe><p>Both the state <em>and </em>behavior specifications are completely generalized for universal; any programming language with the above-mentioned functionality in regards to CLOCKshould behave according to these specifications. First, CLOCK is initialized as contingent upon two states: {0,1}. <em>Only </em>if the CLOCK state-predicate (or, initial setup) is <em>either </em>0 or 1 should the CLOCK program initialize. Line 5 specifies the program’s (or, algorithm’s) <em>total </em>states and <em>total </em>behavior. TICK in this context could be understood as truthy, with clock&#39; being the state-representation of TICK, in the initial instance. <em>Only if </em>clock=0 should the program execute clock&#39;, or clock&#39;=1. These two instances of setting clock are the “safety behaviors” of the CLOCK program, or the <em>permissible states </em>which the TLA+ behavior checker will allow, per the program-design’s purpose.</p><p>Spec is the temporal logic behind the logic of actions just described. It asserts that Init is only executable if and only if it is satisfied by the prescribed design behaviors of clock&#39;s two states, {0,1}. Thus, the resulting “output” reads:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/06d5e376400f9761cc2b6c1011670267/href">https://medium.com/media/06d5e376400f9761cc2b6c1011670267/href</a></iframe><p>The above is a “safe”, or correct running of CLOCK. The TLA+ code disallows such state behavior as,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d5e927ea75e81d22286646e14dadc742/href">https://medium.com/media/d5e927ea75e81d22286646e14dadc742/href</a></iframe><p>The CLOCK example is, as stated, a very — if not most — basic illustration of TLA+ as it may be applied to a programming language’s algorithm. Though the TLA+ program is probably about as long as, say, an example of CLOCK in Ruby or Python, TLA+ program checkers are typically a fraction of the size of the programs that they are checking. It can easily be imagined how a piece of software with millions of lines of code and algorithms can be aided by a universal, generalized specification checker, in this context.</p><p>TLA+ is a design-oriented protocol, meaning that it is written <em>prior </em>to an engineer begins coding a piece of software. As such, it is considered “model-based design,” used most appropriately when leveraged in the same way that an architect uses blueprints: <em>beforehand</em>. It is a matter of opinion whether programmers refuse TLA+ because they like to dive into coding the software as soon as possible, but engineers at Amazon have managed to implement TLA+ after-the-fact, finding bugs in their S3 data storage software over the years thanks to the specification language.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eBQiDgoZTTyZfhHiHO3Tfw.jpeg" /><figcaption>Credit: Oliver Burston/Ikon Images/Getty</figcaption></figure><p>TLA+ remains stolidly an academic curiosity rather than a pragmatic solution, though Microsoft and Amazon have used it for a few years with much success. The workflow of implementing TLA+ in a software’s design is straightforward and recognizable to many who practice certain types of design, like experience design:</p><p>¹ The title and inspiration for this article come, in part, from the article of the like-title / -subject, <a href="https://www.theatlantic.com/technology/archive/2017/09/saving-the-world-from-code/540393/">“The Coming Software Apocalypse”</a>. Rf. James Somers, “The Coming Software Apocalypse,” <em>The Atlantic, </em>26 Sept. 2017.</p><p>² Stuxnet’s exact means of insertion via USB into the Iranian network is a mystery, and it may have been due to an unwitting worker as much as a double-agent. For a history of Stuxnet’s social origins, see: Kim Zetter, <em>Countdown to Zero Day: Stuxnet and the Launch of the World’s First Digital Weapon</em>, New York: Broadway Books, 2015.</p><p>³ Ibid. Also, rf. Dan Goodin, <a href="https://arstechnica.com/information-technology/2014/11/stuxnet-worm-infected-high-profile-targets-before-hitting-iran-nukes/">“The Stuxnet Worm Infected High-Profile Targets <em>before </em>Hitting Iranian Nukes,”</a> <em>Ars Technica</em>, 11 Nov. 2014.</p><p>⁴ For the example of the principle of non-contradiction and the modal logic examples, see the Wiki entry on “Possible Worlds”. Further, it should be noted that a branch of logic known as paraconsistent logic has objected to the principle’s axiomatic validity though such objections are not the concern of this article.</p><p>⁵ Rf. Madhavan Mukund, “Linear-Time Temporal Logic and Büchi Automata,” in <em>On Logic &amp; Computer Science</em>, Dec. 1996: 1–21.</p><p>⁶ Rf. Antony Galton and Valentin Goranko, “Temporal Logics in Computer Science,” in <em>The Stanford Encyclopedia of Philosophy</em>, ed. Edward N. Zalta, Winter 2015.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32d790c75e83" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What We Talk about When We Talk about OOP]]></title>
            <link>https://medium.com/@rscheiwe/what-we-talk-about-when-we-talk-about-oop-6ca96da47905?source=rss-dda095519fa8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ca96da47905</guid>
            <category><![CDATA[computers]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[oop]]></category>
            <dc:creator><![CDATA[Richard Scheiwe]]></dc:creator>
            <pubDate>Thu, 21 Jun 2018 18:06:59 GMT</pubDate>
            <atom:updated>2018-06-21T18:06:59.484Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aqL5hWB-2p7ZFgKWFTkQNw.jpeg" /></figure><p><em>All consciousness is a consciousness of something.</em><br>Edmund Husserl</p><p>Object-Oriented Programming (OOP) is a powerful, ubiquitous process of computing that attempts to reflect real-world scenarios of classification and dependency by using classes and “objects”. Thinking seriously about <em>what</em> an object is is no mere academic exercise since it aides in the understanding of digital objects and, by extension, OOP. The family of objects we call “digital objects” is easily glossed over or taken for granted without any attention paid to the potentially contradictory nature of the terms “digital” and “objects”: digital exists “elsewhere”, whereas objects, commonly understood, exist in the physical realm. It is important, therefore, to think about the objects of computer programming as neither distinct nor distant from either the objects of the physical (natural) realm, or the objects of abstraction (like, numbers, thoughts, ideas).</p><p>Conventional wisdom has us think that an object is something we can apprehend or perceive physically, and <em>only</em> physically. A hairbrush, a chair, a person — each able to be held, to be seen, heard. Objects of our physical environments appear to us, objects which are material, or concrete in nature.</p><p>Computer processes are distant and abstract; whatever goes on under the hood when someone opens Instagram or sends an email is lost on many computer users. It is not so much because the programming is complex by nature, though that certainly adds to the disconnect. Rather, what all these programs and processes have in common is their reliance on the <em>digital</em> objects of computer programming and OOP.</p><p>OOP theoretically shortens the distance between the object as a purely digital construct and the real world. According to Bill Curtis (1997), “object-oriented (OO) design and programming trace their lineage to research on abstract data types in the late 1960s and early 1970s.”¹ In real-world scenarios, and individual typically has one-to-one relationships with objects of the “physical” world; a person can pick up a banana or see a car in the distance. However, abstractly organizing data via data types removes both the programmer and the computer user from a one-to-one relationship with the working mechanisms of a complex machine. Or, though the human-computer interface is a meeting place between human and computer, for sure, the two parts of the dependent relationship — the human and the computer — grow ever more distant as programs evolve in complexity. The more humans rely on computers for everyday tasks, the more of an issue such distances become.</p><p>As an example, we create an class in Ruby, which is designed to define instances of NewObject:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c1419106bea842e08cc489a2ae66aa2/href">https://medium.com/media/6c1419106bea842e08cc489a2ae66aa2/href</a></iframe><p>This class, if initiated, requires NewObject to be called with both a :name and :location attribute. So in order to create a new instance of NewObject, we write:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c48c3c8b8263a0685d5a8f83246e392d/href">https://medium.com/media/c48c3c8b8263a0685d5a8f83246e392d/href</a></iframe><p>Whereas Classes do <em>not </em>take up space in memory, objects necessarily do; each instance of a class is a unique object-entity with a unique hexadecimal identifier, regardless the sameness of attributes (two NewObject instances may have the same :name and :location . The above call on NewObject.new yields:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/633c4beb65489e3574fd9825f0e5e19f/href">https://medium.com/media/633c4beb65489e3574fd9825f0e5e19f/href</a></iframe><p>As can be seen, the <em>entire </em>instance is a singular object.</p><p>As noted, OOP aims at reflecting certain real-world circumstances. Specifically, it is agreed that the majority of these circumstances fall under the four categories of <em>inheritance</em>, <em>encapsulation</em>, <em>abstraction</em>, and <em>polymorphism.</em></p><ul><li><strong>Inheritance: </strong>If two classes are uniquely created ( class A and class B), the “parent” class can <em>inherit </em>the properties of the “child” class. Such functionality provides “hierarchical classification” and reuse without altering the parent class at the expense of the parent class itself.² Thus, class BMW inherits all the properties (methods, et al.) of its parent class, class Car, by coding class BMW &lt; class Car. Or, class Dog &lt; class Mammal.</li><li><strong>Encapsulation: </strong>Since an class instance is a unique object upon creation, it is important for the instances to <em>encapsulate</em> its internal representation. Or, both the data of the object instance and the functions which act upon the object instance are bundled together in the object instance’s responsible class. Only by writing public “getter” methods may the internal aspects of an object be accessed.</li><li><strong>Abstraction: </strong>Whereas encapsulation bundles data and functions within an object’s respective class, <em>abstraction </em>allows for relevant features to be revealed to the “outside” world. A car, for instance, has microchips, an engine, and many other <em>encapsulated </em>elements which don’t require outside observation or, in most cases, usage. What we see of a car, whether driving it or not, is the abstraction of the encapsulated elements like the onboard navigation screen, etc. Abstraction <em>hides </em>the mechanisms.</li><li><strong>Polymorphism: </strong>Even though a defined class ( class Car, for instance) may have its own methods and usage, class BWM and class Ford are responsible for not only the code in class Car, but also their respective functions and data. class BWM might have a #luxury method, which class Ford would not have. <em>Polymorphism, </em>meaning “many forms,” allows for the classes to take on other forms since each class’s data and function exist within each class.</li></ul><p>Consciousness is always <em>directed</em> at some <em>thing</em>, but this thing need not be a physical entity, like a hairbrush or a chair. We have thoughts, fantasies, ideas, each of which is considered an object in its own right, over and against our conventional wisdom. An idea — the color blue — cannot be held; a mythical creature — a centaur— neither can be held. Or, what’s most important and controversial to many mathematicians, a number, whether real or imaginary, cannot be held, but subsists partially in a Platonic realm of ideal forms.</p><p>Whereas consciousness is always directed at something, what this something is in reality is the <em>object</em>. I believe we tend to view the objects of programming — which we here call, <em>digital objects — </em>as existing somewhere in between objects of the senses and objects of the mind, somewhere between a chair and a thought. But if both the chair object and the thought object are similar in kind, then digital objects must likewise be of the same kind as the chair-thought kind.</p><p>Digging into the philosophy of objects began in earnest with the advent of modern mathematics a little over 100 years ago when the philosopher Edmund Husserl wrote <em>Logical Investigations</em>. Clocking in at 1000 pages, Husserl’s tome is nuanced and chaotic, yet revolutionary for reevaluating what it means when something appears to us in everyday perception and consciousness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j8Ppl6MVUnulWsMRohFzew.jpeg" /></figure><p>Husserl was a contemporary and friend of David Hilbert and Gottlieb Frege, and Husserl’s first book, <em>The Philosophy of Arithmetic, </em>preceded <em>Logical Investigations </em>in both the maturity of thought and its depth. When Frege criticized the previous book for repeating the mistakes made by thinkers who saw logic and mathematics as being “created” by the mind and, therefore, having no universal truths, Husserl reevaluated his position. In doing so, the future father of phenomenology discovered something of a middle ground where the new school of philosophy, phenomenology, need not make sacrifices to thinking about appearances as <em>necessarily </em>tied to Platonic ideal forms.</p><p>According to Plato’s theory of Forms, non-physical “ideas” best represented reality, however much we don’t have access to this reality. Thus, his famous cave allegory: We only have access to shadows of the “real”, not the real itself. Plato’s theory of Forms requires that the “real” be, in fact, the ideal; objects which are perceived or which appear to the individual are not real but mere mimicry of the real, like shadows. We don’t have access to the realm of Forms but through intermediate appearances of the mimicry; the realm of Forms in no way attaches itself to the “physical” realm of “experience.”</p><p>Such a viewpoint, however, denies any possibility of absolute certainty. Partially because of this, Aristotle took exception to Plato’s theory of Forms and leveled obvious criticism against Plato: How could Forms instantiate objects if no correspondence existed between the two realms?</p><p>Many thinkers, scientists, and mathematicians have been bothered by the non-correspondence problem of the theory of Forms, primarily because it demotes objects (whether living or not) to subordinated existence. Though, as humans, we can never experience an object in its totality (some part of an object is always hidden, etc.), we can determine, according to Hegel, the object-in-itself, which is to say its essence. Such an idea came to be imperative for early-20th-century mathematicians, who initiated the modern-day obsession with number theory. Though many mathematicians may take for granted the theory that the “idea” of a number (say, the “idea” of number 1) exists in a Platonic realm of Forms, of sorts, many find this answer to be a non-starter.</p><p>Husserl was most concerned about epistemology, or a theory of knowledge, because many different sciences laid claim in his day to “absolute” certainty, if and only if one followed the respective science’s laws, axioms, and results. Since every science, commonly understood, <em>objectifies</em> what it studies, Husserl became the first great philosopher of the object since a comprehensive, coherent theory of <em>meaning</em> (what knowledge is) relies on a comprehensive, coherent theory of <em>objects. </em>As noted, Husserl is the father of a branch of philosophy called <em>phenomenology</em>. Phenomenology is, simply, the study of appearances: How things appear to us in our experience. And as the epigram to this piece states, consciousness is always attached to <em>some </em>object; consciousness cannot be seen or evaluated <em>purely.</em></p><p>Though the study of appearances may seem naive or misguided, the doubter must ask herself, <em>How does each object that exists in reality appear to me and </em>for me, specifically? How does each object have <em>meaning </em>such that an apple <em>means “</em>apple” to both me and another person? Even still, <em>How do two people both understand to what “the vanquished at Waterloo” refers to</em>, when the name — Napoleon — is not given? <em>How does “the victor at Jena” mean the same thing as “the vanquished at Waterloo”?</em></p><p>Husserl’s expertise in mathematics led him to the mystery of these <em>hows, </em>especially when it comes to the nature of what we might consider “abstract” objects, like numbers or colors.</p><p>OOP’s four above-mentioned characteristics have much in common with Husserl’s theory of the object; in fact, they have much in common with Husserl’s (minor) influence, Aristotle, and his (Aristotle’s) theory of categories. Though both philosophers concern themselves with human consciousness and how consciousness is aware of objects and things, Husserl most explicitly sought to understand “pure” consciousness, a consciousness <em>not </em>occupied with any object whatsoever.</p><p>Nonetheless, everyday, experiential consciousness (our minds and thoughts as we go about our days), is routinely exhibiting the four characteristics of OOP in order for consciousness (or, the person) to comprehend its (or, her) reality. We pass seamlessly between the sidewalk on which we are walking and our thoughts or concerns at any given moment while walking on the sidewalk; we hypothesize and problem-solve a difficult problem at work or in our free time while playing a game, focusing on more general (or, <em>abstract</em>) circumstances which relate to the problem at hand; we understand how a wolf relates to a dog, or a semi-truck to a van, simply because we understand the idea of similarity (or, <em>inheritance</em>). And, as the encapsulation bullet points to, we understand the example of the car and its microchips <em>because </em>we naturally understand <em>encapsulation</em>.</p><p>Though this is in no way meant to be a comprehensive essay on either OOP or a theory of objects — whether related to the “object” of OOP or not — redefining our understanding of what constitutes an “object” aides our understanding of the “mystery” of digital objects and how they interact. It is a stretch of the imagination to entertain the thought that a digital object — like an instance of the NewObject class, could be considered in the same object category as a physical chair in the real world. But doing so allows for a more comprehensive understanding not only of objects, in general, but how consciousness <em>grasps </em>reality and everything around it and inside of it.</p><p><em>Footnotes</em></p><ol><li>Bill Curtis, “Objects of Our Desire: Empirical Research on Object-Oriented Development,” in <em>Human-Computer Interaction</em>, v. 10, 1995.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ca96da47905" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>