<?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: Gobinath Mallaiyan</title>
    <description>The latest articles on DEV Community by Gobinath Mallaiyan (@gobinathm).</description>
    <link>https://dev.to/gobinathm</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%2F459342%2F16dff11b-e0c4-491c-a91c-292c7d839163.jpeg</url>
      <title>DEV Community: Gobinath Mallaiyan</title>
      <link>https://dev.to/gobinathm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gobinathm"/>
    <language>en</language>
    <item>
      <title>What is a Webhook?</title>
      <dc:creator>Gobinath Mallaiyan</dc:creator>
      <pubDate>Sun, 24 Sep 2023 14:49:43 +0000</pubDate>
      <link>https://dev.to/gobinathm/what-is-a-webhook-3n62</link>
      <guid>https://dev.to/gobinathm/what-is-a-webhook-3n62</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BEXdTNU3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vpudnvan8xisefeqh2xc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BEXdTNU3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vpudnvan8xisefeqh2xc.jpg" alt="Mobile Notifications" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before developing webhooks in any system, any new bee should take a tiny refresher on this topic. Webhooks are used in web application development to integrate multiple systems for real-time communication. It sends automated notifications and data via HTTP to another system based on a preconfigured trigger. Below is the list of everyday use cases of webhooks in modern application development.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Real-Time Updates:&lt;/em&gt;&lt;/strong&gt; We can send real-time updates and push notifications, ensuring that Information is delivered as soon as an event happens, rather than relying on periodic polling for change. A simple use case could be an e-commerce website that can use a webhook to inform a fulfillment service whenever an order is placed, ensuring timely order processing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;**Integration: *&lt;/em&gt;*Webhook enables the integration of different applications, services, and platforms. For example, a CRM system may use webhooks to update customer records whenever a user fills out a contact form on a website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Notifications:&lt;/strong&gt; The information we receive on our mobile devices (or) web browsers. For example, when you receive a new message on your Instagram Chat, a microservice on their server would trigger a webhook to notify your mobile IG client.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Synchronization:&lt;/strong&gt; It can keep data synchronized between systems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automation:&lt;/strong&gt; Webhooks are integral to automation processes. When an event occurs, a webhook can automate actions in response. For instance, a content management system can automatically use a webhook to share newly published articles on social media platforms.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;High-level Information on how webhooks typically work:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Configuring Webhook:&lt;/strong&gt; A developer configures a webhook that generates events in an application. This typically involves providing an endpoint URL where the webhook payload will be delivered on the occurrence of an event.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Event Trigger&lt;/strong&gt;: Any event, such as user registration, order placement, chat message and similar action, occurs in a source system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HTTP Request&lt;/strong&gt;: The source system will be configured to send an HTTP request with a payload to the endpoint URL. Typically, these payloads are in the form of JSON XML.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Receiver:&lt;/strong&gt; The destination application receiving the webhook listens for any incoming requests at the endpoint URL. It gets the data &amp;amp; processes the payload, and will perform any required answers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Response:&lt;/strong&gt; The receiving system acknowledges the receipt of the webhook by sending an HTTP response back to the source, confirming that the data was successfully received and processed.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Webhooks are highly versatile and widely used in modern software development, enabling efficient communication between components, services, and platforms. They provide a more efficient and scalable alternative to traditional polling-based methods for retrieving and reacting to data changes and events.&lt;/p&gt;

&lt;p&gt;Image Credit: &lt;br&gt;
Photo by &lt;a href="https://unsplash.com/@julianchrist?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash"&gt;Julian Christ&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/a-close-up-of-a-cell-phone-with-social-media-icons-2MBnS4np8i0?utm_content=creditCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=unsplash"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webhooktrigger</category>
      <category>webdev</category>
      <category>mobileappdevelopment</category>
      <category>webhooks</category>
    </item>
    <item>
      <title>Effective Comments in React.js Code for PHP/Drupal Developers</title>
      <dc:creator>Gobinath Mallaiyan</dc:creator>
      <pubDate>Sun, 05 Sep 2021 10:40:30 +0000</pubDate>
      <link>https://dev.to/gobinathm/effective-comments-in-reactjs-code-for-phpdrupal-developers-4kgb</link>
      <guid>https://dev.to/gobinathm/effective-comments-in-reactjs-code-for-phpdrupal-developers-4kgb</guid>
      <description>&lt;p&gt;&lt;a href="https://medium.com/programmers-notebook/effective-comments-in-react-js-code-for-php-drupal-developers-b8209ff4e70d?source=rss-76460e666cec------2"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XHMg3nzA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/2600/0%2Ai6ELliBVI7GdQfRf" alt="" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;React.js is an incredibly powerful JavaScript library that has gained immense popularity for its ability to build dynamic and interactive user interfaces. It is widely used for developing robust and efficient single-page applications as a PHP or Drupal developer. Venturing into React, it becomes paramount to possess a deep understanding of how to write comprehensible and compelling comments. These comments contribute to the codebase's maintainability and promote effective collaboration within the development team.&lt;/p&gt;

