<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rahul Kumar</title>
    <description>The latest articles on DEV Community by Rahul Kumar (@devwise).</description>
    <link>https://dev.to/devwise</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F22301%2F13f78d0c-dbda-4ce6-997b-56459f434023.png</url>
      <title>DEV Community: Rahul Kumar</title>
      <link>https://dev.to/devwise</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devwise"/>
    <language>en</language>
    <item>
      <title>Temporal Scoping in JavaScript</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Mon, 01 May 2023 09:08:26 +0000</pubDate>
      <link>https://dev.to/devwise/temporal-scoping-in-javascript-5669</link>
      <guid>https://dev.to/devwise/temporal-scoping-in-javascript-5669</guid>
      <description>&lt;p&gt;If you can explain why the following outputs between the variables declared with &lt;code&gt;var&lt;/code&gt; and &lt;code&gt;let&lt;/code&gt;/&lt;code&gt;const&lt;/code&gt;, then you can skip this article. Thank you for giving it a look.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(a); //Output: undefined
var a = 1;
console.log(a); //Output: 1

console.log(b); //Output: Reference Error: b is not defined
const b = 2;
console.log(b); //Output: 2

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Temporal Scoping
&lt;/h3&gt;

&lt;p&gt;The reason is temporal-scoping. It was introduced in ES6 with the introduction of &lt;code&gt;let&lt;/code&gt;/&lt;code&gt;const&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A variable declared with &lt;code&gt;let&lt;/code&gt;/&lt;code&gt;const&lt;/code&gt; is unavailable before the declaration. Whereas, if declared with &lt;code&gt;var&lt;/code&gt;, a variable is available in the entire scoping context. However, a value is assigned to it only when the variable is initialized. That is why, in the above example, &lt;code&gt;a&lt;/code&gt; is available to use before its declaration, but it's still &lt;code&gt;undefined&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;ES6 (ECMAScript 6 now) has been around for many years now. The concepts introduced with it are well-supported in all major browsers. However, this aspect of scoping is not talked about much. I hope that you learned something interesting from this post. Until the next one. Cheers!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Skin in the Game: A Roadmap for Engineering Leaders To Find Meaning in Work</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Thu, 27 Apr 2023 19:39:33 +0000</pubDate>
      <link>https://dev.to/devwise/skin-in-the-game-a-roadmap-for-engineering-leaders-to-find-meaning-in-work-2f10</link>
      <guid>https://dev.to/devwise/skin-in-the-game-a-roadmap-for-engineering-leaders-to-find-meaning-in-work-2f10</guid>
      <description>&lt;h3&gt;
  
  
  Who is this article for?
&lt;/h3&gt;

&lt;p&gt;For Software Engineering Leaders, both new and seasoned.&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;At some point in time of your management journey, you must have wondered what impact you create as a manager, and what value you drive for your organization.&lt;/p&gt;

&lt;h1&gt;
  
  
  Summary
&lt;/h1&gt;

&lt;p&gt;The purpose of this article is to outline my understanding of how an Engineering Leader can cultivate "Skin in the Game," as well as to offer a roadmap for Engineering Leaders, both novice and experienced, to achieve success in their positions.&lt;/p&gt;

&lt;p&gt;After working as an individual contributor for 12 years, I made the transition to management in 2019. As I complete my fourth year in this role, I still find myself pondering these questions. While the decision to transition was mine, and I followed a methodical process to make it, it took me a few months to adjust to the new responsibilities, team, and expectations (&lt;em&gt;If anyone is at a similar crossroads, please reach out to me. I will be happy to chat&lt;/em&gt;). Once I was acclimated, I began seeking a deeper meaning in my role.&lt;/p&gt;

&lt;p&gt;I recently read Nassim Taleb's "Skin in the Game" and found it to be an excellent resource for my needs. I was inspired to gain insights from a pragmatic thinker like Taleb on issues relevant to my field.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is "Skin in the Game"?
&lt;/h3&gt;

&lt;p&gt;In the book, Taleb argues that people should have a personal stake in the decisions they make and the risks they take, and that those who do not have "skin in the game" should not be making decisions that affect others. He discusses this idea in a variety of contexts, including politics, economics, and business.&lt;/p&gt;

&lt;h3&gt;
  
  
  From Individual Contributor to Manager
&lt;/h3&gt;

