<?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 Ross Michael Perkel on Medium]]></title>
        <description><![CDATA[Stories by Ross Michael Perkel on Medium]]></description>
        <link>https://medium.com/@rossperkel?source=rss-ea37e17ee1b0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*c1S_kbcE5qsgH1aAfvhx9Q.jpeg</url>
            <title>Stories by Ross Michael Perkel on Medium</title>
            <link>https://medium.com/@rossperkel?source=rss-ea37e17ee1b0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 07:30:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rossperkel/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[Networking Nodes: Building Bridges in the Engineering Community]]></title>
            <link>https://medium.com/@rossperkel/networking-nodes-building-bridges-in-the-engineering-community-f952107b674d?source=rss-ea37e17ee1b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f952107b674d</guid>
            <category><![CDATA[soft-skills]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[career-development]]></category>
            <dc:creator><![CDATA[Ross Michael Perkel]]></dc:creator>
            <pubDate>Sat, 30 Mar 2024 16:40:37 GMT</pubDate>
            <atom:updated>2024-03-30T16:40:37.717Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the more under-appreciated skills you can bring to the table as an engineer is in your ability to connect people. Yes, coding is still our central responsibility and of course technical skills are necessary to climb the ranks but equally as important are your soft skills.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MzQIbe-jwqL4bz6Z" /><figcaption>Soft skills are just as important as technical prowess</figcaption></figure><p>Let me tell you the story of two different developers I’ve had the opportunity to work with in my career. Both are friends to this day but each of them took a wildly different approach to their work and their relationship with their colleagues.</p><p>Jacob was my colleageue at my first enterprise software level job. He had recently graduated from a computer science program and through the alumni network had been recommended and hired to start about a month after my first day. Given that we were both juniors new to the company, we were frequently given tickets to work on together and help guide each other through the common hurdles that come with navigating any large production code base.</p><p>A year went by and a senior developer left our team; the natural choices to fill his shoes came down to Jacob or myself. Though I was probably the weaker engineer from a purely coding standpoint, I was given the promotion. Jacob ended up being promoted ~1 year after when I ended up leaving the company; one night while we were playing video games and talking about our recent work tasks, I made some offhand remark about him being a much stronger coder than I was. This prompted him to ask why I thought I had been promoted first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d5_qS8l4XY1rvuje" /><figcaption>Promotions aren’t the be all end all but they sure are nice.</figcaption></figure><p>To me, the answer was obvious: our jobs aren’t JUST about the code. If you neglect the many other aspects of being a good teammate like writing clear documentation, networking with peers outside of your immediate working group or your name, face and brand isn’t known outside of your greater organization, you are actively handicapping yourself when it comes to moving up the ranks as an engineer.</p><p>Two career moves later and I found myself working in a new codebase, with new colleagues and another senior joining the team at the same time as myself again. Colin had come from a consultancy and this was his first time working on salary as an engineer; a lot of the intricacies of corporate work that was second nature to me was new to him. This didn’t stop him from starting weekly threads of fun questions to learn about teammates personal lives, checking in junior team members proactively rather than waiting for them to ask and even inviting our direct manager to our game nights. Though Colin’s technical skills were sound, he was also clearly placing a value on soft skills as well. When he ended up leaving our workplace, he moved directly from senior to manager and I have no doubt that working on his team is a pleasure every day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6w-Kh-71gPD72Y1-" /><figcaption>Teamwork is vital to success in just about every field.</figcaption></figure><p>The stories of Jacob and Colin underscore a crucial aspect of success in the engineering field: the importance of soft skills alongside technical proficiency. While coding prowess remains vital, fostering connections, cultivating a positive team dynamic, and building a personal brand are equally significant. Engineers who invest in networking, communication, and team building not only enhance their own career prospects but also contribute to a more collaborative and productive work environment. As we navigate the complexities of modern technology, let us not overlook the power of human connection in driving us towards innovation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f952107b674d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Dangers of Destructuring]]></title>
            <link>https://medium.com/@rossperkel/the-dangers-of-destructuring-4449a54ac6f0?source=rss-ea37e17ee1b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/4449a54ac6f0</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Ross Michael Perkel]]></dc:creator>
            <pubDate>Wed, 27 Mar 2024 23:00:57 GMT</pubDate>
            <atom:updated>2024-03-27T23:00:57.893Z</atom:updated>
            <content:encoded><![CDATA[<p>Working in the marketing department of a large-ish company, I end up building a lot of ‘<a href="https://www.linkedin.com/advice/3/what-benefits-drawbacks-using-card-ui">cards</a>’. Recently while reviewing a pull request from a junior colleague, I was confronted by JSX that looked something like the following.</p><pre>{arrayOfCards.map(({<br>  id,<br>  headline,<br>  image,<br>  alt,<br>  copy,<br>  color<br>}) =&gt; {<br>  &lt;CardContainer id={id} backGroundColor={color}&gt;<br>    &lt;h1&gt;{headline}&lt;/h1&gt;<br>    &lt;img src={image} alt={alt}&gt;<br>    &lt;p&gt;{copy}&lt;/p&gt;<br>  &lt;/CardContainer&gt;<br>})</pre><p>At surface level, this code looks great; it’s easy to follow, doesn’t introduce any complicated logic and does the thankless work of displaying iterated blocks of data into consumer friendly cards. I immediately pushed back against this PR and asked for changes however for a few simple reasons.</p><p>1. When we destructure props, the component’s dependencies become less explicit. Readers, including the original developer and future maintainers, will almost certainly find it challenging to understand which props are actually being used within the component’s logic without examining the destructuring assignment. Combine this with Styled Components or any other library that ends up with compiled React that lacks obivous identifiers like class names and this lack of clarity can easily lead to confusion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dkLFripJu5yCfB2s" /><figcaption>These parts are more useful put together than destructured</figcaption></figure><p>2. Destructuring props obscures the original shape of the props object passed to the component. In the code example above, we do not have any sub properties. What happens when we modify the title being passed in the actually contain different strings to display based on whether or not a user is signed in? What about a button that depends on the number of something in a cart or a headline welcoming user.firstName to our site? While nice in the abstract land of foo bar examples, over reliance on abstraction can make it harder to track down where and how certain props are being utilized throughout the application. When searching for implementations of specific logic or behaviors associated with particular props, developers may need to inspect each component’s destructured props individually, increasing the cognitive load and time required to understand the codebase comprehensively. This is to say nothing about making sure that you are changing the correct piece of code in question; every developer I know working in an enterprise code base relies heavily on the search functionality in our IDEs — what happens when we have 50+ props named ‘headline’?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SPTkYJ6HT8QgruoA" /><figcaption>Photo by <a href="https://unsplash.com/@arnosenoner?utm_source=medium&amp;utm_medium=referral">Arno Senoner</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>3. Finally, when we destructure props, we not only introduce another level of difficulty in our code readability and maintainability, we also add unnecessary coupling between the component and its parent or container components. By explicitly listing the props that a component expects and uses, developers can create a clearer contract between different parts of the application. Destructuring props breaks this contract by tightly coupling the component to the specific structure of the props object passed from its parent, making it more difficult to refactor or reuse the component in different contexts without adjusting its destructuring logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ky1wNmLssBH-NvhH" /><figcaption>Tight coupling is great in relationships but less desirable in our codebases</figcaption></figure><p>All of this may sound a bit Old Man Yelling at Sky but the fact of the matter is that we work in a profession where everyday things are moving and changing and we lose nothing by being extremely explicit about the structure of our data. While destructuring props is nice, clean,pretty and fun, it is a tool just like any other and like an outfit, an argument or state in an application, the usage should be defined by the context.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4449a54ac6f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Things I Learned About Programming from my Dog]]></title>
            <link>https://medium.com/@rossperkel/5-things-i-learned-about-programming-from-my-dog-a48e7be9f56b?source=rss-ea37e17ee1b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a48e7be9f56b</guid>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[dogs]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Ross Michael Perkel]]></dc:creator>
            <pubDate>Thu, 21 Mar 2024 18:24:15 GMT</pubDate>
            <atom:updated>2024-03-21T18:24:15.765Z</atom:updated>
            <content:encoded><![CDATA[<p>Years of experience working as a programmer has taught me that good software engineers come in all shapes sizes and species. Like many of us, I work from home and it’s not uncommon for me to spend my lunch break walking my dog Henry while mulling over whatever ticket I’m working on that day. On these walks, he’s been invaluable in getting me unblocked to the point that I sometimes wonder if he isn’t one of the best engineers I know considering how much I’ve learned from him.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gYEmmNVzpntUsYzS" /><figcaption>Photo by <a href="https://unsplash.com/@devn?utm_source=medium&amp;utm_medium=referral">devn</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4><strong>1. Most problems can be solved with a walk</strong></h4><p>There is a time and a place for sitting down and performing the age old practice of banging your head against something. Certainly, after reading documentation and tracing the outlines of the code, I am often guilty of throwing myself into a problem and trying to solve it through sheer force of willpower. When these particularly tricky issues arise though, there is something preternaturally freeing about allowing yourself the space to try, fail and then take a break. Keeping a regular schedule and building breaks in for yourself is key; we use the phrase “go touch grass” for a reason. Getting outside, both physically under the sky and out of the prisons of our own minds, is a crucial skill for engineers to recognize and practice. I can’t recount how many bolts of inspiration have hit my while I was away from a keyboard just wandering around my neighborhood with Henry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZcAF2tf_kYHHXSXd" /><figcaption>Photo by <a href="https://unsplash.com/@dbeausoleil?utm_source=medium&amp;utm_medium=referral">Delphine Beausoleil</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>2. It’s always worth a second smell</h4><p>To keep ourselves from getting bored or stagnant, Henry and I try to mix up the route our daily walks take. On each of these itineraries however, there are always a few places that we simply must stop at. The bush where we once found a half eaten pizza crust, the yard where our sworn Poodle enemy lives, the lakeside path that takes us right up close enough that we can hear the zoo from; all of these are places that once we discovered, we needed to keep investigating and continuing to try and understand. If we found pizza crust once, it might be there again. If we once solved a race condition by simply putting an await clause or we stopped our page from breaking by confirming that we were both not in a loading data state AND the data was non null, these are things that we only have to learn once before we start reinvestigating them and using them as learning experiences. It’s also taught me the value in taking time to understand why our fixes work as opposed to just blindly continuing to implement and get fires put out; by understanding, we can apply this knowledge in the future more effectively.</p><h4>3. A lot can be gained by sitting near the table</h4><p>One of Henry’s worst habits is his propensity to sit near any table with food on it. For a long time, I attempted in vain to train him out of this or to shove him out of the room. It was a meeting when I was still pretty junior that I realized that I was doing the same thing he was; simply by sitting in and around meetings I had no part in, I was able to understand better how I fit into the company and how my work interfacing with other team’s systems and goals. While Henry’s desire to be near the table comes from physical food scraps, ours as engineers should come from the scraps of information we subconsciously pick up just by being in rooms and conversations ostensibly not related to our work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aD4b7t7EcJn9heDp" /><figcaption>Photo by <a href="https://unsplash.com/@rubyschmank?utm_source=medium&amp;utm_medium=referral">Ruby Schmank</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>4. Avoid biting when a growl suffices</h4><p>As a field full of people with opinions, it is inevitable we run into conflict. Whether it is someone asking you to refactor a PR as a power move or a colleague taking over a ticket without asking, most of the time all it takes is a slight voicing of displeasure and the issue will be dropped. Rarely if ever in your career should you find yourself in a situation where you feel the need to ‘bite’.</p><h4>5. Sometimes, you’ve just gotta dig</h4><p>Unfortunately there will come a time as a programmer when you are given a task that requires a deep understanding of internal specific knowledge. This is an inevitability as you rise from junior to senior to staff; the trick here is learning to enjoy the rolling up of your sleeves and digging deep into the guts of how and why your app does whatever it does. From banking to streaming video, I have yet to encounter a workplace where I didn’t have to dig deep into our code base and ask questions at least once a week. If you don’t enjoy this sort of digging, maybe programming isn’t for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*seM_pTiPPonQHvIU8rJXwg.jpeg" /><figcaption>The big man himself, Henry</figcaption></figure><p>Through our daily walks, training exercises and lots of treats, I’ve gleaned invaluable insights that transcend mere programming techniques and extend to even life lessons. Henry has taught me the importance of taking breaks, exploring new paths, absorbing information passively, resolving conflicts diplomatically, and embracing the deep dive into complex problems. As we navigate our careers as programmers, let’s remember to occasionally pause, take a breath, and learn from the world around us, even if it means taking a cue from our furry companions. After all, in this diverse and ever-evolving field, wisdom can come from the most unexpected sources.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a48e7be9f56b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Redesigning A Microwave]]></title>
            <link>https://medium.com/@rossperkel/redesigning-a-microwave-a8b020ad608c?source=rss-ea37e17ee1b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8b020ad608c</guid>
            <category><![CDATA[product-design]]></category>
            <category><![CDATA[product-management]]></category>
            <dc:creator><![CDATA[Ross Michael Perkel]]></dc:creator>
            <pubDate>Thu, 16 Mar 2023 17:30:24 GMT</pubDate>
            <atom:updated>2023-03-16T17:30:24.959Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s society, microwaves are ubiquitous in kitchens but this technology has plenty of room for improvement. Before plunging ahead, take a moment to consider the current ‘microwave landscape’ and customer’s wants from out of their microwaves will allow us to better target our redesign.</p><p>Modern microwaves come in two varieties, countertop or over-the-range (OTR). According to <a href="https://twitter.com/wirecutter/status/1263549250719416321?lang=en">reporting done by the New York Times</a> and subsequently confirmed by the manufacturer, most microwaves on the market are manufactured by a single firm, <a href="https://en.wikipedia.org/wiki/Midea_Group">Midea</a>. Setting aside the realities of manufacturing costs, research and design, economies of scale and concentrations of production for this redesign exercise, this presents a colossal opportunity for product differentiation; given that this market is largely dominated by interchangeable and commoditized machines, our goal should be enticing customers away from various homogenous brands by offering significant improvements and new pfeatures. Additionally, current appliance manufacturers generally treat their customers as part of a uniform customer population so we should consider if there is a way to accurately segment our customer population and offer them a reason to switch to our microwave.</p><p>Redesigning anything begins with understanding our target consumer and understanding their needs and wants. Given that “<a href="https://www.foodandwine.com/cooking-techniques/foods-chefs-always-microwave#:~:text=Most%20chefs%20will%20never%20admit,even%20have%20microwaves%20on%20site.">most chefs will never admit to using a microwave, especially when they’re cooking professionally</a>”, we can infer that most of our customers are home cooks. This suggests avoiding complex chef-targeted features such as a built in sous vide attachment or building a solid state microwave. Instead, our focal point should be on alleviating customers current complaints and offering an improved version of the product they already use daily.</p><p>According to research done by Consumer Reports, <a href="https://www.consumerreports.org/microwave-ovens/most-and-least-reliable-microwaves-a7251951773/#:~:text=Failure%20to%20heat%20food%20evenly%20and%20excessive%20noise%20top%20the,food%20or%20liquids%E2%80%94or%20both.">the most common complaints</a> amongst users were excessive noise and uneven heating. Close behind on the list of common complaints was breaking control panels and slow heating. Given this information, there are at least four potential ways to attract new customers with a proposed redesign:</p><ul><li>Construct a quieter microwave</li><li>Build a microwave that solves for uneven heat distribution</li><li>Improve the control panel design and durability</li><li>Accelerate cooking times</li></ul><p>Using an impact vs effort framework, we next decide which of these issues gets priority in the redesign followed by a feasability assessment of the effort required to move from concept to reality.</p><p><strong>Option 1: The Quiet Microwave</strong></p><p><em>Expected Impact:</em> Medium to High. Everyone knows the hum of the microwave and offering customers a silent or even significantly quieter microwave would be an easy selling point.</p><p><em>Suggested Solution: </em>Employ a quieter exhaust fan.</p><p><em>Feasibility: </em>Low. The actual component in microwaves that is responsible for heating is a large transformer that is part of a high voltage DC power supply for the magnetron. <a href="https://landmarkelectricinc.com/2021/01/04/why-do-transformers-hum-landmark-electric-inc/#:~:text=The%20main%20one%20is%20the,which%20causes%20a%20humming%20sound.">Transformers tend to hum</a> due to magnetostriction in the core and magnetic forces between the windings. Additionally, microwave ovens are typically only 60–70% efficient, so a large fan is required to exhaust approximately 400W of waste heat. The result is that making a quiet microwave, requires fundamental changes to the laws of physics or sound cancellation that counteracts the sounds produced exhausting waste heat.</p><p><strong>Option 2: Uneven Heating of Food</strong></p><p><em>Expected Impact: </em>High. Reheating food multiple times to achieve the desired temperature or burning ourselves on something hotter than expected are common experiences for microwave users. A microwave that was able to properly determine the cook time and power level necessary to heating food to an appropriate temperature is a selling point for customers across all demographics.</p><p><em>Suggested Solution</em>: Install a camera inside the microwave linked to an AI to identify food paired with a scale built in to the turntable to weigh the food being heated.</p><p><em>Feasibility:</em> High. Given that the ability to control microwave power/temperature already exists, half of our problem is already solved. Additionally, we now have access to recipes, cook times, and advice from chefs across the world as to how long you need to cook foods for via the internet. The addition of a camera to the inside of the microwave running it’s feed to an AI for identifying food, a scale to the lazy susan baseplate to weigh the portion being heated and with this information, be able to serve customers a perfectly heated plate with minimal technological development on our behalf as all of these tools already exist at scale.</p><p><strong>Option 3: Improving the Control Panel</strong></p><p><em>Impact:</em> Low to Medium. While customers do take issue with poorly constructed control panels, short of a full mechanical failure of their current unit, it is unlikely that a largely cosmetic redesign would motivate any customer who already owns a working microwave to go out and purchase an upgrade.</p><p><em>Suggested Solution:</em> Develop an app to allow users to control their microwaves with their phones.</p><p><em>Feasibility</em>: Medium — High. We’ve already seen that many other industries have done away with traditional controls and moved to a digital first approach. Developing an app that links users phones to their microwaves allows for removal of the traditional front facing control panel while also allowing users the flexibility to control their microwave from anywhere. Smart home automation is a growing area in kitchen appliances and few have tapped into the microwave. Further such functionality could be expanded to work with popular voice assistants like Amazon’s Alexa or Google Home and end up being a selling point to tech passionate customers.</p><p><strong>Option 4: Speed up Cooking Times</strong></p><p><em>Impact</em>: Medium — High. Given the popularity of alternative cooking devices like the Air Fryer and our modern obsession with efficiency, a microwave that allowed for significantly faster cook times would be a selling point for many customers.</p><p><em>Suggested Solution: </em>Technological investment and research in alternative heating methods.</p><p><em>Feasibility</em>: Low. Microwave technology has evolved minimally since its inception. While most microwaves now offer differing power levels, without a significant technological investment by our firm, it’s difficult to imagine an imporoved heating system that outperforms cutting the food into smaller portions, using the correct power setting or covering it with a microwave safe lid.</p><p><strong>Action Plan:</strong></p><p>After review of the preceding framework, the appropriate choice for our firm is a microwave with a few key differences. By replacing the standard removable lazy susan baseplate with a removable ceramic plate that sits on a scale, users can accurately gauge how much food is actually being heated and simulatenously heat from the bottom as well as around. Addition of a small camera inside of the microwave utilizing existing <a href="https://cs230.stanford.edu/projects_fall_2019/reports/26233496.pdf">neural networks trained on images of food</a> for proper identification of the food being heated removes guesswork for consumers. Additionally, we could add thermal detection to the camera or via a thermal probe to ensure that the food is evenly heated.</p><p>Since we are in business of selling microwaves and belive there is market for an enhanced microwave, success may be measured in a variety of ways but key metrics for observation are:</p><ul><li>Markedly improved customer satisfaction</li><li>Growth in sales</li><li>Improved pricing power evidenced by reduced discounting in retail partners</li><li>Finally, adoption of similar features by competitors suggests we’re onto something.</li></ul><p>I recommend establishing a cross functional team from product design, marketing, production/manufacturing and sales for the investigation of a re-imagined microwave. The team should be assigned a deadline based on a maximum reasonable stretch schedule and appropriate budget.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8b020ad608c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Look at all the St*rs]]></title>
            <link>https://medium.com/@rossperkel/look-at-all-the-st-rs-999e952dff60?source=rss-ea37e17ee1b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/999e952dff60</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[directives]]></category>
            <category><![CDATA[syntactic-sugar]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Ross Michael Perkel]]></dc:creator>
            <pubDate>Wed, 29 Jul 2020 21:54:04 GMT</pubDate>
            <atom:updated>2020-07-29T21:54:04.140Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve ever done any development with Angular (and I assume you have if you’ve made it here), it is inevitable that you have come across Structural directives. They’re super easy to identify because they are all prefaced with a *; some of their greatest hits are NgIf, NgFor and NgSwitch, all of which are crucial to helping us as developers build lean, clean apps. But why the star? To understand Angular’s use of asterixes, we first need to understand what Structural directives actually do and then we can figure out what’s actually going on behind the scenes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FuTnJZuA0vXwKhCs" /><figcaption>Lotta stars in most Angular apps</figcaption></figure><p>Within Angular, there are three main types of directives — structural, attribute and component. We’re going to largely ignore components as while they’re technically directives that manage a section of HTML based on their template, they do not quite fit into the scope of this blog.</p><p>Attribute directives are used to change <strong>the element they are added to. </strong>Attribute directives, for the most part, appear to be normal HTML attributes. In the below example, we have used the Angular CLI to run <em>ng g d exampleDirective </em>(long form: ng generate directive exampleDirective) which has automatically created our exampleDirective.directive.ts and exampleDirective.directive.spec.ts files (in whatever directory you ran your command in) and has also automatically <strong>declared</strong> our new directive in our AppModule. This means that we are now free to use our directive like so:</p><pre>&lt;div exampleDirective&gt;Lorem Ipsum&lt;/div&gt;</pre><p>Attribute directives, when attached to a host element, look like standard HTML attributes we might set in the course of building a web page. This will not give us any default behavior though — within our directive.ts file, usually in the constructor, we will grab an elementRef to our target element and apply whatever <strong>style changes </strong>we want to be applied to our targeted element. There is an awful lot that can be done with Attribute directives including stacking multiple on a host element or even having an Attribute directive affect the behavior of another directive but again, outside the scope of this article — if you’re interested, the <a href="https://angular.io/guide/attribute-directives">Angular documentation</a> is a great place to get a better grasp on these.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hxz_PFAevmlVv1rv" /><figcaption>Structural directives actually change the DOM rather than components behaviors within the DOM</figcaption></figure><p>Structural directives differ from Attribute directives in that rather than modifying their host element, <strong>Structural directives modify the DOM and surrounding elements. </strong>Rather than directly accessing the DOM, structural directives allow us to write logic that takes the from of if X, then Y or for each thing, do this and so on. There can only be <strong>ONE</strong> structural directive per element. Below is an example using NgIf which evaluates an expression and returns a boolean.</p><pre>&lt;div *ngIf=&quot;candy = tastesGood&quot;&gt;<br> Candy always tastes good so this will show. <br>&lt;/div&gt;&lt;div *ngIf=&quot;red = blue&quot;&gt;<br>  Red will never equal blue so ngIf evaluates to false.<br>  This div WILL NOT BE PART OF THE DOM. <br>&lt;/div&gt;</pre><p>Even though these two examples are simplistic pseudo code, they do a good job of showing how we use a structural directive to change the structure of the DOM. It’s worth noting that the div which has the ngIf evaluating to false is not hidden or obscured, it is rather FULLY REMOVED from the DOM. Angular’s default behavior is meant to help us prevent memory leaks and make sure that our app is running as quickly and smoothly as possible. In some situations, it may make more sense to not fully destroy and recreate components and you may want to circumvent this default behavior; this is a consideration that you will be able to make with experience and context within your app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*juvb3pu85AMpbray" /><figcaption>It’s all just sugar</figcaption></figure><p>Finally, we’re ready to talk about the *s all over our apps and unfortunately, this may be the most boring part of the whole article because what the stars really come down to is simple syntactic sugar. When Angular reads our code and goes to compile, our *ngIf (or any other directives) are actually read as:</p><pre>&lt;ng-template [ngIf]=&quot;tastesGood&quot;&gt;<br> &lt;div&gt;Candy always tastes good so this will show.&lt;/div&gt;<br>&lt;/ng-template&gt;</pre><p>Those *s serve as a signal to Angular that what we are actually asking for is to take our targeted element, wrap it in an &lt;ng-template&gt; element, and then on the wrapper use ngIf property binding. Even though this example is specific to *ngIf, the behind the scenes behavior of structural directives is largely the same. Let’s pretend we have an array called TMNT with four entries.</p><pre>&lt;table *ngFor=&quot;let turtle of TMNT&quot;&gt;<br>   &lt;tr&gt; {{turtle}} &lt;/tr&gt;<br>&lt;/table&gt;//becomes&lt;ng-template ngFor let-turtle [ngForOf]=&quot;TMNT&quot;&gt;<br>    &lt;table&gt;<br>      &lt;tr&gt;  {{turtle}}  &lt;/tr&gt;<br>    &lt;/table&gt;<br>&lt;/ng-template&gt;</pre><p>This is of course nothing more than a pseudo simplification — *ngFor has many more optional args than I have incorporated here as this is meant purely to show you how much syntactic sugar can be provided by a single *.</p><p>Feel free to reach out with any questions, comments or struggles you’ve had learning Angular. I am far from a master but I love to keep paying my learning forward in any way that I can.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=999e952dff60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[So You Just Bombed An Interview]]></title>
            <link>https://medium.com/@rossperkel/so-you-just-bombed-an-interview-ac173125754e?source=rss-ea37e17ee1b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac173125754e</guid>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Ross Michael Perkel]]></dc:creator>
            <pubDate>Tue, 17 Dec 2019 13:24:48 GMT</pubDate>
            <atom:updated>2019-12-17T13:24:48.451Z</atom:updated>
            <content:encoded><![CDATA[<p>We’ve all been there; after months spent firing off resumes and cover letters into the void, you finally get a call for a company that you’d LOVE to work for. You know their stack, you believe in their mission and it seems like finally the universe is lining up to throw you a bone. The cultural interview goes great and it finally feels like you may have found a new workplace. Then comes the technical.</p><p><a href="https://giphy.com/gifs/55o2qEKfztdjvYx9sl/html5">https://giphy.com/gifs/55o2qEKfztdjvYx9sl/html5</a></p><p>All of a sudden, it’s like your mind has gone blank and you’re right back in the same mental space as you were when you first started coding; completely flustered, overwhelmed and totally unable to code your way out of a paper bag. You leave the technical with your head hanging low, thinking to yourself, “Wow, there is no way that I will ever get a job as a programmer if I can’t even do XYZ task. I am such a failure.”</p><p><a href="https://giphy.com/gifs/TiOYC75Qkx1De3tjrH/html5">https://giphy.com/gifs/TiOYC75Qkx1De3tjrH/html5</a></p><p>If you’ve ever been here, the first thing to remember is that you are not alone! The first time I crashed and bombed an interview, I completely forgot how to write even the simplest helper functions; it was only after reaching out to my other developer friends that I was assured this is totally normal. The second thing to remember is something that has become a daily mantra for myself (and I assume many others):</p><h3>Mohammed Asker on Twitter</h3><p>Whenever you are struggling in coding, always remember this: 1. You&#39;re not stupid 2. Coding is hard 3. Always Google your problem 4. Senior developers struggle too 5. Seriously, you are not stupid</p><p>Seriously, ignore all the “Learning to Code is easy!” posts and advertisements you see everywhere. It is not. One of the most important things I have heard so far in my learning journey is that the default state of code is failing; if computers did what we wanted all the time, there would be no need for programmers!</p><p>If you’re still having trouble forgetting about that interview, or even if you feel like the interview went really well, my routine always sees me taking ten minutes to quickly scribble out notes about what I tripped up on, what I did well on, what my interviewer and I talked about, etc, just as a baseline while it’s all still fresh. Then I get as far as I can from it; for me this means I got to the gym for an hour, take a long walk afterwards to my favorite coffeeshop and sit there and read a book for a while. Whatever you do, the point of the exercise is to remember that it was just a job interview — this interview will not make or break your career.</p><p>Interviewers themselves have been through this very process and it’s important to keep that in mind; the best people I’ve had interviews with have been empathetic and kind when they saw me struggling and the worst have showed me that maybe that company wasn’t somewhere I wanted to work anyways.</p><p>Once you’ve taken enough time away from your computer to calm the mental storm, it’s CRUCIAL to send a follow up note to your interviewer. No matter how badly you feel like you bombed, demonstrating that you possess these basic manners at least shows that you are not only a serious candidate but that you still care and are invested in this role. I always aim to send my followup emails within 24 hours but usually keep it closer to eight to ten; if your interview is in the morning, I usually send my thank you around 3 or four; if the interview is in the afternoon, I try to have my follow up email be one of the first things my interviewer sees when they sit down at their desk the next morning to check their inbox. One of the best (and least utilized) Gmail features is their <a href="https://www.theverge.com/2019/5/6/18530967/how-to-schedule-email-gmail-natively-desktop-mobile-app">“Schedule an Email”</a> feature which allows you to plan when your emails are going to send. It’s a great way to make sure that you can write your email and then forget about it, knowing that it will send exactly when you need it to rather than having to be at a computer at that second.</p><p>Beyond that, the only real answer to bombing an interview is to keep coding! A good interviewer will give you feedback on where you could improve and many times your follow up email can open up a dialogue about what you should work on for future interviews. Maybe this interviewer didn’t feel like you were a great fit for their algo heavy role but loved the design thinking they saw and can connect you to someone else they know looking for a junior. it definitely sucks to hear and trust me, no one enjoys job hunting, but perseverance is your friend here as in all things coding related. If you ever feel like you need to vent about a bombed interview or just want to chat with another fellow job seeker, feel free to reach out; I would love to hear from others how they deal with their feelings of failure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac173125754e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MapBoxGL Basics!]]></title>
            <link>https://medium.com/@rossperkel/mapboxgl-basics-ff04e06656ac?source=rss-ea37e17ee1b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff04e06656ac</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[mapbox]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ross Michael Perkel]]></dc:creator>
            <pubDate>Tue, 10 Dec 2019 13:31:01 GMT</pubDate>
            <atom:updated>2019-12-10T13:31:01.202Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re like me and you want to use some sort of map in your application but don’t want to default to Google Maps, MapBoxGL is here to your answer. In this blog, I’m going to lay out the basic steps you need to follow to get your map displayed on screen and implement basic functionality. This blog was inspired by my time spent building my <a href="https://github.com/AvalancheOfFox/bodegadex-frontend">Bodega Cat Pokedex</a> and wishing that there was a straightforward tutorial, despite <a href="https://docs.mapbox.com/mapbox-gl-js/overview/">the documentation</a> being very good.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bUzd-OPWdqWf_VxjbiHhoQ.png" /><figcaption>The main screen of the Bodega Cat Pokedex. All styling on the map was provided by MapBox though icons are custom and any styles not directly on the map</figcaption></figure><p>As with most APIs, your first step is going to be registering in order to get an access token. I personally use <a href="https://medium.com/www.npmjs.com/package/dotenv">dotenv</a> and keep my token in a gitignore in order to prevent any internet shenanigans or unexpected bills — I would highly highly recommend you not publicly commit any tokens to GitHub ever. Doing so would be the programming equivalent of making a bunch of copies of keys to your apartment then dropping them in a big pile on the street outside your building. Bad idea.</p><p>Once you’ve acquired and hidden your token, the next step is to choose the style of your map. Again, MapBox makes this really easy for us by giving a list of <a href="https://studio.mapbox.com/">pre-made stylesheets</a> that we can grab and drop into our application. These range from aerial photography to highly stylized pencil sketch themed maps. In the above image, I’m using a customized stylesheet based off the “Le Shine” sheet provided by MapBox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*1CEny2jVLS8jDy2RYXl5OA.png" /></figure><p>After you’ve chosen your style sheet and gotten your token, it’s time to get your map on screen. We’re going to start in App.js and import React, useState, and ReactMapGL at the top of our file before we write anything else. Next we need to set the viewport and give it the ability (or not give it the ability) to move around the screen and allow users to interact. Because we’re working with mapping, we use latitude, longitude, and zoom to determine where our initial center of our map is and how much of the surrounding area you can see. This is all set inside the useState hook — without going into too much detail about hooks because there are many better blogs explaining them, useState allows us to ‘hook into’ state and use it inside our functional component. If you’ve already added a &lt;ReactMapGL&gt; component to App’s render method, at this point you should be seeing a map! If you copied the coordinates I added in the above example, you will be centered on DUMBO in New York. Don’t forget to set an onViewportChange inside of your actual map component so your map will automatically re-render as you move around the world. Below you can see what my app’s render method looked like — most of the logic of the app is in the container where we pull in a list of bodegas and create the &lt;Marker &gt; and &lt;Popup &gt; components that are ubiquitous to mapping applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*T_LOVg1ZSpati49XCPuBdA.png" /><figcaption>What’s actually being rendered in the BodegaCatPokedex App.js</figcaption></figure><p>Of course, what good would a mapping application be if we couldn’t see markers on our map and be able to interact with those as well? Thankfully, ReactMapGL comes with components for both Markers and Popups built in so in whichever container we’re going to have hold these, we just import these like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*F_O4w34kvivRHnvPnOZb7g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*j8vcIX16BJUGL9fioBdcNw.png" /></figure><p>Easy! The most obvious use I found for Markers was to have them render after mapping through some collection of data that I was pulling in. In my case, I had a backend set up that held bodegas in NYC. Each bodega had a latitude and a longitude so when I mapped through the collection, it was fairly simple to stop at each element and create a Marker component at the given bodega’s latitude/longitude. In addition, if you want your individual markers to display some sort of popup, you’re going to have to use state again and create some sort of “selected bodega” state, probably using a callback. In the example above, each Marker that’s being created is given an onClick to make it the selected bodega in state — each Marker is represented by ‘shopImg’ inside of a button that is styled to be invisible so each ‘shopImg’ is essentially a button inside of the Marker.</p><p>Congrats! After following these steps, you should now have a map, centered where you’d like, with icons that YOU chose, that do something YOU DECIDED on click! You’ve got a map!</p><p>If you’d like to know more about MapBoxGL, I highly recommend reading their docs or watching <a href="https://www.youtube.com/watch?v=JJatzkPcmoI&amp;t=1087s">this video</a> from Leigh Halliday which was a HUGE help in getting me started. Feel free to checkout the Github repo I linked above as well or reach out to me with questions, concerns, or any job offers! Happy coding, now go forth and do great things; the day is yours.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff04e06656ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Endorsements]]></title>
            <link>https://medium.com/@rossperkel/automating-endorsements-eaa06fa93c3a?source=rss-ea37e17ee1b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/eaa06fa93c3a</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[linkedin]]></category>
            <category><![CDATA[endorsements]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ross Michael Perkel]]></dc:creator>
            <pubDate>Mon, 02 Dec 2019 15:14:03 GMT</pubDate>
            <atom:updated>2019-12-02T15:14:03.963Z</atom:updated>
            <content:encoded><![CDATA[<p>Like it or not, keeping a well maintained and active LinkedIn is now a standard part of job searching. As I’ve been going through this process myself, I’ve often found myself wondering if there weren’t certain parts of it that could be easily automated, like for instance, endorsements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LAE3JuKWxeeO0KnQ_IRcoA.png" /><figcaption>An example of what endorsements could look like. I’ve really gotta get those numbers up 🏋🏻</figcaption></figure><p>For the uninitiated, every personal page on LinkedIn has a section where the page owner can list their skills and other users who they are connected with can “endorse” them for this skills; it’s essentially a confirmation that says to outside eyes “Yes, I know this person has XYZ skills.” People endorse each other for all sorts of reasons, the most altruistic being that they want to help out a friend or colleague and the most jaded reasons being reciprocal endorsing.</p><p>Of course, going to each person’s page and selecting which skills you know they have gets tiresome very quickly and often feels arbitrary — why would I endorse someone for HTML vs HTML5 or something of the sort? As I sat and wondered on this one morning, I decided to open my Chrome console and see if there was a better way to give endorsements.</p><p>When you go to a user’s page (other than your own) and open the endorsements section, you’ll see the buttons that you will need to press to “give” that endorsement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*StPeSoxxf0sOOXmVeUpswA.png" /><figcaption>In this case, we’re looking at a user named Janet’s endorsement button for “Web Applications”.</figcaption></figure><p>After looking at a few of these buttons, I realized quickly that they all had the class “<em>pv-skill-entity_featured-endorse-button-shared</em>”. For me, this was the major aha moment of the project; just by using this shared class, I could get all the elements with this class name and store them in a variable to do my endorsing.</p><pre>var skills = document.getElementsByClassName(&#39;pv-skill-entity__featured-endorse-button-shared&#39;);</pre><p>If we were to console log this now, we would show X number of buttons where X is equal to however many skills the user has listed on their profile. Those familiar with Javascript should be able to see where this is going at this point. Using a for loop, we can visit each button and do our ‘endorsing’ fairly easily.</p><pre>var skills = document.getElementsByClassName(&#39;pv-skill-entity__featured-endorse-button-shared&#39;);</pre><pre>for(i=0; i&lt;skills.length; i++){<br>//code TK below<br>}</pre><p>Now that we’re visiting each button, let’s do some clicking. My first approach was simple - why not just do:</p><pre>skills[i].click()</pre><p>When I ran this script on my friend Janet’s page, it did ‘click’ all of the skills that she had listed; unfortunately, this meant that the skills I had already endorsed her for non-programmatically were now removed! Oh no! How could I check which skills were already endorsed and if they were, skip the click? Accessibility to the rescue!</p><p>If you’re not already familiar with <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA">Aria</a>, it is one of the key ways that we make the internet accessible to all users of different sets of abilities. From the docs:</p><blockquote>“It supplements HTML so that interactions and widgets commonly used in applications can be passed to assistive technologies when there is not otherwise a mechanism. For example, ARIA enables accessible navigation landmarks in HTML4, JavaScript widgets, form hints and error messages, live content updates, and more.”</blockquote><p>If you go back to the above screenshot of our button, you can see that it already has two aria HTML attributes: <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute">aria-label</a> &amp; <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role">aria-pressed</a>. Label is for screen readers so it is not what we’re looking for but pressed holds a value of true/false that denotes whether our button has been pressed or not. Sounds like exactly what we’re looking for. To get the value of an attribute, we can use the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute"><strong>getAttribute</strong></a><strong> </strong>method.</p><p>If we haven’t endorsed them for this skill, the value comes back false and if we have, it returns as true. This sounds like a perfect case to add an <strong>if </strong>statement inside of our for loop.</p><pre>var skills = document.getElementsByClassName(&#39;pv-skill-entity__featured-endorse-button-shared&#39;);</pre><pre>for(i=0; i&lt;skills.length; i++){<br>   if(skills[i].getAttribute(&quot;aria-pressed&quot;) == &quot;false&quot;){<br>      skills[i].click()<br>   }<br>}</pre><p>Now our code basically says:</p><ol><li>Grab all the skills and save in a variable</li><li>Visit each skill stored in skills</li><li>At each skill, check the value of the “aria-pressed” attribute</li><li>If the value is equal to false, click the button to make it true. if it’s already true, do nothing.</li></ol><p>But we wouldn’t really be programming if we still have to do all the work of scrolling to each individual person’s skills and manually opening that section, would we? Who wants to do manual clicking? Same pattern follows:</p><pre>var targetButton = document.getElementsByClassName(&quot;pv-profile-section__card-action-bar pv-skills-section__additional-skills&quot;)</pre><pre>if(targetButton[0].getAttribute(&quot;aria-expanded&quot;) == &quot;false&quot;){<br>  targetButton[0].click()<br>}</pre><pre>var skills = document.getElementsByClassName(&#39;pv-skill-entity__featured-endorse-button-shared&#39;);</pre><pre>for(i=0; i&lt;skills.length; i++){<br>   if(skills[i].getAttribute(&quot;aria-pressed&quot;) == &quot;false&quot;){<br>      skills[i].click()<br>   }<br>}</pre><p>And voila! We still have the minor caveat of having to scroll to look at each person’s endorsements . Though I plan on implementing that next, we already have a much faster and more fun way to let your friends know that you believe in them and their skills! Now go forth and endorse!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3kuSo744UIPJjcJUEn%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2FMaxisOfficial-approved-chopped-stamped-3kuSo744UIPJjcJUEn&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3kuSo744UIPJjcJUEn%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/6da186677a176c036a08d9edd90c37ff/href">https://medium.com/media/6da186677a176c036a08d9edd90c37ff/href</a></iframe><p>p.s. special thanks to Janet Mendez for letting me make a mess of her endorsements as I was testing and for pointing out edge case uses to me! She’s a great <a href="https://www.linkedin.com/in/janetmndz/">front-end dev</a> and <a href="https://codepen.io/janmez/">CSS queen</a> who is also looking for work!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eaa06fa93c3a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My First Song: Tips and Tricks for SonicPi]]></title>
            <link>https://medium.com/@rossperkel/my-first-song-tips-and-tricks-for-sonicpi-9fdf089e2211?source=rss-ea37e17ee1b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fdf089e2211</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[sonicpi]]></category>
            <category><![CDATA[synthesizers]]></category>
            <category><![CDATA[music]]></category>
            <category><![CDATA[livecoding]]></category>
            <dc:creator><![CDATA[Ross Michael Perkel]]></dc:creator>
            <pubDate>Wed, 09 Oct 2019 14:40:44 GMT</pubDate>
            <atom:updated>2019-10-10T01:44:30.718Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/467/0*usolWDTmjFKuBKz6.png" /></figure><p>For those who haven’t already heard of <a href="https://sonic-pi.net/">SonicPi</a>, I recommend checking out <a href="https://medium.com/@rossmichael/sonic-punk-b94fc25c70dd">my previous blog post</a> on the topic that gives a brief overview of what the software does, some basic learning I went through when “covering” my first songs and a bit of background on synthesized music. This post is going to be aimed more at those who are looking to get started with creating their own original compositions or who are interested in live coding performances.</p><p>First of all, as you may expect, the docs and the official community page are great places to start looking for tutorials and techniques you can apply to your nascent compositions. I did not know/think to check if these existed when I was first getting started; I would have pulled out far less of my own hair had I begun my learning <a href="https://in-thread.sonic-pi.net/">here</a>, rather than trying to literally play it by ear.</p><p>Much like IRL music, a logical place to start is with the rhythm section: we need to keep a beat and we want to make sure everything is synced up. Let’s get some hats here to give us a metronome. Because I like to move it, move it, we’re gonna be using a BPM of 94.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*4Qujc5wW4pdEfGIsMTQ-0g.png" /><figcaption>Simple, metronomic hats</figcaption></figure><p>Sick — let’s get a kick in there now. Normally, we use the kick to find beat one so it kinda makes sense to put it there but we’re programmers and because our computer keeps time for us, we can kinda drop it anywhere. or simplicity’s sake, we’re going to leave it on beat one; no need to fight our body’s inherent desire to keep time as well as try and code something hard. While we’re at it, why don’t we make out metronome into something a little more pleasant to listen to?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*6QQOxThNs00BERKf8xLitA.png" /><figcaption>Nice! Da-da-da-da-roll!</figcaption></figure><p>Here’s as good a time as any to introduce some of the hot keys and really dig down into what exactly is going on in our code. Let’s go keyword by keyword:</p><p><strong>use bpm</strong>: This is what sets our initial tempo. If you’ve never done anything musical before, bpm is an acronym for beats per minute.</p><p><strong>X.times</strong> : X.times is again, fairly straightforward once you think about it musically. How many times are we going to repeat this subpattern within our loop before we move on to the next subpattern?</p><p><strong>sample : </strong>This is where we actually assign the sound that we’re going to use — in this case, we are using a snare, a hi-hat pedal, and a kick drum.</p><p><strong>one_in( ) : </strong>One in is an easy way to add randomization into our music. Given an integer argument, the function takes a “one in x” chance at playing. The way I typically use it is after an <strong>if </strong>statement.</p><p><strong>tick : </strong>Instead of using incremental counters that we have write out every time, tick automatically does this for us. We can tick through chords, scales, patterns, anything!</p><p><strong>sleep : </strong>Sleep is one of the harder concepts to grasp at first; think of it not as “we have X beats of silence” but rather “we have x beats immediately following this note and then something else happens”.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F57n8B4SoyreVO%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F57n8B4SoyreVO%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F57n8B4SoyreVO%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="247" frameborder="0" scrolling="no"><a href="https://medium.com/media/c81a7d68bf1fc305945797c90d608485/href">https://medium.com/media/c81a7d68bf1fc305945797c90d608485/href</a></iframe><p>Still with me? These are the basic building blocks with which we’re going to build our compositions. Other important methods to know that are somewhat self explanatory are <strong>play </strong>(takes in either a note name or numerical value), <strong>play chord</strong>(takes in a chord name and a scale), and <strong>play_pattern_timed </strong>(takes in either a chord or scale plus optional added timing options). If you call <strong>play_pattern,</strong> SonicPi will default to adding a sleep 1 command between each note.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/0*rdEtS8GPxAUhXxM4.jpg" /></figure><p>Before we list anymore methods without context, it may help to understand the data structures that are being manipulated with all of these methods. Behind the scenes, chords and scales are actually predefined rings (a ring is an immutable looping array — there is no index value that would return nil because the array loops back on itself) of MIDI values. For those with musical theory, middle C is actually read by the computer as 60. The example from the docs that really hammered this home for me was the comparison between the two following blocks of code:</p><pre>play_pattern_timed chord(:E3, :m7), 0.25</pre><p>All we’ve done is asked to play an arpeggio across the E3 major7 chord with 0.25 beats of sleep between each note. The exact same code written below, without use of predefined chord arrays and pattern mapping:</p><pre>play 52<br>sleep 0.25<br>play 55<br>sleep 0.5<br>play 59<br>sleep 0.25<br>play 62<br>sleep 0.5<br>play 66<br>sleep 0.25<br>play 69<br>sleep 0.5<br>play 73</pre><p>Understanding these data structures and being able to combine them with randomization is when SonicPi gets really fun really fast.</p><p>Another useful trick here is adding some randomization into your generated music through the <strong>choose </strong>method. Choose will select a random note from an array passed to it and play it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*p8VBxFme-rv1FqcKh66dJg.png" /><figcaption>Choose!</figcaption></figure><p>Of course, saying that certain methods are more important than others makes very little sense in such a subjective field but these methods seem to be the basis of most of the compositions I’ve found myself making. Beyond just the basic methods, what gives our compositions color, emotion and variety are the envelopes we apply to each sound. “But Ross, envelopes are for letters, not sounds!” you say incredulously.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F25aFms4yu9UidfGgL9%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F25aFms4yu9UidfGgL9%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F25aFms4yu9UidfGgL9%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/f16134befe879932c4a244f5b3345c60/href">https://medium.com/media/f16134befe879932c4a244f5b3345c60/href</a></iframe><p>Dad jokes aside, an <a href="https://en.wikipedia.org/wiki/Envelope_(music)">envelope</a> is essentially a filter that we pass our sound wave through before it is output. Playing a single key on a real piano lets you hear a note that slowly decreases in amplitude which is already an envelope. Controlling envelopes that we generate is a standard feature of most synthesizers.</p><h4>Envelope Controls</h4><p><strong>Attack</strong>: How fast we’re going to get to our <strong>attack level</strong></p><p><strong>Attack Level</strong>: What the amplitude of our sound will actually be</p><p><strong>Decay</strong>: How fast our sound will lower in volume to our <strong>sustain level</strong></p><p><strong>Sustain Level</strong>: Volume our sound will hold at</p><p><strong>Sustain</strong>: Duration of the amplitude</p><p>There are many more controls than just these few listed above but again, these are the ones I most often found myself falling back on to control the envelope. If you’re fuzzy on exactly how these all relate to each other, I highly recommend going into the envelope section of <a href="https://sonic-pi.net/tutorial.html">SonicPi’s docs</a> where there is no shortage of graphs and explanations for everything envelope related.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F1gUqDlJzESlrO08RbZ%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F1gUqDlJzESlrO08RbZ%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F1gUqDlJzESlrO08RbZ%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="299" frameborder="0" scrolling="no"><a href="https://medium.com/media/768e1339b7a342ac5e1a7454fc86c0b3/href">https://medium.com/media/768e1339b7a342ac5e1a7454fc86c0b3/href</a></iframe><h4>Synths and Samples</h4><p>This is where most of your sonic exploration will come in; preloaded into Sonic Pi are a variety of synths that you can mess around with just using envelopes. The legendary <a href="https://en.wikipedia.org/wiki/Prophet-5">Prophet</a> and the <a href="https://en.wikipedia.org/wiki/Roland_TB-303">Roland TB-303</a> both come stock though it’s fairly easy to load in your sounds using a file path system you’re probably familiar with from the command line. Some of my favorite sounds here are actually taking the noises from the :bd_mehackit samples (sounds like an assembly line) and repurposing it to make some robotic rhythms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*zgJwQxHf_K9GUeoB-lw4og.png" /><figcaption>You DO NOT have to apply any envelopes to a sound though here you can see I’ve done a bit of controlling of the amplitude of each sound.</figcaption></figure><h4>Threads</h4><p>As you progress you’re going to want to layer sounds. Sonic Pi makes this super easy. You’ll almost immediately run into The Rhythm Problem. If each times you run your code, you create a whole new layer of sound, you need to make sure that all of these layers are in sync with each other. Rather then relying on your sense of timing, just use a <em>in_thread do…end </em>block. Each time your code is run, a thread is created. To make sure these are all threaded together, each new layer needs to be wrapped in an <em>in…thread </em>block.</p><h4>Going Forward</h4><p>Obviously, it’s out of the scope of this brief blog to make you an expert in this deep and nuanced software (or in Ruby which DEFINITELY helps to understand this) but hopefully this has provided a jumping off point from which you can create compositions of your own! Next topics I’d recommend looking into are effects (SonicPi comes with a whole mess of fx of varying levels of useful), in thread looping ( allows you to write and sync multiple loops from different places in the program) and practicing live coding!</p><p>p.s. If you actually made it this far, you may be wondering what the discrepancy between my code screen shots and snippets. Read the section of the docs on <a href="https://sonic-pi.net/tutorial.html#section-9-2">live_loop</a> — I was using it for about a month without really understanding what it was doing and writing this blog forced me to go under the hood; live_loop is the Rails to all of the above Sinatra. Of course there was a better way.</p><p>Feel free to reach out to me with any questions, compositions or kind words inspired by my overview! Now, go do great things!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fdf089e2211" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Big O]]></title>
            <link>https://medium.com/@rossperkel/the-big-o-fc0b18e42796?source=rss-ea37e17ee1b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc0b18e42796</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[big-o-notation]]></category>
            <dc:creator><![CDATA[Ross Michael Perkel]]></dc:creator>
            <pubDate>Mon, 30 Sep 2019 20:46:01 GMT</pubDate>
            <atom:updated>2019-09-30T20:46:01.454Z</atom:updated>
            <content:encoded><![CDATA[<p>A common topic for programming interviews that seems far more daunting than it is in theory is the idea of Big O Notation. The term refers to the limiting behavior of a function when the argument approaches an arbitrarily large number or infinity. Basically, given a set of data, what’s our worst case for finishing evaluating it — that’s our Big O.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fl0IypeKl9NJhPFMrK%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fl0IypeKl9NJhPFMrK%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2Fl0IypeKl9NJhPFMrK%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="254" frameborder="0" scrolling="no"><a href="https://medium.com/media/9cb73554d97c43af04fdd6b1b14b30f7/href">https://medium.com/media/9cb73554d97c43af04fdd6b1b14b30f7/href</a></iframe><p>What this really means in layman’s terms is if I have an algorithm and an infinitely large number of inputs, how long it would take to complete is our Big O.</p><p>An algorithm, as you likely know if you’re reading this, is not necessarily a mathematical equation, though we most often think of them this way. Rather, an algorithm should be thought of as a pattern or set of instructions for sorting through a given set of inputs.</p><p>The concept is by no means a modern one; we get the word “algorithm” from <a href="https://en.wikipedia.org/wiki/Muhammad_ibn_Musa_al-Khwarizmi">Muhammad ibn Musa al-Khwarizmi</a> whose book <a href="https://en.wikipedia.org/wiki/The_Compendious_Book_on_Calculation_by_Completion_and_Balancing"><em>Al-Jabr</em></a><em> </em>gave the western world algebra. Some of the earliest known algorithms (and <a href="https://en.wikipedia.org/wiki/Euclidean_algorithm">common</a> <a href="https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes">interview</a> <a href="https://en.wikipedia.org/wiki/Fibonacci_number">questions</a>) come to us from the Greeks, <a href="https://en.wikipedia.org/wiki/Euclid">Euclid</a> and <a href="https://en.wikipedia.org/wiki/Eratosthenes">Eratosthenes</a>. Patterns for solving problems have been around for as long as humanity; Big O Notation is simply a convenient way to talk about the time it will take for our algorithm to do it’s work. When we talk about these measures of time, there are four main measures of time: Constant, Linear, Exponential, and Logarithmic.</p><h4><strong>Constant Time</strong></h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FjLBGwfQiafJwA%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FjLBGwfQiafJwA%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FjLBGwfQiafJwA%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="348" frameborder="0" scrolling="no"><a href="https://medium.com/media/de1a2aef0836197efb58baca012d462b/href">https://medium.com/media/de1a2aef0836197efb58baca012d462b/href</a></iframe><p>Constant time occurs in Big O when an algorithm takes the same amount of time to complete no matter the size of the input. This is pretty rare because most of the time, an algorithm involves multiple steps so it is uncommon that we have something that takes the same time to complete regardless of size. Think about a restaurant: If I go in an order one bowl of spaghetti, it will probably take them 30 minutes to make the order. If I go in and order 15 bowls, it will likely take a bit longer. Here, our O of N is probably linear (<em>O(N)</em>)or logarithmic (<em>O(log N)</em>), depending on the skill of our chef.</p><p>But wait! What if our our restaurant has been visited by the magical spaghetti fairy and has been gifted a button that will automatically produce however bowls of spaghetti you tell it to when you press the start button? All of a sudden, because of this magic button, we have constant O of N: <em>O(1)</em>.</p><pre>giveMeTheFirstElement(array){<br>    console.log(array[0])<br>}</pre><pre>// If called, this would have a Constant O of N - no matter how large the array, it will always take the same amount of time to complete. </pre><p>Now, it doesn’t matter how large our input is, our time is always the same. In code, this might look something like always pulling a certain indice of an array or reversing a string.</p><h4>Linear Time</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FXOL1CTjID2G52%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FXOL1CTjID2G52%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FXOL1CTjID2G52%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="272" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c086a8228d203eb94ea172b1aca5554/href">https://medium.com/media/4c086a8228d203eb94ea172b1aca5554/href</a></iframe><p>Linear time is found when the size of the input causes the time taken to evaluate to rise at a linear rate, or exactly proportionally. To go back to our spaghetti example: If every time our chef gets an order for a bowl of spaghetti, he begins by boiling water and making the whole thing from scratch, this would be an example of linear time. Because he is repeating the same steps each time the input grows, it would take our chef a linear amount of time to complete our obnoxious order. Our O of N in this scenario would be : O(N). As N (input size) grows, our time to output is always multiplied by O. As a general guideline, this is the time complexity we should be aiming for though it will often require us to refactor another solution to get to linear. In code, this could take the form of grabbing every index in an array or some such iteration that is directly proportional to the size of the input.</p><pre>doubleMyNum(array){ <br> for(i=0;i&lt;=array.length;i++){<br>      console.log(array[i]*2)<br>}</pre><pre>// If called, this would have a Linear O of N - as the rray grows larger, it takes a proprtional amount of time to complete the function.</pre><h4>Logarithmic Time</h4><p>Logarithmic time is one of the more difficult to conceptualize but what it essentially boils down to is a function where we do some work, pause and look around to see how close we got to our final goal, do more work based off our current state, and continue so on. In our spaghetti analogy, our chef is going to perform a lot of prep work before guests come to his restaurant and may have some pasta ready when we order. Because of this prep, there may be a bit of a wait at the beginning but as more orders come in, the chef will be able to keep his time to table low by staggering the steps to service.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fl2Je66zG6mAAZxgqI%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fl2Je66zG6mAAZxgqI%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2Fl2Je66zG6mAAZxgqI%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="331" frameborder="0" scrolling="no"><a href="https://medium.com/media/5bb5441ef6ad2b6d80a316f790ea2963/href">https://medium.com/media/5bb5441ef6ad2b6d80a316f790ea2963/href</a></iframe><p>A more common example that you will see in code is a <strong>binary search tree</strong> wherein we are given a large array and tasked with performing some work on a certain element of it. Rather than searching through each element until we find our target, we may start in the middle, evaluate if our target is ahead or behind us, and work back from there. A much better example than cooking a lot of spaghetti would be finding a word in a dictionary!</p><p><strong>Exponential Time</strong></p><p>Exponential time is not quite the worst time we could have but it is rarely a good thing. Typically, exponential O of N occurs when we have a loop inside of a loop: because we are doing some work to each thing inside of a another loop of work doing something to a bunch of somethings, our time goes up exponentially for each input added.</p><p>To return to the kitchen: Last night our chef had a radical experience and decided that he needed to make sure each plate was perfect before going out — now, before each plate goes out into our restaurant, our chef is going to individually garnish each strand of spaghetti with an amount of our special spice exactly proportional to the length of the strand. Not only are we going to be making each dish, but we are going to be going into each dish, visiting each strand of spaghetti, measuring it, calculating how much spice we need, applying the spice and then serving the dish. It is easy to see how this work will quickly pile up as our orders get larger.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FqL4stkxLFYo6s%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FqL4stkxLFYo6s%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FqL4stkxLFYo6s%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="617" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb0920a776917a5d4c6a7893eba15b1e/href">https://medium.com/media/cb0920a776917a5d4c6a7893eba15b1e/href</a></iframe><p>In a dictionary example, this might look something like if we needed to print X number of dictionaries, but every copy we printed had an extra “e” at the beginning of every e-word. Our job is go through each book after it is printed and change the section back to the correct spellings.</p><p>To the left, you can a stylized version of an exponential growth equation, in this case showing the growth of computing power over the last century. As time has passed and our computing power has grown, the rate at which our power has grown is exponential because of the previous advances — as our power grows, it snowballs and grows faster; exponentially!</p><pre>fibonacci(num){<br>  if(num &lt;=1){<br>    return num<br>  }<br>  else{<br>    return fibonacci(n-2)+fibonacci(n-1)<br>  }<br>}</pre><pre>//The recursive solution to the Fibonacci sequence is an example of exponential time. As &#39;num&#39; gets larger, it will take exponentially longer to calculate because we are recursively going in and using a calculation in another calculation. </pre><p>As you can see, measuring the speed of algorithms is tricky but can be understood more easily by breaking down the steps and analyzing what actually needs to be done to solve each of our problems. If you are a more graph oriented person, below you can see a comparison of the number of operations (N) that will be performed to complete an algorithm graphed according to the input size (n) of that algorithm.</p><figure><img alt="Graphs of functions commonly used in the analysis of algorithms, showing the number of operations N versus input size n for e" src="https://cdn-images-1.medium.com/max/800/0*zr8d-1e29BUrPTBE.png" /><figcaption>Graphs of functions commonly used in the analysis of algorithms, showing the number of operations <em>N</em> versus input size <em>n</em> for each function</figcaption></figure><p>Hopefully this brief introduction to Big O was helpful — thankfully, you are not the only one curious about it and there are tons of resources freely available that can help you to understand the intricacies of the topic. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc0b18e42796" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>