&lt;p&gt;When it comes to commenting in React.js, developers have various options at their disposal. Function comments play a crucial role in explaining a particular function's purpose, expected inputs, and return values. By providing insightful comments, developers can ensure their operations are self-explanatory and produce more readable and understandable code. These comments can also serve as a helpful guide for future developers who might need to work on the codebase.&lt;/p&gt;

&lt;p&gt;In addition to function comments, file comments are equally crucial in React.js development. These comments provide an overview of the entire file, highlighting its purpose, dependencies, and other relevant information. By including well-written file comments, developers can provide context and guidance to their colleagues, making it easier for them to understand the purpose and structure of the file.&lt;/p&gt;

&lt;p&gt;It is worth noting that while comments are highly beneficial in enhancing code clarity, they should only be used when necessary. Comments should focus on explaining the why rather than the what, as the code should be self-explanatory. Moreover, comments should be written concisely and precisely, avoiding unnecessary verbosity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Regular Comments Styles
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Single-line Comments&lt;/em&gt; are helpful for brief explanations within the code.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    // This is a single-line comment
    const variable = 'value';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Multi-line Comments&lt;/em&gt; are suitable for providing more extensive explanations
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    /*
      This is a multi-line comment.
      It can span multiple lines to provide detailed information.
    */
    const anotherVariable = 'another value';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Use &lt;em&gt;TODO Comments&lt;/em&gt; to highlight areas that need special attention (or) future improvements (or) marking a pending task.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// TODO: Implement error handling for edge cases