&lt;p&gt;While being an individual contributor may provide more immediate and visible results, being a manager can offer a different type of value by leveraging your skills and experience to drive results through others. As a manager, you have the opportunity to influence the direction of the team and the organization, develop talent, and create a positive work environment that supports high performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to cultivate "Skin in the Game"?
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Remember&lt;/strong&gt; that having "skin in the game" is not just about taking risks, but also about taking ownership, being accountable, and aligning your work with the broader goals of your team and company.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are several ways you can strive to have "skin in the game" and increase your sense of ownership and responsibility:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Understand the big picture&lt;/strong&gt; : Gain a deep understanding of the overall goals and objectives of your team, department, and company. This includes understanding the product vision, customer needs, and business strategy. By aligning your work with the broader goals of the organization, you can better appreciate how your role contributes to the overall value delivered by your team.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Understand the business, not just the engineering&lt;/strong&gt; : Engineering Leaders are the bridge between all the functions that it takes to make a product successful (&lt;em&gt;Product, Design, Communication, SRE et. al.&lt;/em&gt;). The role demands one to focus on all aspects of business, not just engineering. If done correctly, there's a strong potential to make a large impact. That is why there are many examples of EMs going on to lead both Product and Engineering in their Organizations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Empower your team&lt;/strong&gt; : Create an environment where your team members feel empowered to make decisions and take ownership of their work. Foster a culture of accountability and trust, where team members have the autonomy to make meaningful contributions and take calculated risks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Take calculated risks&lt;/strong&gt; : Embrace calculated risks and be willing to make decisions that may involve uncertainty or ambiguity. &lt;strong&gt;Take responsibility for the outcomes&lt;/strong&gt; of those decisions and learn from both successes and failures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Solicit and act on feedback&lt;/strong&gt; : Encourage open and honest feedback from your team, peers, and superiors. Listen actively, acknowledge shortcomings, and take action to improve. Continuously iterate and adapt your approach based on feedback to ensure that you are providing value as a leader.&lt;br&gt;&lt;br&gt;
You can collect feedback through various channels - in your 1-1s, through the feedback tools in your Organization,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Lead by example&lt;/strong&gt; : Demonstrate a strong work ethic, commitment, and accountability in your own actions. Be willing to roll up your sleeves and work alongside your team to understand their challenges and provide support. Lead by example in embodying the values and behaviors you expect from your team.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Foster a learning culture&lt;/strong&gt; : Encourage continuous learning and development among your team members. Provide opportunities for skill-building, knowledge-sharing, and growth. Help your team members understand how their professional growth aligns with the team's and company's goals.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Take responsibility for setbacks. Give credit for successes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;By taking these steps, you can strive to have "skin in the game" as a software engineering manager, and actively contribute to the value delivered by your team and organization.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What if I still feel disconnected from this role?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If you feel that you are not providing value in your current role or if you miss the direct impact of being an individual contributor, it may be worth considering a transition back to a technical role. However, it is important to carefully consider your motivations and ensure that you are not simply seeking short-term gratification at the expense of long-term growth and career satisfaction.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is important to reflect on what you enjoy doing, what you are good at, and what you want to achieve in your career, and make a decision that aligns with your values and aspirations.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ultimately, the decision of whether to continue in a managerial role or transition back to an individual contributor role depends on your personal goals, strengths, and interests.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;If you want to discuss further on this topic or others, I will be happy to connect and brainstorm.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A Beginner's Guide to DNS</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Sun, 23 Apr 2023 03:01:09 +0000</pubDate>
      <link>https://dev.to/devwise/a-beginners-guide-to-dns-3fjd</link>
      <guid>https://dev.to/devwise/a-beginners-guide-to-dns-3fjd</guid>
      <description>&lt;p&gt;In this article, we will be discussing DNS or the Domain Name System. DNS is an essential component of the internet that helps you access websites and other resources by their names, rather than by their IP addresses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Need for DNS in Web Browsing
&lt;/h2&gt;

&lt;p&gt;Let's start with the basics. When you type in a website address in your browser, such as &lt;a href="http://www.google.com"&gt;&lt;strong&gt;www.google.com&lt;/strong&gt;&lt;/a&gt;, your computer needs to find the IP address of that website's server so it can send and receive information. An IP address is a unique numerical identifier assigned to each device on the internet, and it's how computers communicate with each other.&lt;/p&gt;

