<?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 Samuel Hatcliff on Medium]]></title>
        <description><![CDATA[Stories by Samuel Hatcliff on Medium]]></description>
        <link>https://medium.com/@samuel.hatcliff?source=rss-1ea98452aa47------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-ljlEN2l9mKy53EOSE_Nug.jpeg</url>
            <title>Stories by Samuel Hatcliff on Medium</title>
            <link>https://medium.com/@samuel.hatcliff?source=rss-1ea98452aa47------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 22:39:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@samuel.hatcliff/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[“Everything is an object in Javascript”, but what’s actually going on?]]></title>
            <link>https://medium.com/@samuel.hatcliff/everything-is-an-object-in-javascript-but-whats-actually-going-on-8e434cf14a6c?source=rss-1ea98452aa47------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e434cf14a6c</guid>
            <category><![CDATA[primitive-data-types]]></category>
            <category><![CDATA[objects-in-javascript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[prototypal-inheritance]]></category>
            <dc:creator><![CDATA[Samuel Hatcliff]]></dc:creator>
            <pubDate>Fri, 23 Sep 2022 23:10:31 GMT</pubDate>
            <atom:updated>2022-11-15T18:46:51.400Z</atom:updated>
            <content:encoded><![CDATA[<p>One thing that I would repeatedly hear while learning the ins and outs of Javascript is that “everything is actually an object in Javascript”.</p><p>This statement would remain in the back of my mind as I grew as a developer and always bothered me. I knew that I didn’t really understand what was meant by this, but that understanding the details and implications of such a statement would likely be key to connecting a lot of dots for me and obtaining a deeper understanding of the language.</p><p>What was already an intimidating topic was made more confusing to me by certain things, such as the typeof operator returning “object” for variables assigned to arrays.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*BwqbyKOxv_E0sT_IgoweZQ.png" /><figcaption>Although the typeof operator returns “string” given a string, it returns “object” given an array.</figcaption></figure><p>If everything in javascript was an object, did this mean that arrays are somehow <em>purer </em>objects than other data types, which supposedly were also objects at the highest level?</p><p>I also noticed that I couldn’t access object methods like <em>freeze() </em>or <em>entries() </em>on strings, functions, <em>or </em>arrays (of which I understood to be somehow more purely objects than other data types)!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*3ohWHPd4zQrZeYT9jLPJiA.png" /><figcaption>entries() being called on a string results in a TypeError.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*bWgUfaGy9nxhIuTZ2mSf9A.png" /><figcaption>Likewise, freeze(), another method used by objects, results in the same TypeError when called on an array.</figcaption></figure><p>All of this seemingly confusing and somewhat contradictory information seemed overly daunting at the time and led me to file this question away in the “super advanced JS stuff that I’ll learn later on” section of my brain. However, I’ve recently spent a lot more time diving into this stuff head on, and have found it to be not as complicated as I had previously feared. And honestly, I think this is one of the best questions a junior developer could investigate, as it leads one to have a more fundamental understanding of data types, prototypal inheritance, and constructor functions, which lend themselves to lots of insights about how the language is structured, as well as many common OOP principles.</p><p>So let’s return to that statement again that we hear so often:</p><p>“Everything in javascript is an object.”</p><p>First of all, this is simply untrue. Not everything in javascript is an object, although it might <em>behave </em>as one. So then, what does it mean <em>to be </em>an object, and what does it mean <em>to behave </em>like an object?</p><h4>To be an object…</h4><p>At a very fundamental level, all programming languages consists of data structures and types, which can <strong>refer to a specific way organizing, processing, retrieving and storing data in memory. </strong>If the reader isn’t already familiar with such concepts, I’d recommend supplementing this blog post with a brief introduction to data type and structures. In Javascript, we have access to the following non-object data types:</p><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type">Null type</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type">Undefined type</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type">Number type</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type">BigInt type</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type">String type</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#symbol_type">Symbol type</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type">Boolean type</a></li></ul><p>These data types, along with actual objects, are what the typeof operator looks at when determining the data type of a particular value. Again, I want to emphasize that none of the above data types are objects. When we declare a variable as a string, it is being stored as a string data type in memory. Not as an object. When we store this string, however, we are just storing the value itself, without any methods or properties such as .length or .concat() that we are so used to being able to access whenever we work with strings. A primary advantage of this is that it is far less expensive to store only the value itself each time we need to deal with a string, than it is to store both the string and all of its associated properties and methods for every single string in our program. How then, you might ask, do we have access to these properties and methods? Well, this is where the idea of behaving like an object comes in, and why the phrase “everything in javascript is an object” is often used colloquially.</p><h4>To behave like an object…</h4><p>When we call string.concat(), our string primitive only behaves like an object because JavaScript auto-boxes the value into a wrapper object when a method is called on it. We don’t need to know the technical details of how auto-boxing works in order to understand that in such moments, the wrapper object inherits all the methods and properties of String.prototype. From a design perspective, this is advantageous as linking a wrapper object with an already existing prototype containing these methods is a lot less expensive than creating and storing an object itself. After a method has been ran, Javascript deletes the wrapper and the string once again returns to being a simple string primitive stored in memory.</p><h4>But what about arrays?</h4><p>You might have noticed that arrays are not included in the above list of primitive data types in Javascript. You might also remember from the typeof example, that arrays were the only non-object literal we attempted that actually gave us the type “object”. You might <em>also </em>remember that I said the typeof operator will return any of the above data types or an object. This is because, unlike the other data types, an array is <em>actually </em>an object in Javascript, with the key for each value in the array being represented by its index. When we access an element in an array by its index, what’s going on behind the scenes is essentially the equivalent of accessing the value in an object literal by its key/property.</p><p>Hooray! We now have a solid conceptual footing on how what we call primitive data types are fundamentally different than data structures such as arrays, sets, and maps, with the former being only behaving like objects when methods associated with their prototype are called on them, and the latter being <em>real </em>objects, stored in memory as objects.</p><p>However, at this point in my understanding, I still had one particular lingering doubt. If arrays are really objects in javascript, how come they don’t inherit methods such as freeze() or entries() that can be called on object literals?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*_O2O0qXfiFoqmwGQxUAmVg.png" /></figure><p>And actually, shouldn’t strings and all other data types that get linked with their associated object prototype have access to these methods, as all of these prototypes inherit from Object.prototype? When we call methods on an object, the compiler will go up the prototype chain until it finds that method, so you might think that we’d have access to them all of these prototype objects inherit from Object.prototype.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*W2Ej6sNO5VbjbecBl9GsUw.png" /><figcaption>Beginning of String.prototype.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*4bcAttRgmjR9kIIdoJ73qw.png" /><figcaption>End of String.prototype. We can see from the last line that it inherits from Object.prototype.</figcaption></figure><p>Let’s take a closer look here. If we inspect Object.prototype, we actually don’t see the aforementioned methods. We do however, appear to have several methods available to us, such as hasOwnProperty(). Putting aside the question of where freeze() and entries() are located and how and by what they might be accessed, we know that if we understand prototype inheritance correctly, we should be able to call methods like hasOwnProperty() on anything that inherits from Object.prototype.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*NQZc5rRnlY8juCz6Rjk2bg.png" /><figcaption>We notice that we don’t see methods such as freeze() and entries() on the Object prototype. We do however have access to several methods, such as hasOwnProperty.</figcaption></figure><p>Let’s test it out by trying to call the hasOwnProperty method on an array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*fFWBiwI0epU3m1mF4Wykrw.png" /></figure><p>Hey, it works! We’re calling a method on an array that was defined and inherited from Object.prototype, rather than the Array.prototype. Kinda neat.</p><p>But let’s make sure we understand prototypal inheritance correctly by testing out the same method on a string.</p><p>This method should work on a string as well, since when we call a method on a string, it receives an object wrapper linked to the String prototype, which inherits from the Object prototype. As we learned earlier, even though a string is <em>stored </em>as a primitive string value, it gets wrapped as an object when we want to call a method on it. Let’s see what happens…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*syPLzatDXnB3PadpLv0xEQ.png" /></figure><p>And it also works!</p><p>So why aren’t methods like entries() and freeze() working like we might expect them to do?</p><p>It turns out that these methods are actually stored in the constructor of the Object prototype. Methods and properties defined in the constructor aren’t passed down via the prototype chain and instead are only accessible on Object instances created via a particular constructor. (In this case the constructor listed on the Object.prototype).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*aBUUoIzJ7lNRDiLIKYaZbQ.png" /><figcaption>Under the constructor within Object.prototype we find most of our favorite methods to use on objects.</figcaption></figure><p>If any of this is confusing to you, I’d highly recommend reading about <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain">prototypal inheritance</a> in Javascript. And to be completely honest, it can still be confusing to me too! If any readers want to point to any potential mistakes I’ve made in this post, or draw something that I haven’t covered but might be relevant, it would be very much welcome. I hope this post was helpful to someone, and if anyone has any lingering doubts, please let me know in the comments! See yah next time.</p><p>Sources: <a href="https://developer.mozilla.org/en-US/docs/Glossary/Primitive">https://developer.mozilla.org/en-US/docs/Glossary/Primitive</a> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures</a> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/constructor">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/constructor</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e434cf14a6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Assessing use cases for polarity analysis in my full-stack news-tracker project]]></title>
            <link>https://medium.com/@samuel.hatcliff/assessing-use-cases-for-polarity-analysis-in-my-full-stack-news-tracker-project-3cbc88d12b3?source=rss-1ea98452aa47------2</link>
            <guid isPermaLink="false">https://medium.com/p/3cbc88d12b3</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[polarity]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[sentiment-analysis]]></category>
            <category><![CDATA[nltk]]></category>
            <dc:creator><![CDATA[Samuel Hatcliff]]></dc:creator>
            <pubDate>Sun, 28 Aug 2022 21:12:56 GMT</pubDate>
            <atom:updated>2022-08-28T21:14:53.199Z</atom:updated>
            <content:encoded><![CDATA[<h3>Assessing use cases for polarity in my full-stack news-tracker project</h3><p>I thought I’d share some reflections and screenshots I have of one of my full-stack projects called News-Tracker, which allows users to save and search news stories, as well as save their search queries for easy access. The feature that I’m most excited by, however, is the incorporation of Python’s NLTK and Textblob libraries to run Sentiment Analysis on the stories prior to them being opened by the user. This happens either manually with the user clicking a button on a story in their feed or search results, or as a filter specified by the user when making a search query.</p><p>I’ve incorporated both Polarity and Subjectivity measurements as a part of this project, but want to make this post exclusively about Polarity (How positive or negative the tone of a piece of text is), its accuracy, and the degree to which it is useful in the context of News-Tracker depending on the intentions and motivations of the user accessing these features. Let’s dive in!</p><p>Before writing or designing any code for the application, I sat down and brainstormed potential use-cases for incorporating Sentiment Analysis into user experience. What sort of user could benefit from this feature, and in what ways? I ended up thinking of two main categories of users that could potentially benefit from polarity analysis as a part of the app.</p><p>1) A day/swing trader who wants to evaluate the overall market sentiment of a particular stock, crypto, or geo-political region to factor into their trading decisions.</p><p>2) An individual who has been feeling that the amount of negative news they’ve been consuming has taken a toll on their mental health, and wants to expose themselves to more positive and uplifting news may use the polarity feature to filter out negative stories.</p><p>After observing the way NLTK measures polarity from these news stories, it became fairly obvious to me that user #1 is far more likely to find the polarity analysis than user #2. The reason is fairly simple and straightforward, but I believe it deserves to be elaborated on as it helps to crystalize how polarity is actually determined, and to what extent it is useful alone. Let’s break the problem down step-by-step.</p><p>What is the search query?</p><p>In the case of user #1, it is usually going to be the name of the company. An investor’s relationship with news regarding that particular search query is binary and straightforward: High polarity scores, if accurate, represent positive development for the company, which signals a larger return on investment. The inverse of this statement is also true regarding low polarity scores. NLTK’s Polarity analysis seems to do a decent job at recognizing when an advancement has been made by an organization or individual; whether its expansion, deals, agreements, the announcement of new services, etc. It also does a fair job at detecting when an organization or individual has experienced some sort of threat or loss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Ikc-eejGxLSbn0se23wKg.png" /><figcaption>NLTK’s Polarity analysis seems to do a decent job at recognizing when an advancement has been made by an organization or individual; whether its expansion, deals, agreements, the announcement of new services, etc.</figcaption></figure><p>Therefore, it is safe to say that this type of user benefits from polarity analysis, as their relationship with the keyword given in the search query is built-in and straightforward, as positive or negative sentiment directly maps onto the user’s motive: which is to decide whether or not to buy or sell a stock.</p><p>In the case of user #2, a user could have a much more complex relationship with the keyword given in the search query. A user searches for a particular politician, political issue, or nation, as the keyword without giving the app any sort of indication as to what a positive or negative story related to the keyword ultimately means to the user. As is the case with politics, the failures of an enemy are often victories for a particular cause or individual. When viewed from the politically agnostic perspective of NLTK’s polarity library, any positive advancement or progress is viewed as positive. News events such as the passing of legislation are frequently interpreted as positive, even though the polarity of such things are entirely dependent on the values and beliefs of a particular user.</p><p>I’ve provided an example below that illustrates this point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aSDG8KmiRJnGrJqneKai3w.png" /><figcaption>A story with the headline “Russia about to run out of steam in Ukraine” might be considered “good news” by many, but actually ends up being classified as “Negative” because Russia, the subject and likely keyword of the story, is itself experiencing something negative.</figcaption></figure><p>Reflections/Next Steps:</p><p>There are elements of News Tracker’s polarity feature that can be improved for both users.</p><ol><li>One simple way to get closer to the desired utility defined in the second example would be to prompt the user to provide additional information about their relationship with the keyword. An “inverse” option could be selected, that turns negative stories into positive stories and vice versa. This could be helpful especially in situations involving some sort of competition, i.e. an election. Beyond this, it’s admittedly pretty difficult to make changes in the application that would reliably allow the user to experience the type of utility described in the 2nd scenario. Perhaps some sort of machine learning model that learns from each particular user their own preferences as they mark a story as being ‘positive’ or ‘negative’ according to their own perspective and beliefs.</li><li>Although an inverter/trader is able to search by polarity and view scores on each story as they scroll, there isn’t yet a feature that averages out the scores of a particular keyword and compares them to others. This would be extremely useful and relatively straightforward to implement, as a user can already save and refer to their search queries. It would be easy to provide some sort of daily polarity score next to their saved search queries in order to provide a clearer picture of the company’s performance and contrast it with other saved queries. Optional text or email alerts detecting dramatic shifts would also help provide the utility this type of user is seeking.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*N7XH7gIlNT14vaGmJZpAhQ.png" /><figcaption>This [daily polarity score next] would be extremely useful and relatively straightforward to implement, as a user can already save and refer to their search queries.</figcaption></figure><p>What did you think of this analysis? If anyone has any disagreements, suggestions, ideas, etc, I’d love to hear from you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cbc88d12b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Single Most Important Thing I Learned from Programming that Made Me a Better Developer…]]></title>
            <link>https://medium.com/@samuel.hatcliff/the-single-most-important-thing-i-learned-that-turned-me-into-a-successful-developer-9a98cc75faa4?source=rss-1ea98452aa47------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a98cc75faa4</guid>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[programming-tips]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Samuel Hatcliff]]></dc:creator>
            <pubDate>Sun, 28 Aug 2022 21:09:16 GMT</pubDate>
            <atom:updated>2022-09-15T01:11:56.450Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4lQVspbD1jltFcELtMQSdQ.png" /></figure><p>As someone from a non-coding background who transitioned just within the last year and a half, I thought I’d share with y’all what I’ve found to be the most important insight I’ve gleaned as I went from writing my first “Hello World” to being able to build complex full-stack projects with many moving parts.</p><p>Mental maturity and perseverance is more important than natural intelligence when learning how to program. That’s it. I’ll elaborate…</p><ol><li><strong>Don’t walk away</strong>. I have found that if you get stuck on something that’s preventing you from advancing or achieving your objective, simply persevering despite your frustration instead of giving up will lead you to solve that problem 9 out of 10 times. When I was younger, it was pretty common for me to instantly give up on something when I got frustrated, and would convince myself that whatever problem I was trying to solve was “stupid” or “unworthy of my time”. I think that deep down though, I was worried that it was <em>me </em>who was stupid. And just to clarify, I’m a big fan of taking breaks and asking for help when all other avenues have been exhausted. I’m definitely not advocating for never <em>literally </em>“walk away”. Plus, framing the question when asking for help and knowing how to apply the knowledge you’ve received is just another part of “not walking away.”</li><li><strong>The more you code, the more accustomed you get to the frustration and obstacles that come with programming</strong>. The more you code, the better you become at coding, that’s undeniable. But even more importantly is learning how to accept that it won’t always be easy. Instead of freaking out when getting stuck on a problem, you’re able to think back to the last time you got stuck on something for several hours. You remember how impossible and insurmountable it felt at the time, and how eventually you <em>were</em> able to resolve it. Knowing that moments like these are normal and just part of programming, and that you <em>are </em>capable of solving difficult problems, has been far more important to me in becoming a better developer than the amount of array methods I know, or how quickly or efficiently I might be able to solve a leetcode problem.</li><li><strong>The importance of reading the instructions or documentation before beginning to use a new tool</strong>. I’ve been producing music for over 7 years. Before learning how to program, I would always struggle with reading instructions or learning the technical details of a new music plugin before using it. I think this applies to pretty much everything. When you get a new tool, the first thing you want to do is to get your hands dirty and use it. You’re excited about the possibilities of what this new tool can offer you, and you want that instant gratification of seeing what it can do as soon as it’s in your hands. However, you’re going to save so much more time over the long run by reading the instructions/documentation before you get started. Of course you don’t need to read the entire documentation before getting to work, but reading enough to have a mental model of how something works, while referring back to it as you work is absolutely key.</li></ol><p>I hope this helps someone and would love to hear from anyone with similar thoughts/experience!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a98cc75faa4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>