<?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 Mahati Meeru Nilaya on Medium]]></title>
        <description><![CDATA[Stories by Mahati Meeru Nilaya on Medium]]></description>
        <link>https://medium.com/@mahatimeerunilaya?source=rss-b056eedd2eb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ApcgjNOfmu0TWSCz.</url>
            <title>Stories by Mahati Meeru Nilaya on Medium</title>
            <link>https://medium.com/@mahatimeerunilaya?source=rss-b056eedd2eb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 03:52:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mahatimeerunilaya/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[JS packages: A Survey Part I]]></title>
            <link>https://medium.com/@mahatimeerunilaya/js-packages-a-survey-part-i-41de5c5ea04?source=rss-b056eedd2eb------2</link>
            <guid isPermaLink="false">https://medium.com/p/41de5c5ea04</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[node-packages]]></category>
            <category><![CDATA[yarn]]></category>
            <dc:creator><![CDATA[Mahati Meeru Nilaya]]></dc:creator>
            <pubDate>Fri, 30 Nov 2018 17:00:06 GMT</pubDate>
            <atom:updated>2018-11-30T17:00:06.044Z</atom:updated>
            <content:encoded><![CDATA[<p>What are javascript packages? As a developer I used packages willy-nilly within my javascript code knowing they <em>did something.</em> I vaguely grasped that these packages enabled the various libraries I wanted to incorporate into work to actually get embedded within my code. I understood that a package manager of some sort was required to shepherd these packages into the code. I even knew that I needed to, from time to time, like flowers in a garden, tend to these packages by updating them — again via the magical package manager. But what exactly makes up an individual package? What does it consist of? Why does crazy world of javascript require these packages? What, in essence, <em>is</em> it?</p><p>A <strong>package</strong> is a little collection of software and data stored in <a href="https://en.wikipedia.org/wiki/Archive_file">archive files</a> as a single entity- a packet or package. A single package contains basic information (metadata) such as name, version number, vendor, description and purpose. A package also typically includes a list of all the dependencies (<strong>dependencies</strong>: other things a package needs that it doesn’t have) required run its’ software. The point of a package is so that an application can have a reusable block or library of code that does not impact other chunks of code. Packages are usually publicly available, sharable through online repositories, and are often build to be reusable chunks of code that developers can incorporate into their projects.</p><p>A <strong>package manager</strong>, like the name denotes, manages packages. More specifically, it is a system that takes care of the installing, upgrading, deleting, and managing of various packages. Package managers are crucial because while installing a package may be straight forward, keeping track of all the dependencies each package may have, and when they need to be upgraded can get pretty complicated.</p><p>Say you’re building a project that needed to install a gandalf package to make certain sections of your project impassable. BUT the gandalf package has a dependency of a hobbit package and requires gandalf-the-gray package. Meanwhile your project also required an aragorn package that had a dependency of gandalf-the-white which is different version of gandalf-the-gray. Additionally the aragorn package also needed a hobbit version 4 package as well. Already with this simple example the dependences, the way they are interconnection and the versions of each package you might need had gotten crazy. (Fun Fact: You would need both gandalf-the-gray and also grandalf-the-white to make both your gandalf and aragorn packages properly run)</p><p>Thankfully, installing a decent package manager would take care of most of this via automating through simple commands updates and additions of extra dependencies. Additionally, when working on a project across a team, package managers help make sure that everyone has the same version of packages. Finally, most package managers even have easy and automated tools to allow you to create your <em>own</em> packages! (ex. <a href="https://yarnpkg.com/lang/en/docs/creating-a-package/">create your own yarn package</a>!)</p><p>But packages and package managers don’t live as agnostic, free-range, entities in the wild, happily grass-fed until they are randomly incorporated into projects. Packages at the end of the day, need to be able to <em>run</em> within your program. As a result packages are categorized by the <strong>runtime environment</strong> they are written for. The most prevalent runtime environment for javascript projects is <strong>Node.js</strong>. (There are others, but as Node is the most pervasive, this post will use Node as the primary example.) In short, the Node.js run-time environment includes everything you need to execute and <em>run</em> a javascript application. (Long form explanation would require another post)</p><p><strong>npm</strong> is the node package manager meaning it manages node packages — i.e. packages that were built to be compatible with Node and adhere to Node’s structure. There are, of course, other types of package managers such as yarn (similar to npm and utilizes the same registry and structure as npm), deno, bower, gulp, etc. While they all manage packages, the way in which they do so is slightly different and its important to make sure that the package manager is made for the types of packages the runtime environment requires.</p><p>Where do packages live after they have been installed? So now that we have a basic idea of what a package is, does and how its managed- where do these things live when they are installed into a project?</p><p>First, to enable proper installation of node packages, a project requires a <strong>package.json file</strong>. At first this file just seems like a location to list all the node packages that were installed. But in fact, every package requires a package.json file. The package.json file often contains metadata about the package itself and information about dependency handling . In theory every single installed package could have <em>their own</em> package.json containing only their individual information. But that of course, would be a hot mess to read through, so compiling the information about all the packages into a single package.json file that sits at the root level is best.</p><p>Next, you’ll notice that after installing a package, its not always super evident what was installed outside of some minor updates to the package.json file. Unless a user specifies a global installation, package managers a <strong>node_modules folder</strong> at the root level to throw all the package files into. If a package is being installed to use <em>in</em> your program, installing it locally at the root of your project is best. This enables you to pull in the package code you need with require(the stuff i need) or import the stuff i need or import * from the stuff i need. But say you want to use something in your <em>shell</em> or maybe within your terminal in the command line; here its suggested to install the package globally. Most of the time a local installation is recommended.</p><p>In Part II I’ll explore node_modules a bit further. Specifically, how the code within them is parsed and start discussing how build packages like Webpack actually build and what they are building!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41de5c5ea04" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Roman Numerals Kata]]></title>
            <link>https://medium.com/@mahatimeerunilaya/roman-numerals-kata-a53725e05996?source=rss-b056eedd2eb------2</link>
            <guid isPermaLink="false">https://medium.com/p/a53725e05996</guid>
            <category><![CDATA[rspec]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[code]]></category>
            <dc:creator><![CDATA[Mahati Meeru Nilaya]]></dc:creator>
            <pubDate>Mon, 09 Jan 2017 09:08:14 GMT</pubDate>
            <atom:updated>2017-01-18T06:24:54.145Z</atom:updated>
            <content:encoded><![CDATA[<p>detailed explanation of testing and logic</p><p>I recently completed a coding kata for an organization. I hope to detail and outline my thought process and the steps of how I completed the kata in a manner that enables even those new or unfamiliar to programming easy understanding.</p><p>(Please feel free to message me if you feel I should further breakdown terminology, logical leaps, and/or concepts!)</p><p>What: A coding Kata is a programming exercise that enables one to fine tune their programming skills via repetition and practice.</p><p>The Roman Numerals Problem: Write a program that can take in Arabic numbers as input and output their Roman numeral equivalents.</p><p>The coding kata asked that this problem be solved following TDD methodology and therefore wanted fully articulated tests to guide and accompany the ‘main’ program code. For further explanation of TDD and how it works check out my series on testing <a href="https://medium.com/@mahatimeerunilaya/aristotle-quality-is-not-an-act-it-is-a-habit-part-i-dc7ebf5cd276#.cernve2ko">here.</a> I decided to solve this kata in Ruby. I may attempt to redo it with Python which I will detail later.</p><p>For beginning programmers, getting a problem like this is often intimidating, as the mind jumps to trying to figure out how to solve the entire problem as effectively as possible. Roughly a year ago, <em>any</em> coding challenge caused a surge in anxiety as my mind frantically attempted to flip through <em>the answer. </em>Fortunately, the Test Driven Development methodology helps here as it forces us to slow down, break down the problem (however simple it may be) into smaller more manageable pieces, and take it one step at a time. So first before we ‘put pen to paper’ it is important to really understand and break down the problem being asked into various questions and ‘what ifs’. I take a bit of a leap here and skip a little syntax and code convention to delineate the various questions.</p><ul><li>Our code needs to have a method</li><li>This method takes in a ‘normal’ number</li><li>This method translates the normal number into a Roman Numeral</li><li>input: 5 should result in an output: V</li></ul><p>Now we could go ahead and write def method_name for our program. However in order to stick to TDD we want to make sure we don’t write any executable code until we have written a test for it. I like to think of writing tests as a sort of scientific method. We want to be able to make sure that someone can ‘repeat this experiment’ in the same exact way via just the instructions (the tests). So lets go ahead and set up our rspec test to have a method called convert. Lets say this method takes a argument of 0 and for now, lets have this method return a string “Yay A Method Exists!”</p><pre>describe method do<br> it &#39;should have a method named convert&#39; do<br>     expect(convert(0)).to eq(&quot;Yay a Method Exits!&quot;)<br>    end<br>  end </pre><p>We want the test itself to guide the building so pretending we haven’t just written this test lets run the test to see what it tells us. When we run the spec in our terminal we get an undefined method error. So now that we have actual instructions telling us that a method called ‘convert’ does not exist, we can go ahead and write def convert() .</p><p>We could run the specs again and we would get another error telling us that this method does not have the right number of arguments and/or that it is not returning what it should. However I am going to make a small logical leap here and assume that we can in one go write the full convert method to satisfy the terms of the test.</p><p>Yay! We have a method and it takes in an input and returns an output! Now lets get to solving the actual problem asked! Even if you have no idea how to solve the actual problem and/or what the ‘pattern’ or algorithm is you can still get the right answer if you follow TDD.</p><p>In introductory algebra it is always safer to have some sample numbers to run through your equation to check your solution and make sure your answers are consistent. We should do the same things for code and helpfully rspec is built in such a way to help us with our ‘sample’ inputs and expected outputs. (Rspec literally uses a built in method called expect() to help guide us in this!) For this method lets think of some sample numbers, or constants, to test with.</p><p>1, 2, 3, 4, 5,…etc Hmmm are the numbers 1–10 really ALLLL needed? There is literally nothing wrong in setting aside 1–10 as test constants. But for now lets just take one constant at a time and start with 1. We know 1 should output ‘I’ so we can add this test to our spec file.</p><pre>it &quot;converts 1 to I&quot; do<br>  expect(convert(1)).to eq(&quot;I&quot;)<br>end </pre><p>(if for whatever reason we have no idea about Roman Numerals we can literally google ‘what is 1 in Roman Numerals’ )</p><p>Run this test. It will fail because currently our def convert() only returns &quot;Yay a Method Exists!&quot; Since our failing test tells us that the method needs to return an “I” we simply rewrite our method to do that!</p><pre>def convert(arabic_number)<br>  return &quot;I&quot;<br>end </pre><p>Now we run the test again and it should pass. We can now write another test for a different number. Lets take the number 5. We could take the number 3 or 4 or even 7. However we want to do the ‘easy’ things first. Say we wrote a test for 2 that was almost the same as the test we wrote for 1, we would quickly deviate to another issue with our code that might take us longer to work through. We don’t want ‘hard’ right now we want to work through all the ‘easy’ tests first! So lets test with the number 5.</p><pre>it &quot;converts 5 to V&quot; do<br>  expect(convert(5)).to eq(&quot;V&quot;)<br>end</pre><p>The test for 5 looks almost exactly like the test for 1. Thats…not so good because we don’t want a ton of code that is repetitive! But before we fix that lets go ahead and run the test. We were expecting a ‘V’ but we only have a ‘I’ How do we fix this? Remember, we also want the previous 1 test to still be passing! We fix this by adding a conditional gaurd to our returns. IF the input argument is 1 then we want the ‘I’ but if its 5 we want the ‘V’</p><pre>def convert(arabic_number)<br> return &quot;I&quot; if arabic_number == 1<br> return &quot;V&quot; if arabic_number == 5<br>end </pre><p>If we run our tests again we should have both of them pass. Note: I made a small code syntax awareness leap here again. We could have written an if-else statement instead of adding a conditional gaurd but that is less elegant. Now if we look at our convert method and also our tests for 1 and 5 we will notice that a lot of things look the same. If we think a little about other numbers we might want to write tests for…it looks like we would write them in almost the same way! This is usually a sign that the code can be reconfigured to avoid repetition.</p><p>So lets rewrite our tests to avoid the repetition. A good way to organize associated data is via a hash. We know that each constant (arabic number) we are testing will have an associated output. So lets build a hash with our test inputs and outputs and loop the testing block through that!</p><pre>TESTNUMS = { 1 =&gt; &quot;I&quot; , 5 =&gt; &#39;V&#39;}</pre><pre>TESTNUMS.each do |arabic_number, roman_numeral|      <br>  it &quot;converts #{arabic_number} to #{roman_numeral}&quot; do<br>   expect(convert(arabic_number)).to eq(roman_numeral)<br> end<br>end </pre><p>Lets run this test. Yes it is simply a refactor of the two tests we wrote before but we ALWAYS want to keep running our tests to check! Say we made a syntax error or a large logical fallacy that resulted in our refactor failing. Running the test will help us immediately catch any issues. Assuming our 1 and 5 tests still pass we can move on to the next step.</p><p>For our next test lets pick the number 2. I am picking two because we already have a 1 test that passes and it seems logical to go up in the number line. I am also picking the constant 2 because I know that the roman numeral for the constant is ‘II’. This roman numeral looks suspiciously like the roman numeral for 1. In fact it is simply two roman numeral 1’s put together!</p><p>Why aren’t we simply adding 2 =&gt; &#39;II&#39; to our test hash and then simply adding return &#39;II&#39; if arabic_number == 2 ? We could. We could go through the testing cycle all the way through until we have a large test hash of numbers from 1–10 and a very large and ugly convert method. However say we tried to test for a number outside 10. Say we tested for 2222. Then because we essentially hard coded our method, our test would fail and we would have to rethink our entire method to fix it. So before we plunge into a repetitive and problematic plug and chug solution. Lets add the constant 2 to our test hash and see what happens.</p><p>Our test should fail. So how do we write code that doesn’t look exactly like the other lines in our convert method? As I mentioned before, the ‘II’ looks actually like two ‘I’ , as in two representations of 1. If we think about the other numbers we would want to test we see this idea repeating. A 3 is <em>three</em> repetitions, an 8 is a ‘V’ and then three repetitions of ‘I’! So we can do some recursive addition with our code. We can create a ‘II’ output in the following way:</p><pre>def convert(arabic_number)<br> return &quot;I&quot; if arabic_number == 1<br> return &quot;V&quot; if arabic_number == 5<br> &quot;I&quot; + convert(1)<br>end</pre><p>If we run our tests again this should pass. But now we have added 3 =&gt; &#39;III&#39; to our test hash and this test fails. It seems problematically repetitive to add:</p><pre>&quot;I&quot; + convert(1) + convert(1)</pre><p>or even</p><pre>&quot;II&quot; + convert(1)</pre><p>This type of code isn’t sustainable.</p><p>So we have to think of a way to expand our original solution to account for any roman numeral that is in some way an “expansion” of ‘I’. It may take a while to think about a solution that works for more than one number and taking time at this step of the game is completely fine! Tinkering with the code of our convert method is also fine. (It is even totally normal to suddenly erase all the code and attempt to rewrite a nice method. We built this method using a very pragmatic testing methodology and therefore <em>should</em> we break things we still have the gaurd-rail of the tests we wrote to help us get back on track)</p><p>We can tackle any ‘I’ based roman numeral with the following recursive code line in our convert method:</p><pre>&quot;I&quot; + convert(arabic_number - 1)</pre><p>This line does following when it is passing our 3 test. As it is not 1 or 5 the above line operates and results in &quot;I&quot; + convert(2) which of course, runs through the above line again resulting in essentially this: &quot;I&quot; + convert(1) Hint: remember those f(g(x)) type problems back in algebra. This is basically a version of that except its f(f(x)). Taking this logic through our previous numbers we can now delete the line of code we originally wrote to get our 1 test to pass. If we run our tests again we should still have all passing tests! (At any point if the tests suddenly stop passing it is the moment to STOP and fix the code until the tests are passing.)</p><p>Now lets add 4 to our test hash. When we run the test we get a failing test because the roman numeral for 4 is <em>not </em>‘IIII’ but ‘IV’. (Ugh. Romans) We can theoretically get the 10 test to pass in the same we are currently getting the 5 test to pass. But that does not help us when we eventually have to add say, 40.</p><p>So at this juncture for the sake of…brevity I’m going to go ahead and add other numbers that deal with 4 such as 40, 400, 4000, etc. I am also going to at 9 to our test hash because I know that we will run into the same problems with 4 as we will with 9. This is NOT the way to do it. You’re supposed to figure this 4 business out, get the test to pass and then jump to the next number and then semi-organically discover that any test for 9 and 9 related numbers will have similar issues. I am adding all the above mentioned tests at once because it would be a veeeeerrry long blog post if I went through all the tests like that.</p><p>Figuring out how to consistently convert numbers such as 4 and 9 is, in my opinion, the true challenge element in this kata. Below is an explanation of my trails with it.</p><p>My first thought when solving this particular issue was to somehow organize the roman numerals using our more rational base ten system. Could I somehow create an array that had a ones, tens, thousands place and so on that parsed the arabic number by digit? A base ten system combined with making all my numerals arrays didn’t quite pass all my tests. The solution semi-worked for large numbers but still left me failing the tests for 4, 9, 40, 90, etc. (Ugh. Romans)</p><p>Noticing that my failing tests were clearly related, I simply hard coded in outputs for all 4 and 9 related numbers. My tests passed! I deleted the crazy amount of code I had written that attempted a base ten system and ran my tests again. All my tests were still passing! I added a few more base ten numbers to my test hash (100, 1000, etc) and went through the process again and all my tests were still passing! But I knew I wasn’t finished. My code looked rather ugly and had a lot of repetition:</p><pre>def convert(arabic_number)<br> return &quot;V&quot; if arabic_number == 5<br> return &quot;IV&quot; if arabic_number == 4<br> return &quot;IX&quot; if arabic_number == 9<br> return &quot;X&quot; if arabic_number == 10<br>#### I had the same line repeating for 100, 1000, 50, 500, 40, 90, 400, and 900 ### </pre><pre> &quot;I&quot; + convert(arabic_number - 1)</pre><p>How could I get rid of my 16 lines of super repetitive code? Well I took a step back from the problem and looked at what these lines of code were actually doing. They were simply associating a constant to a string. Hmmm don’t hashes do exactly that? Associate data in a structured way? I reconfigured my code to be a large hash that associated constants to a string that I could iterate through.</p><p>Each key-value pair was a arabic number and roman numeral. I needed to find the associated roman numeral(that value) of the arabic number (the key) in my hash that was either the SAME as the input or LESS than the input. I had to add a less than because I want five ‘V’ when I have 5 but ‘I’ when I have 3 or 2 or 1. As I was verbalizing what I needed to do, I was using the term find… which resulted in the natural use of the find enumerable.</p><p>Once I <em>found</em> the value of the correct key, I would want to store it as a variable. I would either use this variable in my recursion line from before to add to my roman numeral (like in the case of a number like XII) or have it exist alone.</p><p>Thinking I found my solution I ran my tests.</p><p>My tests failed.</p><p>I spent a very long time attempting to figure out why my test was failing. I couldn’t get my traditional Hash to work. I have since realized that it was a small syntax issue with my iterator. I was so intent on my hash that I couldn’t ‘see the forest from the trees’ and so did not realize! This happens sometimes. I then rewrote my hash as a 2-d array. During this reconfigure, I realized that I had also not inserted in the variable I was now storing the <em>found</em> roman numeral in into my recursive line…which is kind of key.</p><p>I was lucky, and from the get-go my key values went in descending order. However if they had not and I started with [1, &#39;I&#39;] I would have run into trouble with my enumerable.</p><p>finally my code looked a little like this: (for reasons of the medium blog formatting and aesthetics I did not add all the test numbers in my 2d array)</p><pre>def convert (arabic_number)<br>  ##return &quot;V&quot; if arabic_number== 5</pre><pre>num_key, numeral_value =  [[5, &#39;V&#39;],[1, &#39;I&#39;]].find {|num_key, numeral_value| num_key &lt;= arabic_number}</pre><pre>numeral_value + convert(arabic_number - num_key)</pre><p>I ran my tests. EVERYTHING PASSED!</p><p>Unfortunately even we get to this point in the kata we are not done. There are some p’s and q’s to round out. First, the convert method is doing a ton of things. It is good design to separate concerns and have methods (or other organizing structures such as classes or modules etc) be responsible for a single thing. I wrote some ‘helper’ methods and some new variables. I moved my 2D array into a constant so that I could move its bulky presence out of my methods and simply call on it instead. I then wrote a method that took on the job of working through the 2D array and finding the appropriate value. This method would be called inside the convert method. I ran my tests and fortunately everything still passed! I now had clean, easier to read code that was far more elegantly designed!</p><p>One final caveat: The first test I wrote when solving this kata was actually the ‘nothing test’. In this post to get the original method structure set up we wrote a silly sort of test to help illustrate TDD. However the nothing test is a more professional route. Most formally called the degenerate case, this tests for a functionally non existent input. In this particular problem this would be an input of zero. The Hindu concept of Zero did not penetrate Roman mathematics and therefore Roman Numerals did not encompass a representation of nothing the way our modern day Indo-Arabic numbers do. Therefore it is prudent to write a test for 0 input. This test could be as simple as:</p><pre>it &quot;converts 0 input to an explanation statement&quot; do     <br>  expect(convert(0)).to eq(&quot;Romans Couldn&#39;t Comprehend Zero&quot;)    <br>end</pre><p>By adding the following line to the convert method, the above test will pass.</p><pre>def convert(arabic_number)  <br>  return &quot;&quot; if arabic_number.zero?<br></pre><p>The final result of my kata can be found<a href="https://github.com/mahatikg/indoarabic_number_conversion"> here</a>. There are of course, other ways to solve this kata. An interesting exercise might be to attempt to solve this kata using principles of OO instead of rather low level Ruby code!</p><p>I strongly urge those who may be weak in a particular testing framework to use coding katas as a means to further practice and refine their skills!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a53725e05996" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[art&code]]></title>
            <link>https://medium.com/@mahatimeerunilaya/art-code-95e1fe0435d8?source=rss-b056eedd2eb------2</link>
            <guid isPermaLink="false">https://medium.com/p/95e1fe0435d8</guid>
            <category><![CDATA[museums]]></category>
            <category><![CDATA[art]]></category>
            <dc:creator><![CDATA[Mahati Meeru Nilaya]]></dc:creator>
            <pubDate>Wed, 28 Dec 2016 04:44:45 GMT</pubDate>
            <atom:updated>2016-12-28T04:44:45.027Z</atom:updated>
            <content:encoded><![CDATA[<p>web development is changing the art landscape</p><p>I spent the first four years of my career working in some collaboration of archaeology, academia, art history, and museums and galleries. This is not a space many web developers and tech-facing industries think of when discussing their craft.</p><p>And yet this is the space that created within me, a desire to <em>build-</em> pushing me to learn code. The art and museum world is an emerging space for creative, fun, and radically game changing products chock-full-of possibilities for arts-invested web developers. There are so many dimensions in which web development is already affecting how artists produce and disseminate work.</p><p>Animators now use highly complex software to build magical worlds and model realistic movement and texture to things like hair, water, and skin. Hundreds of creative art projects populate <a href="https://www.behance.net/search?field=122">Behance</a>, contributions ranging from visual art, to dance, and music. For example, one Brooklyn based artist, who is a conservator as a day job, uses webGl to create recreations of ceramic shatter patterns for her presentational art pieces.</p><p>In the world of museums, mobile apps have become a new avenue by which museum-goers engage with content, programming, and education. Two years ago the Metropolitan Museum of Art debuted their <a href="https://play.google.com/store/apps/details?id=org.metmuseum.android.met">mobile app</a>. In addition to providing content and feature exhibition information for local audiences, the mobile app added a cultural perusal element- drawing non-art enthusiasts to engage in art the same way they parse through their facebook feed. Other museums too have utilized mobile and web apps to dynamically engage with viewers. The Freer | Sackler Galleries of the Smithsonian, which host Whistler’s Peacock Room, provide ipads for their visitors to engage interactively with the multi-faceted room on their <a href="https://itunes.apple.com/us/app/peacock-room-comes-to-america/id671150763?mt=8">Peacock Room App</a>. Meanwhile, the Van Gogh Museum in Amsterdam has enabled conservators to share their side of the art narrative. Their in-museum app that lets visitors scan an their phone over certain paintings so that they can glimpse the layers underneath the final product and the history of the artists attempts.</p><p>Meanwhile for profit companies, mainly Google, have also sought to bridge the divide between art and tech. In collaboration with London’s Barbican Center, the company launched <a href="https://devart.withgoogle.com/#/project/17830303?t=featured">Google DevArt.</a> The initiative invites artists to code a piece of art in an effort to show that code in itself can be art. One featured project involves a massive keyboard that pulls various sound-related API’s. Press a note on the keyboard and sample real-time notes from radio stations around the world. Another project, utilizing digital image processing and AI works to crowd source collaborative painting projects via continuously painting robot!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95e1fe0435d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Aristotle: Quality is not an act, it is a habit | pt.1]]></title>
            <link>https://medium.com/@mahatimeerunilaya/aristotle-quality-is-not-an-act-it-is-a-habit-part-i-dc7ebf5cd276?source=rss-b056eedd2eb------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc7ebf5cd276</guid>
            <category><![CDATA[rspc]]></category>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Mahati Meeru Nilaya]]></dc:creator>
            <pubDate>Sat, 26 Nov 2016 20:02:02 GMT</pubDate>
            <atom:updated>2016-12-26T22:51:51.433Z</atom:updated>
            <content:encoded><![CDATA[<p>TDD, Frameworks, and doing it right!</p><p>Testing is an essential part of the software development process. Test Driven Development is pretty much ubiquitous in the community and considered a healthy part of the development process.</p><p>But before one can speak in-depth about various test frameworks, what they do, and how they work, there are some big vocabulary terms to get familiar with.</p><p><strong>Test Driven Development</strong> (Commonly referred to as TDD) : The idea that tests that check for behavior; particularly tests written to fail if certain conditions and behaviors are not met by the code, are written <em>before</em> the product code is written.</p><p>Think of a mediocre composer writing a score and playing back music she writes, checking key and pitch every couple bars before writing a new line. It is much much harder to write four sheets of music, find that 70% of it is off key and grating, and <em>then</em> try to fix it- than going line by line. Additionally, its very likely that the bars <em>as they are fixed</em> are less likely to fit with the theme and tones of greater piece.</p><p>Test Driven Development enable a sort of development outline for projects, more discretely than the greater outlines provided by user-stories or a wireframe.</p><p><strong>Specs </strong>(Short for Specifications) : This one is relatively obvious but its always good to clarify as this term is thrown around a lot. Specifications, or specs in most industries, are used to describe the details of a particular kind of machinery, object, building, or site. The specifications of ‘what’ often various based on industry or field. For example, in my life as an archaeologist ‘site-specs’ referred to cartographic and historic details of the field-site and not, say the specifications of a construction site.</p><p>In web development the term ‘spec’ comes from TDD ideology and refers to the specifications that are written (as tests or otherwise) to describe and delineate the behavior of what a piece of code does.</p><p>I have heard the term tests and specs used interchangeably. In some programming languages like Ruby, this slight difference in parlance doesn’t have a realized difference in meaning or function. However in some languages like Java, there is a distinct semantic difference between tests and specs. I will not go into the reasons for distinguishing tests from specs, they can be found <a href="https://sites.google.com/site/unclebobconsultingllc/specs-vs-tests">elsewhere</a>. But in a nutshell, tests tend to check the exact functional output of a piece of code, (much like a boolean test) whereas specs tend to check behavior.</p><p><strong>Rspec- a Ruby Testing Library</strong></p><p>Rspec is one of the more popular testing libraries used to test Ruby code. Rspec is simply ruby code with the addition of some specialized methods to assist in testing. Requiring the rspec library enables access to the distinct methods the library holds.</p><p>As this is an intro-level survey into testing frameworks, I won’t delve into how exactly this library runs and what is happening under the hood of these new methods. This can be found <a href="http://interblah.net/how-rspec-works">elsewhere </a>and is far easier to understand <em>after</em> a good awareness of how rspec works.</p><p>Rspec tests behavior, and it does primarily by using a describe block. This is one of those special methods that we have access to with this library. Typically, inside this block the tests for distinct behavior, i.e. the behavior one is testing for or setting up the architecture for, are delineated using the it block. For example:</p><pre> describe Hash do<br>   it &#39;should return an empty hash&#39; do<br>      hash.new.should == {}<br>     end<br>end</pre><p>The <em>thing</em> whose behavior we are testing is the Hash via the describe block. The behaviors themselves, as in, the distinct behaviors we are testing for are delineated by the it block.</p><p>Say I wanted my code to eventually create a Hash called ice_cream. In addition, I wanted ice_cream to have key values of waffle_cone, sugar_cone, and cake_cone. Next I wanted each of these key to point to a different flavor as their values. So in effect I would want my Hash to look like the following:</p><pre>ice_cream = { waffe_cone : &#39;chocolate&#39;,<br>              sugar_cone : &#39;vanilla&#39;,<br>              cake_cone : &#39;mint-chocolate-chip&#39;<br>             }</pre><p>How would this translate into an rspec test? Assume I am not in the room of someone else writing code to show them my idea and explain. I also want to write my tests in a way that the web developers can recreate my hash piece by piece and make sure each step is correct. The thing whose behavior we are testing is the Hash called ice_cream. If we break that down a little more we can say that ice_cream should BE a Hash. Therefore ice_cream is the thing we are describing</p><pre>describe ice_cream do</pre><p>What are the behaviors and attributes ice_cream should have? It should be</p><ul><li>a Hash</li></ul><pre>describe ice_cream do<br>  it &quot;should be a hash&quot; do <br>   Hash.new.should == ice_cream</pre><ul><li>ice_cream needs to have at least three key’s</li></ul><pre>describe ice_cream do<br>  it &quot;should have three keys of &#39;waffe_cone&#39;, &#39;sugar_cone&#39;, &#39;cake_cone&#39; &quot; do <br>   ice_cream == Hash.new({ :waffle_cone, :sugar_cone, :cake_cone})</pre><p>I did not put in this test the values for the distinct keys. Say later down this hash was actually being used for a program that would later assist in inventory for an ice cream shop?</p><p>What if that shop had different flavors than I had imagined. Or more likely, that shop had a hundred flavors that could be served with the different type of cone. Wouldn’t that change the data structure of this hash?</p><p>It would make more sense then to have each of these keys pointing to values that were <em>arrays</em> of ice cream flavors. If I had written my test above to include both the keys and the values, then further down the line I would have had to rewrite my test completely. Additionally, developers later on would have followed my specs and then had to completely restructure their hash. Instead of I break down my tests to be written behavior by behavior (however small), I have longer lasting more flexible specs!</p><pre>describe ice_cream do<br>  it &quot;should have value of &#39;chocolate&#39; for :waffle_cone&quot; do <br>   ice_cream == Hash.new({ :waffle_cone : &#39;chocolate&#39;, :sugar_cone, :cake_cone})</pre><pre>it &quot;should have value of &#39;vanilla&#39; for :sugar_cone&quot; do <br>   ice_cream == Hash.new({ :waffle_cone : &#39;chocolate&#39;, :sugar_cone :      &#39;vanilla&#39; , :cake_cone})</pre><pre>it &quot;should have value of &#39;mint-chocolate-chip&#39; for :cake_cone&quot; do <br>   ice_cream == Hash.new({ :waffle_cone : &#39;chocolate&#39;, :sugar_cone :      &#39;vanilla&#39; , :cake_cone : &#39;mint-chocolate-chip&#39; })</pre><p>notice all the tests within the it block are nested under the describe block. This way the tests can evolve and change overtime and are neatly organized under the main <em>thing</em> they are testing the behavior for!</p><p>Running this spec file will output a list of descriptive statements and failing tests. Specifically all the statements we wrote after the it These should statements read like a list of instructions and/or ingredients for our Hash object. These failing test statements will guide a developer to build a hash to the specifications we described via our tests.</p><p>The first failing test would be:</p><pre>describe ice_cream do<br>  it &quot;should be a hash&quot; do <br>   Hash.new.should == ice_cream</pre><p>What does this mean? That a new hash set to the variable ice_cream should exist. As the developer reads through the tests and gets them to pass, ice_cream will come to look exactly as we described!</p><p>This is how rspec runs and is used to write tests and build specs!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc7ebf5cd276" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Big Diff]]></title>
            <link>https://medium.com/front-end-weekly/big-diff-5ec87784e1e8?source=rss-b056eedd2eb------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ec87784e1e8</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[art]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Mahati Meeru Nilaya]]></dc:creator>
            <pubDate>Tue, 25 Oct 2016 17:45:19 GMT</pubDate>
            <atom:updated>2016-11-08T19:08:03.515Z</atom:updated>
            <content:encoded><![CDATA[<h3>Diff algorithms: History &amp; Functionality for Newbies</h3><p>A diff algorithm is basically a way to compare two disparate sets of data and turn data A into data B. The driving aspect of many programming languages and more recently, many front-end based user-interface libraries.</p><p>A diff algorithm is not a singular unique entity. The algorithm itself probably consists of some combination of lower order sorting and comparing mechanisms many programmers, statisticians, linguists, poets, musicians, and mathematicians are familiar with. A diff algorithm could even use something as basic as a bubble sort, some sort of find method and some sort of delete method!</p><p>There isn’t any singular ‘true’ diff algorithm or the ‘best’ diff algorithm. There are simply really good ones and ones that are rather slow and bad. (The bubble sort involved would probably rate in the later category) There are hundreds of diff algorithms though the ones that frameworks like ReactJS utilize are incredibly versatile, fast, precise, and generally considered the ‘presiding’ algorithm.</p><p>A bit of History &amp; Vocab</p><p>Edit Distance: <br>The number of “moves” it takes to convert one string into another. <br>Converting &quot;Bad&quot; into &quot;Mad would have a very short or low Edit Distance. Presumably this would simply require the deletion of the &#39;B&#39; and insertion of an &#39;M&#39;. <br>But converting &quot;Post-Colonialism&quot; into &quot;heteronormativity&quot; would have a long or high Edit Distance.</p><p>In programming this algorithm that calculates the edit distance between two strings is <em>usually </em>called the Wagner Fisher algorithm but…its been invented by tons of people across the world at different times so its really rather <em>colonially-appropriationist</em> to give it singular naming rights.</p><p>So what does this matter?</p><p>Well, back in 1976 the first diff algorithm paper in computer programming was published for Unix. This was considerably faster than the “Wagner Fisher algorithm” and could be used for more than simple strings. This didn’t just calculate the Edit distance between two strings but went on to make the conversion in that optimal number of moves! Exciting! This algorithm, called the Hunt-McIlroy diff was a godsend to then slowly emerging field of biotech, particularly in DNA sequencing and comparisons.</p><p>Textbooks before this period <em>probably</em> couldn’t have fun facts like what percent of our genome is exactly the same as various other animals!</p><p>Modern Diffs &amp; ReactJS</p><p>The diff algorithm utilized by ReactJS does far more than compare and sort through two different strings. The algorithm governing this framework is utilized so that changes to the DOM are made incredibly efficiently and with distinct precision.</p><p>Say a team of provenance researchers and non-shitty Dan Brown type art historians wanted to pull off the biggest art heist ever and convert a painting <em>in the school of Peter Paul Rubens </em>into a true <em>Rubens </em>painting<em>. </em>Think of of the DOM as<em> </em>the<em> school painting of Daniel and the Lion’s Den</em> and not Ruben’s actual original.</p><p><strong>School Painting</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*Ln4HK452kliGrMsC.jpg" /></figure><p><strong>Original</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/0*MBy-LY0VVFMRD1Ql.jpg" /></figure><p>Obviously we need to change Daniel, some of the expressions on the faces of the various lions and some overall positioning. Deleting Daniel, the faces of the lions, and other smaller elements would potentially be catastrophic as we might not be able to imitate the style well enough again! Also…it would take AGES!</p><p>With a framework like React, we can pinpoint the exact things we need to change:</p><ul><li>the positioning of Daniel’s hands</li><li>3 faces of lions, particularly their jaw and brow structure</li><li>the light from the cave</li></ul><p>and modify ONLY those elements.</p><p>How does React DO THAT?</p><p>Magic.</p><p>(Mostly, in a math sense)</p><p>So this is not a React tutorial. That may happen…later. Instead, what is being asked is — How does the algorithm governing React work well enough that, given good structural organization by the developer and actual directions, the algorithm is able to scalpel and change these very distinct features of the DOM?</p><p>To go back to the Ruben’s example, lets assume that both the actual artist, Peter Paul Ruben, and our imitator painted the various elements of the painting in layers (like the layers of color in <a href="http://www.metmuseum.org/toah/works-of-art/59.160/">Homage to the square</a>) <br>If we convert these layers into more easily accessible graphical info, they would look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/0*6F6UQpCNdRrhrfEl.gif" /></figure><p>Lets say that the figure of Daniel is on the second level, a parent, and the distinct faces of the lions are on the 3rd level, children.</p><p>React uses a tree edit distance algorithm, a tree alignment distance algorithm, and a tree inclusion algorithm to grab Daniel in the parent level and the lions on the child level and swap them out with the corresponding from the true painting!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/0*G4J4W0e5Mzc2OdH8.png" /></figure><p>But how exactly do the tree based algorithms work? <br>Unfortunately that may be a deviation for another blog and another blog post as it relies heavily on deep mathematical understanding.</p><p>The ReactJS github page actually links you to the academic paper that outlines some of their core algorithms.</p><p><a href="http://grfia.dlsi.ua.es/ml/algorithms/references/editsurvey_bille.pdf">Philip Bille Paper: Algorithms</a></p><p>The paper is edited so that it does not go so far as to publish the actual full form algorithm. But there is a detailed discussion of the basic algorithmic structure, the common concerns and outlines the top four ‘almost-good-enough’ algorithms for edit distance and alignment distance. <br>Below is a sample of the basic structure for the edit distance and a sample solution:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/0*i2hVoaRT0NE8v8fX.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/0*mnjYEscKnurya9pr.png" /></figure><p>The paper also assumes awareness off some of the more recent diff algorithms available such as: <br>Xdelta — very fast for binary files <br>Rsync — binary files over network links <br>bsdiff — compiled executable files</p><p>Based on this internal structure and functionality, its easy for one using ReactJS in the programming to see how a lot of this internal structure governs syntax and organization!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ec87784e1e8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/front-end-weekly/big-diff-5ec87784e1e8">Big Diff</a> was originally published in <a href="https://medium.com/front-end-weekly">Frontend Weekly</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prying Open Pry]]></title>
            <link>https://medium.com/@mahatimeerunilaya/prying-open-pry-23c06c621337?source=rss-b056eedd2eb------2</link>
            <guid isPermaLink="false">https://medium.com/p/23c06c621337</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Mahati Meeru Nilaya]]></dc:creator>
            <pubDate>Tue, 18 Oct 2016 19:12:05 GMT</pubDate>
            <atom:updated>2016-10-18T19:12:05.824Z</atom:updated>
            <content:encoded><![CDATA[<p>Put some Windex on it: Exploring binding.pry</p><p>Most Ruby programmers are familiar with the <br>‘pry’ gem and the piece of code binding.pry <br>This line is often liberally smattered across their code blocks to test and check their work.</p><p>For most, pry is simply a means to an end.</p><p>Iteration not working as it should? <br>Throw in a binding.pry and see where you have gone wrong!</p><p>Not entirely sure what or where your object is in this segment? <br>Smack on a binding.pry and check <em>what</em> exactly self is referring to in the specific point of the program!</p><p>For many binding.pry is the programming equivalent of the dad in <em>My big fat Greek Weddings</em>&#39; spritzing Windex everywhere.</p><p>But how exactly does the ‘pry’ gem <em>do</em> what it does?</p><p>Also whats with the syntax? Is pry a method of binding? What then, is binding? Is the pry gem actually some inexhaustible amount code that can parse through<em>whatever</em> code that is thrown at it?</p><p>How exactly do we go from simply inserting binding.pryin our programs to being able to test out each line of code in our command line?</p><p>To really understand how binding.pry works we need to first really understand <em>Binding</em></p><h4>Into the Bind</h4><p><strong>The Binding Class</strong></p><p>Binding is actually a ruby method. A ruby instance method.</p><p>Where is this method coming from? What is it an instance of?</p><p>binding is an instance method of the Kernel module. Kernel, being one of those primordial progenitor modules in Ruby, has methods that can be applied to every and any ruby object.</p><p>The binding instance creates and returns an <em>instance</em> of the Binding class, meaning it returns a Binding Object.</p><pre>Kernel.binding =&gt; Binding.new</pre><p>What do Binding Objects do? <br>Binding objects are like CSI photographers. They take freeze-frames of all the program elements in the code at the moment in which they are called.</p><p>This means variables, methods, instance objects, and even what <em>self</em> may be in that particular moment are all captured! This capture transcends scope because of some of the inherent attributes of Binding. Binding</p><p>Binding, unlike most other objects, variables, and methods is omnipotent in its scope. Therefore this ‘freeze-frame’ capture that binding took say, inside a particular method, can be called upon <em>outside</em> that method or even class!</p><p>Sounds pretty useful right?</p><p>Well it gets even better!</p><p>The elusive and omnipotent Kernel module also has an .eval() method which means binding can <em>also</em> take this method.</p><p>The .eval() method will perform an evaluation on the method or instance or whatever it is called upon and returns the evaluated data (based on the given parameters) in a string.</p><p>Since binding “contains” the freeze-frame capture of what various instances, variables, classes, etc, are and what they return. Running the .eval() method will parse through this &quot;picture&quot; via the filter&#39; of argument given. The final return will be the return, from the moment of the freeze-frame, of the object, or variable of method that was passed in as an argument. For example:</p><pre>class Horse  <br>  def color_of_horse<br>    color = &#39;brown&#39;<br>    binding <br># This binding here just takes an evidence screen-shot <br>#of what, where, and how everything is before this line <br>  end<br>end</pre><pre>#now if we tell binding to evaluate the piece of #information we want to know the return value for: </pre><pre>binding.eval(&quot;color_of_horse&quot;) # =&gt; &#39;brown&#39;</pre><p>Already we can see how utilizing this basic ruby object is amazing for debugging. Its easy to see how ‘Pry’ could make all this better</p><p>The Pry gem is created by these lovely people: <br><a href="http://pryrepl.org/">http://pryrepl.org/</a></p><p>This gem does more than simply add on a ‘pry’ bit to the binding method. Pry actually already exists in ruby and is defined on <em>the</em> Object — the primordial soup of every other class in Ruby and through inheritance can work on everything.</p><p>But in order to really understand how binding.pry works we would need to unpack Pry itself before we can delve into the code of the pry gem…which is a huge discussion in itself for another time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23c06c621337" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Platonic Programming]]></title>
            <link>https://medium.com/@mahatimeerunilaya/platonic-programming-beaeda5ba80?source=rss-b056eedd2eb------2</link>
            <guid isPermaLink="false">https://medium.com/p/beaeda5ba80</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[language]]></category>
            <category><![CDATA[plato]]></category>
            <category><![CDATA[object-oriented]]></category>
            <dc:creator><![CDATA[Mahati Meeru Nilaya]]></dc:creator>
            <pubDate>Fri, 14 Oct 2016 01:38:42 GMT</pubDate>
            <atom:updated>2016-11-26T20:14:25.176Z</atom:updated>
            <content:encoded><![CDATA[<p>Coding is easy. <br>Coding is intuitive. <br>Coding is smart. <br>Coding is new.</p><p>These are all things I was told when I decided to re-direct my career aspirations and delve into computer programming. I was directed to Ruby because it was considered intuitive, agile, easy, and a great starter language.</p><p>People told me that programming was like learning a language and the same repetition and foundational study skills were required.</p><p>People said, because I was particularly linear in my problem solving and truly enjoyed functional calculus, I would find programming just as joyous and easy.</p><p>People said my years studying ancient languages and Saussurian Linguistics would make me a quick study.</p><p>People even said that my time in graduate school navigating through the abstracted concepts of dialectics, ontologies, semiotics, and criticizing everything from existentialism to orientalism was great prep-work.</p><p>People, were wrong.</p><p>I quickly discovered that learning Ruby was nothing like the years I spent studying Sanskrit, French, or English; or even that hellish time I crammed for my Comp. Exams. For me, Ruby did not have the uniform beauty of calculus or the fascinating abstraction of a lovely post-structuralist critique. For me, my initial forays into Ruby were simply a series of endless frustrations. Usually represented via failing tests or ‘not-quite’ solid understanding of what was really going on! A large part of this I later realized was because of a wide breach in semantics. Most tutorials, books, and even instructors utilized vocabulary that was never define and/or had alternative meanings outside the realm of programming! This even occurred in schematic drawings and regular descriptive parlance!</p><p>And then, I discovered Object Orientation.</p><p>After finally getting past the primary etudes of git commands, conditionals, and loops, Object Orientation was presented as this Big. New Thing, all exciting, abstract, and complex. But I found the tenets of Object Oriented programming familiar and old.</p><p>Like, <em>really</em> old.</p><h3><strong>When Plato Invented Object Orientation</strong></h3><p>Sometime in the 3rd century B.C.E. the Greek Philosopher Plato postulated that the physical world around us was not real. (In a nutshell)</p><p>Instead, everything humans perceived around them was actually a ‘form’ (i.e. a version of) of The REAL. True reality therefore, was comprised of the True Forms of things.</p><p>These ‘forms’ of the <strong>True Form</strong> were what we regular humans experienced most of the time. These ‘forms’ walked, talked, acted like, and had the attributes and properties of the True Form, but were not <strong><em>The</em> True Form</strong>. Plato provides a deep explanation of his Theory of Forms in his famous <em>Cave Allegory</em> and also <em>Phaedrus</em>.</p><p>For brevity, the following example best encapsulates the central tenets of both these works.</p><p>Think of a horse.</p><p>This imagined horse is likely different from the horse imagined by your neighbor, your mother, your boss.</p><p>It could be a black horse, a brown horse, or a spotted horse.</p><p>Suppose you want to commission a sculpture of a horse. <br>In order for the sculptor to meet your demands he will ask extensive details on the nature of the horse and what it should look like.</p><p>But clearly, both of you know what a horse should look like. You know a horse should have four legs, a tail, spaced out eyes, a mane, hooves, etc.</p><p>All horses have these things. These are the things that make a horse, dare I say, <em>horsey</em>. But do all horses have these things in exactly the same way?</p><p>Of course not!</p><p>Some horses have long tails, some have short, some have sparse manes, some have full manes. But all the things we described above are the attributes of a horse. These are things all horses have.</p><p>According to Plato, the reason you and your sculptor can have this conversation about horses and their attributes is because you both have some concept of <strong>The True Form of the Horse</strong>.</p><p><strong>The True Form of the Horse</strong>: The ideal, perfect, abstract Horse that exists outside of our plane of understanding.</p><p>While we mere mortals can’t really ‘see’ this horse, we know it by its attributes. As a result, we know that all physical horses must have these same attributes to deem them horses.</p><p>Sure, these physical horses might have different versions of the attributes such as different size tails, different colors, etc. But they are all still defined as horses because they all share that same central set of attributes- which according to Plato, originate from the True Form of the horse.</p><p>(In case you were wondering: Later Philosophers such as Bishop Berkeley posited that The True Forms were a creation outside of man, only to be conceived and constructed by a higher power. Therefore all human understanding of The Form could only be through individual examples of that ‘higher’ pure form. Berkeley also had some pretty cool thoughts about how language was like a stream. You could never stand in the same stream twice because water is always moving. In the same way words uttered and words heard, even if they be the same words, were sent with and understood with slightly different meanings. Something I constantly thought about when encountering familiar but new terms in web development!)</p><h3>Everything Old is New</h3><p>Object Orientation in programming languages is the idea the central structure of the language is an ‘object.’ These languages operate on the interactions of objects and data as opposed to the more linear input/output functions of more historical programming languages. (Think your middle school ‘function’ machine analogy when discussion linear functions)</p><p>When I first read the introductions about Object Oriented programming I was confused and <em>under</em>whelmed. I didn’t really understand what these technical authors were trying to convey. (And also their excitement) It wasn’t until I saw the first articulation of a Class and an Instance and a more in-depth reading on Object Orientation that I really go it.</p><p>Or rather, it clicked with my Plato and everything made sense.</p><p>In the same way that Plato said there were True Forms to everything, Ruby has <strong>Objects</strong>. In Ruby, most data types and almost everything one creates is an Object. As in, everything has a True Form and in Ruby, this is called an <strong>Object</strong>.</p><p>Lets imagine we are building a horse Object in a Ruby program. For Plato this would make us the higher power building the <strong>True Form</strong>. Horses have a ton of attributes that delineate their horsiness. These attributes we have discussed before: <br>four legs, mane, tail, eyes, etc.</p><p>We would want to attach all these distinguishing attributes to the Horse Object (The True Form). We do this in ruby by doing the following</p><pre>class Horse  <br>     #All the Attributes of a Horse would go here<br>     #such as:<br>     @number_of_legs <br>     @color<br>     @eyes<br>     @hooves<br>     @tail<br>     @mane<br>#Ignore these @ symbols for now, we&#39;ll get into them later!<br>end</pre><p>The class Horse indicates that we are creating an Object (Plato’s True Form)</p><p>Having created an object we need to create all the <em>attributes</em> of this object that we know all the ‘forms’ of this Object will have. <br>We need to write in all all the attributes such as four legs, eyes, hooves, etc that we know ALL horses will have.</p><p>Plato called the versions of the True Form simply ‘forms.’ Fortunately, Ruby is slightly more precise and each version of a class Object is considered an <strong>instance of the class</strong>.</p><p>A brown horse is a one particular instance of <em>The Horse</em> that is brown.</p><p>A spotted horse is an instance <em>The Horse</em> that is spotted.</p><p>A horse with a very short tail is another instance of The Horse also known as The Horse Object.</p><p>Each of these instances are instances of the class object — which in this case is the Horse. <br>A new instance or a particular instance is created in the following way</p><pre>a_spotted_horse = Horse.new</pre><p>here .new is a method that creates new versions of whatever it is told to act on. We are telling the .new method to act on the class Horse. So as a result we have now created an instance of a horse that we have assigned to a_spotted_horse</p><p>To further distinguish a_spotted_horse we can go and assigned the color attribute of this particular horse to be spotted. We can do this because we created the Horse class to include the attribute color and therefore each instance of a Horse will have color that we can fill in.</p><p>In part II, I’ll further detail how these attributes are actually created and how they map onto each instance (‘form’) of a horse.</p><h3>No Left Brain, No Right Brain</h3><p>I’ve always felt that the divide between the liberal arts and STEM fields was more culturally imposed than inherent. I had always found outlining my graduate papers with expressions and variables soothing, and explaining math in terms of art functional. Yet, when I started ruby I began to question my long held disbelief in this so-called divide. Object Orientation, fortunately, reinstated my belief.</p><p>As I progressed further into learning Ruby, it became apparent that so many structures, ideas, and outlines of the language could be made comprehensible through the lens of older structural relationships and philosophies.</p><p>Perhaps, People, weren’t so wrong after all.</p><p>If I could draw upon my previous knowledge and skills and the elegance of platonic philosophy to connect to Ruby in a meaningful way, what else was in store! I had gotten into this field specifically to engage and build a better bridge between art and tech. Hopefully more junctures like this would lead the way!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=beaeda5ba80" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>