&lt;p&gt;Now, imagine if you had to remember the IP address of every website you wanted to visit. That would be quite difficult, wouldn't it? This is where DNS comes in. It's a system that maps domain names, like &lt;a href="http://www.google.com"&gt;&lt;strong&gt;www.google.com&lt;/strong&gt;&lt;/a&gt;, to their corresponding IP addresses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the DNS Resolution Process
&lt;/h2&gt;

&lt;p&gt;The DNS system is hierarchical and distributed, meaning that there are many different DNS servers located all around the world, and they work together to resolve domain names. When you enter a domain name into your browser, your computer first checks its local DNS cache to see if it already knows the corresponding IP address. If it doesn't, it sends a query to a DNS resolver, which is typically provided by your internet service provider (ISP).&lt;/p&gt;

&lt;p&gt;The resolver then looks up the IP address for the domain name by sending requests to multiple DNS servers, starting with the root servers. The root servers are the top-level DNS servers that contain information about the top-level domains, such as .com, .org, and so on. The resolver then continues to query more specific DNS servers until it finds the IP address for the domain name.&lt;/p&gt;

&lt;p&gt;Once the resolver has the IP address, it sends it back to your computer, which can then establish a connection with the website's server and start exchanging data.&lt;/p&gt;

&lt;h2&gt;
  
  
  In-depth Look: DNS Records, Caching, and Security Measures
&lt;/h2&gt;

&lt;h3&gt;
  
  
  DNS Records
&lt;/h3&gt;

&lt;p&gt;Now, let's talk about some of the details of how DNS works. DNS records are used to store information about domain names and their corresponding IP addresses. There are several types of DNS records, including A records, which map domain names to IPv4 addresses, and AAAA records, which map domain names to IPv6 addresses. There are also other types of records, such as MX records for email servers and CNAME records for aliases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Caching
&lt;/h3&gt;

&lt;p&gt;DNS also uses a system of caching to improve performance. When a DNS resolver receives a response to a query, it caches the result for a certain amount of time. This means that if the same query is made again within that period, the resolver can quickly retrieve the cached result instead of having to query the DNS servers again. This helps to reduce network traffic and improve the speed of DNS lookups.&lt;/p&gt;

&lt;h3&gt;
  
  
  Security
&lt;/h3&gt;

&lt;p&gt;Finally, it's important to note that DNS can be vulnerable to attacks, such as DNS spoofing or DNS amplification attacks. These types of attacks can cause DNS resolvers to return incorrect or malicious IP addresses, leading to security breaches. To help prevent these types of attacks, DNS servers can use techniques such as DNSSEC, which adds cryptographic signatures to DNS records to ensure their authenticity.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's Next?
&lt;/h3&gt;

&lt;p&gt;By now, you should have a good understanding of how DNS works and why it's a crucial component of the internet. However, there is still much more to learn about DNS, including its architecture, protocols, performance, and scalability. In my upcoming article, I will delve deeper into these topics and provide you with more detailed information. So stay tuned for more on DNS!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Focus Trapping - Trap focus inside an element</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Mon, 05 Nov 2018 07:43:15 +0000</pubDate>
      <link>https://dev.to/devwise/focus-trappinglooping-for-keyboard-navigation-l6m</link>
      <guid>https://dev.to/devwise/focus-trappinglooping-for-keyboard-navigation-l6m</guid>
      <description>&lt;p&gt;In this article, I will cover one of the important aspects of making a web-page accessible - &lt;em&gt;trapping/looping&lt;/em&gt; (will call it &lt;em&gt;looping&lt;/em&gt; from here on) focus inside a DOM element, scenarios in which it's required and a JavaScript utility to achieve it.&lt;br&gt;
In the last section, I will discuss the nuances of the suggested solution on a mobile-device with screen-reader enabled.&lt;/p&gt;
&lt;h2&gt;
  
  
  Some words on the problem that we want to fix
&lt;/h2&gt;

&lt;p&gt;Keyboard navigation is a basic requirement in making any product accessible. In a web-page that's easily achieved by using a combination of semantic HTML, &lt;code&gt;tabIndex&lt;/code&gt;, &lt;code&gt;aria&lt;/code&gt; attributes and some JS.&lt;/p&gt;

&lt;p&gt;If you are aware of the problem, you may skip to the next section. For details, continue reading.&lt;/p&gt;