const getData = () =&amp;gt; {
  // Implementation details...
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Commenting Out Code&lt;/em&gt; when temporarily disabling code that’s not in use. Use comments to explain the reason.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   // The following line is commented out for debugging purposes
    // someFunctionToDebug();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Divider Comments can help separate sections of your code for better organization. This is done differently by different developers, as there is no specific standard.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;```// ======= Helper Functions =======&lt;br&gt;
    const helperFunction1 = () =&amp;gt; {&lt;br&gt;
      // Implementation details...&lt;br&gt;
    };&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ======= Main Logic =======
const mainFunction = () =&amp;gt; {
  // Implementation details...
};```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;By incorporating these regular comment styles, you enhance the overall clarity of your React.js code, making it easier to understand for both yourself and your team.&lt;/p&gt;
&lt;h2&gt;
  
  
  Function Comments
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;When writing comments for a &lt;strong&gt;&lt;em&gt;function with no arguments&lt;/em&gt;&lt;/strong&gt;, it’s essential to describe the purpose of the function and any expected output.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;// Retrives User details and Display&lt;br&gt;
const getAndDisplayUserDetails = () =&amp;gt; {&lt;br&gt;
  // Implementation details...&lt;br&gt;
};&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;For &lt;strong&gt;&lt;em&gt;functions with arguments&lt;/em&gt;&lt;/strong&gt;, include comments for each parameter, specifying their purpose and expected types.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt; * Renders a user profile card
 * @param {string} username - The username of the user
 * @param {string} displayname - The displayname of the user
 * @param {number} age - The age of the user
 */
const displayUserProfile = (username, displayname, age) =&amp;gt; {
  // Implementation details...
};```

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


&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;When a &lt;strong&gt;&lt;em&gt;function has default arguments&lt;/em&gt;&lt;/strong&gt;, comment on the defaults and their impact.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; * Displays a welcome text message
 * @param {string} name - The name to welcome
 * @param {string} message - The message (default: 'Hello')
 */
const welcomeUser = (name, message = 'Hello') =&amp;gt; {
  // Implementation details...
};```

&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For &lt;strong&gt;&lt;em&gt;functions with a mix of arguments and default arguments&lt;/em&gt;&lt;/strong&gt;, comment on each parameter’s role.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```/**
 * Calculates the total cost
 * @param {number} quantity - The quantity of items
 * @param {number} price - The price per item
 * @param {number} discount - The discount percentage (default: 0)
 */
const calculateCost = (quantity, price, discount = 0) =&amp;gt; {
  // Implementation details...
};```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  File Comments
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;General File Comments&lt;/em&gt;&lt;/strong&gt;: Provide an overview of the file’s purpose and significant functionalities at the top of the file.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  File: User.js
  Description: This file contains components &amp;amp; functions related to users.
*/```

&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Import Comments&lt;/strong&gt;: when importing external modules (or) components, briefly comment on their role in the file context.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import React from 'react'; // Import the React library&lt;br&gt;
import PropTypes from 'prop-types'; // Import PropTypes for type checking&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Component Comments: Explain their role and any prop types.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; * UserCard Component
 * Displays user information in a card format.
 */
const UserCard = ({ user }) =&amp;gt; {
  // Implementation details...
};
UserCard.propTypes = {
  user: PropTypes.object.isRequired,
};```

&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Additional Resources&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/getting-started.html"&gt;React.js Official Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://standardjs.com/"&gt;JavaScript Standard Style&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/airbnb/javascript"&gt;Airbnb JavaScript Style Guide&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Remember that clear and concise comments are &lt;strong&gt;invaluable&lt;/strong&gt; for understanding code, &lt;strong&gt;especially&lt;/strong&gt; when transitioning between PHP/Drupal and React.js development. By &lt;strong&gt;wholeheartedly embracing&lt;/strong&gt; these commenting practices, you &lt;strong&gt;truly enhance&lt;/strong&gt; the maintainability and readability of your React.js projects. So, &lt;strong&gt;let your passion drive you&lt;/strong&gt; and make your code &lt;strong&gt;speak volumes&lt;/strong&gt; through thoughtful and expressive comments!&lt;/p&gt;

&lt;p&gt;To conclude, precise and effective commenting in React.js is crucial to code maintainability and team collaboration. By utilizing various commenting techniques, such as function and file comments, developers can ensure that their codebase remains understandable and approachable even as it grows in complexity. By investing time and effort into writing thoughtful comments, developers can contribute to the success of their React.js projects and foster a collaborative development environment.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="http://gobinathm.com"&gt;http://gobinathm.com&lt;/a&gt; on September 5, 2021.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>reactjsprogrammers</category>
      <category>phpdevelopers</category>
      <category>reactjsforbeginners</category>
      <category>react</category>
    </item>
    <item>
      <title>Fixing a shallow GIT repo 💻</title>
      <dc:creator>Gobinath Mallaiyan</dc:creator>
      <pubDate>Fri, 01 May 2020 01:49:49 +0000</pubDate>
      <link>https://dev.to/gobinathm/fixing-a-shallow-git-repo-1cnj</link>
      <guid>https://dev.to/gobinathm/fixing-a-shallow-git-repo-1cnj</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gqHrtvc4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/10000/0%2AfmdRWxfCNkSZVmvR" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gqHrtvc4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/10000/0%2AfmdRWxfCNkSZVmvR" alt="Photo by [Yancy Min](https://unsplash.com/@yancymin?utm_source=medium&amp;amp;utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral)" width="800" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sometimes, a developer might intentionally (or) unintentionally end up with a shallow GIT Repo. And this can be a pain for those who unintentionally end up with shallow Repo.&lt;/p&gt;

&lt;p&gt;You need to unshallow your local Repo. Following these simple steps can help you out of this situation.&lt;/p&gt;

&lt;p&gt;Step 1: You must update/fix your origin remote repo.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git remote add origin &amp;lt;path-to-old-remote&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Step 2: You would need to perform a git fetch with an unlike option (as suggested below)&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git fetch — unshallow origin&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Just these two steps would restore your repo to the normal state. After this, you can perform all options, like push into your new remote repository.&lt;/p&gt;

&lt;p&gt;Initially, this was posted as a GIST @ &lt;a href="https://gist.github.com/gobinathm/96e27a588bb447154604963e09c38ddc"&gt;https://gist.github.com/gobinathm/96e27a588bb447154604963e09c38ddc&lt;/a&gt;&lt;/p&gt;

</description>
      <category>scm</category>
      <category>git</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
