<?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[Heroic Engineering - Medium]]></title>
        <description><![CDATA[Win or Learn stories from the engineering team of Heroic. - Medium]]></description>
        <link>https://medium.com/heroic-engineering?source=rss----32d6fedb0c1b---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Heroic Engineering - Medium</title>
            <link>https://medium.com/heroic-engineering?source=rss----32d6fedb0c1b---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 20:22:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/heroic-engineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using EventEmitter in NodeJs]]></title>
            <link>https://medium.com/heroic-engineering/using-eventemitter-in-nodejs-5265522e8705?source=rss----32d6fedb0c1b---4</link>
            <guid isPermaLink="false">https://medium.com/p/5265522e8705</guid>
            <category><![CDATA[separation-of-concerns]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Yuva Peavler]]></dc:creator>
            <pubDate>Thu, 20 Jun 2024 19:27:01 GMT</pubDate>
            <atom:updated>2024-06-20T19:27:01.781Z</atom:updated>
            <content:encoded><![CDATA[<h4>When and how to use Events?</h4><blockquote><strong>Separation of concerns</strong> is a design principle that states that a software system should be separated into distinct sections, each of which addresses a separate concern. This allows for the development of a system that is more modular, easier to understand, and easier to maintain. It is often achieved by dividing a system into layers or components, each of which handles a specific set of functionality or responsibility. Examples of concerns that can be separated include data management, user interface, and business logic.</blockquote><p>Event driven development is one of the ways to achieve separation of concern. Events pattern helps declutter the services, make testing easy, make it easy to share code between services instead of creating dependency spider web.</p><p>In this article we are specifically looking at <a href="https://github.com/EventEmitter2/EventEmitter2">EventEmitter2 </a>library in NodeJs.</p><h4>Emitting Events</h4><p>An event can be emitted using either emit or emitAsync. Note that this is independent from how the listeners of this event process the event.</p><pre>var EventEmitter2 = require(&#39;eventemitter2&#39;).EventEmitter2;<br>var emitter = new EventEmitter2({<br>  wildcard: false,<br>  delimiter: &#39;.&#39;, <br>  maxListeners: 10,<br>});<br>export const SUBSCRIPTION_CREATED_EVENT = &#39;Subscription.Created&#39;;<br><br>// Raising the event<br>await emitter.emitAsync(SUBSCRIPTION_CREATED_EVENT,<br>   new SubscriptionCreatedEvent(subscription.id, customerId, email));</pre><h4>Listening to Events</h4><p>There can be zero to any number of listeners for a given event. In this example, we can have an <em>emailListener </em>to send confirmation email, <em>provisioningListener </em>to provision entitlements when a subscription is created.</p><p>There are two ways to handle events in the context of a nodeJs backend server.</p><p><strong>Synchronous event handling </strong>— that happens immediately and within a given request.</p><ul><li>We can use this to organize the code that must execute with in a request.</li><li>Use this mechanism to untangle dependencies so services don’t reach into other services.</li></ul><pre>emitter.on(SUBSCRIPTION_CREATED_EVENT, handleUserIdentityCreatedEvent, {async: false} );<br><br>// Define a function that will be called when the &#39;SUBSCRIPTION_CREATED_EVENT&#39; event is emitted<br>const handleSubscriptionCreatedEvent = (payload: SubscriptionCreatedEvent) =&gt; {<br>  console.log(`SUBSCRIPTION_CREATED_EVENT was emitted`);<br>  console.log(payload);<br>}</pre><p><strong>Asynchronous event handling</strong> — that happens with in the same process.</p><ul><li>We can use this to perform actions that are side-effects to a main request.</li><li>Use this method of handling for CPU or I/O intensive operations that can happen after we respond to the request that initiated it.</li></ul><pre>emitter.on(SUBSCRIPTION_CREATED_EVENT, handleSubscriptionCreatedEvent, {async: true} );<br><br>// Define a function that will be called when the &#39;SUBSCRIPTION_CREATED_EVENT&#39; event is emitted<br>const handleSubscriptionCreatedEvent = (payload: SubscriptionCreatedEvent) =&gt; {<br>  console.log(`SUBSCRIPTION_CREATED_EVENT was emitted`);<br>  console.log(payload);<br>}</pre><p>The event driven model is not restricted to Events processed in the same processor. An async event processing can be done using queues. A simple way to perform one is by using redis and <a href="https://docs.bullmq.io/">bullmq</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5265522e8705" width="1" height="1" alt=""><hr><p><a href="https://medium.com/heroic-engineering/using-eventemitter-in-nodejs-5265522e8705">Using EventEmitter in NodeJs</a> was originally published in <a href="https://medium.com/heroic-engineering">Heroic Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Overcoming stereotype threat in coding interviews]]></title>
            <link>https://medium.com/heroic-engineering/overcoming-stereotype-threat-in-coding-interviews-fa171cc327b2?source=rss----32d6fedb0c1b---4</link>
            <guid isPermaLink="false">https://medium.com/p/fa171cc327b2</guid>
            <category><![CDATA[stereotypes]]></category>
            <category><![CDATA[women-in-tech]]></category>
            <category><![CDATA[technical-interview]]></category>
            <category><![CDATA[stereotype-threat]]></category>
            <dc:creator><![CDATA[Yuva Peavler]]></dc:creator>
            <pubDate>Thu, 20 Jun 2024 19:26:55 GMT</pubDate>
            <atom:updated>2024-06-20T19:26:55.087Z</atom:updated>
            <content:encoded><![CDATA[<p>Yet another obstacle for women in tech</p><blockquote>Stereotype threat has been demonstrated to negatively affect certain racial/ethnic groups when they become hyper-aware that their performance could confirm the very stereotype that they wish to avoid. The pressure to not conform to the stereotype creates anxiety, which in turn adversely affects performance.</blockquote><p>I recently listened to <a href="https://www.ted.com/podcasts/breaking-free-of-stereotype-threat-claude-steele-transcript">Adam Grant’s podcast episode on Stereotype Threat with guest Claude Steele</a>. I cannot stop thinking about the similarities between stereotype threat that caused women to perform 15% lower in SAT scores to what&#39;s happening now with tech recruitment. See if you can spot it too.</p><h4>The symptoms of the threat</h4><ol><li>Shift from doing the task to worrying about how you are doing the task.</li><li>More interest in the outcome of the test increases the stress.</li><li>Lots of worrying about performance interferes with the functioning of the pre-frontal cortex raising anxiety and inability to recall.</li></ol><p>When we are tested in something that we have invested lot of time and effort into and identify ourselves with like a career as a software developer, the stereotype threat becomes very real. There is a constant worry about our performance in an interview test environment not reflecting what you can do.</p><h4>Women in Software Development</h4><p>As women in a very male dominated domain, we feel the need to beat a few stereotypes.</p><ol><li><a href="https://www.wired.com/video/watch/women-engineers-on-the-rampant-sexism-of-silicon-valley">Women in tech roles are incompetent</a>.</li><li>Women are hired for diversity rather than qualifications.</li></ol><p>However, when we buckle down and actively try to beat the stereotype, we tend to burn out. It is a self-fulfilling prophecy. More women exit the Software Engineering profession due to<a href="https://www.cio.com/article/201905/women-in-tech-statistics-the-hard-truths-of-an-uphill-battle.html"> lack of support, lack of representation and simply lack of understanding</a>.</p><figure><img alt="https://info.celential.ai/gender-diversity-in-software-engineering-report-2022" src="https://cdn-images-1.medium.com/max/1024/0*HPwQeqkn-4WsBEUQ.png" /><figcaption><a href="https://www.celential.ai/blog/percentage-of-female-software-engineers/">https://www.celential.ai/blog/percentage-of-female-software-engineers/</a></figcaption></figure><h4>The abomination that is live coding interviews</h4><p>WHY? I understand if your company is Google or Amazon where you have to wade through thousands of applicants and an online coding test will help narrow the candidate pool.</p><p>I have noticed even a small team with 10 engineers tend to practice this awful ritual called live coding challenges. What you get in a live coding challenge is a snapshot of someone’s performance in that particular moment which happened to be a high stress and high anxiety inducing coding test. Saying that the performance in that 30 mins is indicative of a person’s coding abilities is like saying one’s IQ score is an all-encompassing indication of one’s intellectual ability.</p><p>With stereotype threat, this interview format has added yet another obstacle for women to stay in software development domain. As a very anxious person in-general, I do not fare well in live coding interviews. At first, the rejections made me question my abilities as an engineer. It took few years to learn to not place my identity on work and my ability on coding tests.</p><h4>Overcoming the stereotype threat in interviews</h4><p>As much as I would like to see the practice of live coding interviews go away, we won’t be able to avoid it for the foreseeable future. A few ways to overcome the threat as discussed by Adam Grant and Claude Steele.</p><ol><li>Get perspective. This one performance is not indicative of my ability.</li><li>Practice. We only interview a handful of times in our career. Train the brain to not go into fright or flight mode by practicing and getting familiar with the interview format.</li><li>Self-Affirmation. What other domain in life am I good at?</li></ol><blockquote>According to self-affirmation theory, when people experience a stereotype threat they can reaffirm the self even in a domain unrelated to the stereotyped domain. For example, an African American student who is stereotyped by his teacher as unintelligent can reaffirm the self by thinking about how great he is at negotiating interpersonal conflict. — Claude Steele</blockquote><h4>What can we do to help?</h4><p>Stay tuned for the next article that talks about individual and organizational contribution to reduce the stereotype threat.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa171cc327b2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/heroic-engineering/overcoming-stereotype-threat-in-coding-interviews-fa171cc327b2">Overcoming stereotype threat in coding interviews</a> was originally published in <a href="https://medium.com/heroic-engineering">Heroic Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Postman Collections with GitHub Actions CI/CD pipeline]]></title>
            <link>https://medium.com/heroic-engineering/integrating-postman-collections-with-github-actions-ci-cd-pipeline-cb7f14ae4c03?source=rss----32d6fedb0c1b---4</link>
            <guid isPermaLink="false">https://medium.com/p/cb7f14ae4c03</guid>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[postman-testing]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[postman-collections]]></category>
            <dc:creator><![CDATA[Yuva Peavler]]></dc:creator>
            <pubDate>Thu, 20 Jun 2024 19:26:35 GMT</pubDate>
            <atom:updated>2024-06-20T19:26:35.645Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0_uLkxfCOPxppHsfw45X1A.jpeg" /><figcaption>Sample CI pipeline with postman collection run.</figcaption></figure><p>Integrating Postman collections with GitHub CI pipelines can significantly enhance the efficiency of API testing. This article will guide you through the process of adding Postman collections with tests to your GitHub CI pipeline, enabling automated testing and ensuring the quality of your APIs.</p><h3>Add tests to postman collections.</h3><p>Before integrating with GitHub CI, ensure you have a Postman collection containing the API requests you want to test along with associated tests. <a href="https://www.postman.com/postman/workspace/test-examples-in-postman/collection/1559645-142a747b-0386-4aa2-9336-7db74659d496">Learn more about test syntax here.</a></p><p>These tests validate the responses received from the API endpoints, checking for expected status codes and responses.</p><p>Example test:</p><pre>const post  = _.get(pm.response.json(), &quot;data.createPost&quot;);<br><br>pm.test(&quot;Status code is 200&quot;, function () {<br>    pm.response.to.have.status(200);<br>});<br><br>pm.test(&quot;response should include post info&quot;, function () {<br>  pm.expect(post.postId).to.not.be.empty;;<br>  pm.expect(post.visibility).to.eq(&quot;FOLLOWERS&quot;);<br>  pm.expect(post.commentability).to.eq(&quot;FOLLOWERS&quot;);<br>  pm.expect(post.hashtags).to.not.be.empty;<br>  pm.expect(post.hashtags[0]).to.eq(&quot;omms&quot;);<br>});</pre><p>After adding tests for postman requests, group the requests into multiple logical collections.</p><h3>Export postman collections and environments.</h3><p>Create the following folder structure at the root and export all the collections with tests into the collections folder. Export the postman environment into the environment folder. Make sure to commit these folders in git.</p><pre>postman<br>   &gt; collections<br>     {} collection1.json<br>     {} collection2.json<br>   &gt; environments<br>     {} dev.json</pre><p>Example environment file.</p><pre>{<br> &quot;id&quot;: &quot;910db421-2c22-4b20-beff-c2a11e13666f&quot;,<br> &quot;name&quot;: &quot;Dev&quot;,<br> &quot;values&quot;: [<br>  {<br>   &quot;key&quot;: &quot;API_ORIGIN&quot;,<br>   &quot;value&quot;: &quot;https://api.example.us&quot;,<br>   &quot;type&quot;: &quot;default&quot;,<br>   &quot;enabled&quot;: true<br>  },<br> ],<br> &quot;_postman_variable_scope&quot;: &quot;environment&quot;,<br> &quot;_postman_exported_at&quot;: &quot;2023-09-25T16:51:10.398Z&quot;,<br> &quot;_postman_exported_using&quot;: &quot;Postman/9.21.5&quot;<br>}</pre><h3>Add script to run a group of collections.</h3><p>Add a file run-collections-in-directory.js with the following code.</p><pre>#!/usr/bin/env node<br>// File uses newman package from global.<br>// How to execute?:  NODE_PATH=$(npm root -g) node run-collections-in-directory.js -e ./environments/LOCAL.postman_environment.json<br>fs = require(&#39;fs&#39;);<br>newman = require(&#39;newman&#39;);<br><br>var argv = require(&#39;minimist&#39;)(process.argv.slice(2));<br>var folder = argv.f || &#39;./collections&#39;;<br>var env = argv.e || &#39;./environments/dev.json&#39;;<br>var help = argv.h || false;<br><br>if (help) {<br>  console.info(<br>    &#39;Options are \n 1. -f to specify the folder that contains postman collection json \n 2. -e to specify the environment json&#39;,<br>  );<br>  return;<br>}<br><br>fs.readdir(folder, function (err, files) {<br>  if (err) {<br>    throw err;<br>  }<br><br>  // we filter all files with JSON file extension<br>  files = files.filter(function (file) {<br>    return /^((?!(package(-lock)?))|.+)\.json/.test(file);<br>  });<br><br>  // now we iterate on each file name and call newman.run using each file name<br>  for (let i = 0; i &lt; files.length; i++) {<br>    let file = files[i];<br>    newman<br>      .run(<br>        {<br>          collection: require(`${folder}/${file}`),<br>          environment: require(`${__dirname}/${env}`),<br>          reporters: &#39;cli&#39;,<br>        },<br>        err =&gt; {<br>          if (err) {<br>            //Let GA know of the failure. Can comment the two lines below to run it locally.<br>            const core = require(&#39;@actions/core&#39;);<br>            core.setFailed(&#39;Newman run failed! &#39; + (err || &#39;&#39;));<br>            // End of GA specific code.<br>            console.info(`${file}: failed! ` + (err || &#39;&#39;));<br>          }<br>        },<br>      )<br>      .on(&#39;done&#39;, (err, summary) =&gt; {<br>        if (err || summary.run.failures.length) {<br>          //Let GA know of the failure. Can comment the two lines below to run it locally.<br>          const core = require(&#39;@actions/core&#39;);<br>          core.setFailed(&#39;Newman run failed! &#39; + (err || &#39;&#39;));<br>          // End of GA specific code.<br>          console.info(`${file}: failed!` + (err || &#39;&#39;));<br>        } else {<br>          console.info(`${file}: passed!`);<br>        }<br>      });<br>  }<br>});</pre><h3>Update GitHub Actions CI/CD Pipeline</h3><p>This article assumes prior knowledge of <a href="https://docs.github.com/en/actions/learn-github-actions">GitHub actions</a>.</p><p>Add the job to run postman tests.</p><pre>api-test:<br>    name: Run postman collection<br>    needs: deploy-dev<br>    runs-on: ubuntu-latest<br><br>    steps:<br>      - name: Check out repo<br>        uses: actions/checkout@v4<br><br>      - name: Setup NodeJS<br>        uses: actions/setup-node@v4<br>        with:<br>          node-version: &#39;18.17.0&#39;<br><br>      - name: Install newman<br>        run: |<br>          npm install -g newman<br>          npm install -g minimist<br>          npm install -g @actions/core<br><br>      - name: Run Postman Collection<br>        working-directory: ./postman<br>        run: |<br>          NODE_PATH=$(npm root -g) node run-collections-in-directory.js -e ./environments/dev.json</pre><p>Trigger the CI pipeline. Once the CI pipeline completes, review the test results in the GitHub Actions interface. Any failures or errors will be reported, indicating potential issues with the API endpoints or tests.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb7f14ae4c03" width="1" height="1" alt=""><hr><p><a href="https://medium.com/heroic-engineering/integrating-postman-collections-with-github-actions-ci-cd-pipeline-cb7f14ae4c03">Integrating Postman Collections with GitHub Actions CI/CD pipeline</a> was originally published in <a href="https://medium.com/heroic-engineering">Heroic Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>