&lt;p&gt;Let's take an example. Imagine a login page with both sign-in and sign-up buttons. Clicking any would open up a modal with fields required for the respective action. For a correct keyboard navigation -&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;When the modal opens, the first input element (&lt;em&gt;which element should get the focus depends on the page's interaction design&lt;/em&gt;) should get the focus.&lt;/li&gt;
&lt;li&gt;The user should be able to tab to the other interactable elements inside the modal.&lt;/li&gt;
&lt;li&gt;On tabbing the focus shouldn't go out of the modal or rather should loop inside&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As natural as the above interactions may sound, it doesn't behave that way by default. That's because modal or similar UI elements are only virtual boundaries. Tabbing works on DOM's natural order.&lt;/p&gt;

&lt;p&gt;Thus, on opening the modal, the modal elements won't even receive the focus (&lt;em&gt;if modal is not positioned absolutely to the element that triggered it&lt;/em&gt;), let alone the focus looping inside.&lt;/p&gt;
&lt;h2&gt;
  
  
  The utility to solve this problem
&lt;/h2&gt;

&lt;p&gt;I will stop wasting words and present the code that solves the problems for us:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;tl;dr&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's the JS snippet that does the main task of trapping the tabbed navigation. This snippet can be found from line 47 to 62 in the gist that follows the snippet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function keyboardHandler(e) {
  if (e.keyCode === 9) {
    //Rotate Focus
    if (e.shiftKey &amp;amp;&amp;amp; document.activeElement === firstFocusableEl) {
      e.preventDefault();
      lastFocusableEl.focus();
    } else if (!e.shiftKey &amp;amp;&amp;amp; document.activeElement === lastFocusableEl) {
      e.preventDefault();
      firstFocusableEl.focus();
    }
  }
};
el.addEventListener('keydown', keyboardHandler);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;In the code above, &lt;code&gt;firstFocusableEl&lt;/code&gt; &amp;amp; &lt;code&gt;lastFocusableEl&lt;/code&gt; are (&lt;em&gt;as the names suggest&lt;/em&gt;) the first and the last focusable elements within the container element.&lt;/p&gt;

&lt;p&gt;For a detailed and production ready code, please take a look at the following gist.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;h2&gt;
  
  
  Does it work on mobile screen-readers?
&lt;/h2&gt;

&lt;p&gt;Well, No!&lt;/p&gt;

&lt;p&gt;If you have worked on web accessibility on mobile devices (&lt;em&gt;Android or iOS&lt;/em&gt;), you would know that on turning on the screen-reader (&lt;em&gt;Talkback and Voiceover&lt;/em&gt;) you get swipe and double tap actions.&lt;/p&gt;

&lt;p&gt;If you are thinking that we can modify our logic to also listen to this swipe gesture, then you should know that it won't work as the swipe gesture doesn't trigger any event that we can catch in a web-page.&lt;/p&gt;

&lt;p&gt;How do we fix it then?&lt;/p&gt;

&lt;p&gt;There's a clever solution for that. Hide all the elements except the container element (&lt;em&gt;passed to &lt;code&gt;loopFocus()&lt;/code&gt;&lt;/em&gt;) from the screen-reader. That can be done by adding &lt;code&gt;aria-hidden=true&lt;/code&gt; attribute to all elements except the container element.&lt;/p&gt;

&lt;p&gt;This will turn out to be an inefficient implementation if there are a lot of elements to be hidden. For that, you should know one thing about screen-readers and &lt;code&gt;aria-hidden&lt;/code&gt; that &lt;strong&gt;&lt;em&gt;when a container is marked hidden, all its children are inaccessible to the screen-reader&lt;/em&gt;&lt;/strong&gt;. Use this information and try to have a structure such that the higher level elements in the hierarchy are marked hidden. &lt;em&gt;Remember, the idea is to reduce the number of DOM manipulations&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Last words
&lt;/h2&gt;

&lt;p&gt;Focus looping is an important part of A11Y support. Even when you are not planning on making your page fully accessible but only want it to be keyboard operable.&lt;/p&gt;

&lt;p&gt;If you have any question on A11Y or want to discuss a problem, do post your comment and we shall take the discussion forward. Let's together make the web inclusive and usable for everyone.&lt;/p&gt;

</description>
      <category>a11y</category>
    </item>
  </channel>
</rss>
