<?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: Ramon Silva</title>
    <description>The latest articles on DEV Community by Ramon Silva (@ramonsilvadev).</description>
    <link>https://dev.to/ramonsilvadev</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1123072%2F9c1b0d9f-4236-4e08-8366-a345ef226b80.jpg</url>
      <title>DEV Community: Ramon Silva</title>
      <link>https://dev.to/ramonsilvadev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ramonsilvadev"/>
    <language>en</language>
    <item>
      <title>Stop Pushing Broken Code: Clean Git Hooks Without External Packages</title>
      <dc:creator>Ramon Silva</dc:creator>
      <pubDate>Wed, 07 Oct 2026 00:18:15 +0000</pubDate>
      <link>https://dev.to/ramonsilvadev/stop-pushing-broken-code-clean-git-hooks-without-external-packages-20pb</link>
      <guid>https://dev.to/ramonsilvadev/stop-pushing-broken-code-clean-git-hooks-without-external-packages-20pb</guid>
      <description>&lt;p&gt;How many times have you pushed a commit only to realize 3 minutes later that you left a &lt;code&gt;console.log&lt;/code&gt;, a formatting issue, or a broken unit test in your pull request?&lt;/p&gt;

&lt;p&gt;Most JavaScript and TypeScript teams immediately reach for external tools like Husky or lint-staged. While those tools are great, many developers don't realize that &lt;strong&gt;Git has had native client-side hooks built-in since day one&lt;/strong&gt;—and you don't need any npm dependency to protect your repository.&lt;/p&gt;

&lt;p&gt;Here is how you can set up a native, version-controlled pre-commit hook in under two minutes.&lt;/p&gt;




&lt;h3&gt;
  
  
  The Problem With the Default &lt;code&gt;.git/hooks&lt;/code&gt; Folder
&lt;/h3&gt;

&lt;p&gt;By default, Git stores hooks inside the &lt;code&gt;.git/hooks/&lt;/code&gt; directory of your project. &lt;/p&gt;

&lt;p&gt;The problem? The &lt;code&gt;.git/&lt;/code&gt; folder is never committed to remote repositories. That means your teammates won't get your hooks, and you won't get theirs.&lt;/p&gt;

&lt;p&gt;Luckily, Git 2.9 introduced a clean configuration setting: &lt;code&gt;core.hooksPath&lt;/code&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  Step 1: Tell Git Where to Look for Hooks
&lt;/h3&gt;

&lt;p&gt;Instead of relying on hidden folders, create a tracked directory in your project root called &lt;code&gt;.githooks&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; .githooks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, tell Git to read hooks from this directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config core.hooksPath .githooks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(Tip: In a team project, you can add this line to your &lt;code&gt;npm prepare&lt;/code&gt; script in &lt;code&gt;package.json&lt;/code&gt; so it runs automatically on &lt;code&gt;npm install&lt;/code&gt;!)&lt;/em&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Step 2: Create Your Native &lt;code&gt;pre-commit&lt;/code&gt; Hook
&lt;/h3&gt;

&lt;p&gt;Inside your new &lt;code&gt;.githooks/&lt;/code&gt; folder, create a file named &lt;code&gt;pre-commit&lt;/code&gt; (no extension):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;touch&lt;/span&gt; .githooks/pre-commit
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x .githooks/pre-commit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add your validation logic inside &lt;code&gt;.githooks/pre-commit&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/sh&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Running pre-commit checks..."&lt;/span&gt;

&lt;span class="c"&gt;# 1. Run your linter or type-checker&lt;/span&gt;
npm run lint
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;$?&lt;/span&gt; &lt;span class="nt"&gt;-ne&lt;/span&gt; 0 &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Lint errors found! Fix them before committing."&lt;/span&gt;
  &lt;span class="nb"&gt;exit &lt;/span&gt;1
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="c"&gt;# 2. Block unwanted console.log leftovers&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;git diff &lt;span class="nt"&gt;--cached&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-q&lt;/span&gt; &lt;span class="s2"&gt;"console.log"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Warning: Found staged console.log statements!"&lt;/span&gt;
  &lt;span class="nb"&gt;exit &lt;/span&gt;1
&lt;span class="k"&gt;fi

&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"All checks passed! Committing changes..."&lt;/span&gt;
&lt;span class="nb"&gt;exit &lt;/span&gt;0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Step 3: Try It Out
&lt;/h3&gt;

&lt;p&gt;Whenever you run &lt;code&gt;git commit&lt;/code&gt;, Git executes your &lt;code&gt;.githooks/pre-commit&lt;/code&gt; script before creating the commit snapshot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the script exits with &lt;code&gt;0&lt;/code&gt;, the commit goes through.&lt;/li&gt;
&lt;li&gt;If any test or lint fails (exiting with non-zero), Git instantly aborts the commit, keeping your Git log clean.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Why Keep It Native?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Zero dependencies:&lt;/strong&gt; No extra node_modules bloat or build-step overhead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instant execution:&lt;/strong&gt; Runs directly in your shell without wrapper lag.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Works with any stack:&lt;/strong&gt; The same hook works whether your project is React, Node.js, Go, or Python.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Small native features like &lt;code&gt;core.hooksPath&lt;/code&gt; save hours of CI debugging and keep your codebase clean.&lt;/p&gt;

&lt;p&gt;Have you used native Git hooks before, or do you prefer package managers like Husky? Let's discuss in the comments!&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>javascript</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Stop Creating Useless Instances in TypeScript</title>
      <dc:creator>Ramon Silva</dc:creator>
      <pubDate>Tue, 10 Mar 2026 20:50:08 +0000</pubDate>
      <link>https://dev.to/ramonsilvadev/stop-creating-useless-instances-in-typescript-3en0</link>
      <guid>https://dev.to/ramonsilvadev/stop-creating-useless-instances-in-typescript-3en0</guid>
      <description>&lt;p&gt;Confess to me: how many times have you seen (or written) code where someone creates a class full of utility functions and, when it's time to use it, does a new CurrencyFormatter() just to call a method that formats a number?&lt;/p&gt;

&lt;p&gt;Yeah. We often do this on autopilot, but in practice, we are allocating memory for a whole object without any real need.&lt;/p&gt;

&lt;p&gt;If your function doesn't need to hold any internal "state" (meaning it doesn't use data from a specific instance), you don't need the &lt;code&gt;new&lt;/code&gt; keyword. That's exactly what the &lt;code&gt;static&lt;/code&gt; keyword is for.&lt;/p&gt;

&lt;p&gt;Let's see the difference in practice.&lt;/p&gt;




&lt;h3&gt;
  
  
  ❌ The useless &lt;code&gt;new&lt;/code&gt; nightmare (Without static)
&lt;/h3&gt;

&lt;p&gt;Imagine a simple utility class for formatting. If you don't use &lt;code&gt;static&lt;/code&gt;, TypeScript forces you to instantiate the class (create an object) every single time you want to use its function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CurrencyFormatter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`$&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Wasting memory to create an object for no reason&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;formatter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;CurrencyFormatter&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;formatter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;150.5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  ✅ Straight to the point (With static)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CurrencyFormatter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// The function now belongs to the class&lt;/span&gt;
  &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`$&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// No 'new', no mess. Direct call!&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;CurrencyFormatter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;150.5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  🧠 Bonus: Sharing data across instances
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;static&lt;/code&gt; keyword isn't just for utility functions. It's incredibly powerful for creating variables that need to be shared across all objects of that class.&lt;/p&gt;

&lt;p&gt;Imagine you are processing transactions in a financial app and want to keep track of the total number of transactions created during a session. If you use a regular variable, each transaction will have its own isolated counter (which defeats the purpose). With &lt;code&gt;static&lt;/code&gt;, the whole class shares the same variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Transaction&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// This value is shared across the entire application&lt;/span&gt;
  &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="nx"&gt;totalProcessed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 

  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nx"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Every time a transaction is created, we update the global counter&lt;/span&gt;
    &lt;span class="nx"&gt;Transaction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;totalProcessed&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Transaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Transaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Transaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Transaction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;totalProcessed&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: 3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  The Golden Rule
&lt;/h3&gt;

&lt;p&gt;Not sure if you should use it or not? Ask yourself this: &lt;strong&gt;"Does this method use the this keyword to access a variable that belongs only to this specific object?"&lt;/strong&gt; If the answer is no, slap a &lt;code&gt;static&lt;/code&gt; on it and be happy! Your code will be cleaner, more performant, and more professional.&lt;/p&gt;

&lt;p&gt;Do you use static methods often in your projects, or do you still have the habit of throwing &lt;code&gt;new&lt;/code&gt; at everything? Let me know in the comments!&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Hype Doesn't Dictate the Market: The Real Deal on Development</title>
      <dc:creator>Ramon Silva</dc:creator>
      <pubDate>Wed, 26 Feb 2025 01:06:14 +0000</pubDate>
      <link>https://dev.to/ramonsilvadev/hype-nao-dita-mercado-a-real-sobre-desenvolvimento-30oh</link>
      <guid>https://dev.to/ramonsilvadev/hype-nao-dita-mercado-a-real-sobre-desenvolvimento-30oh</guid>
      <description>&lt;p&gt;Hey guys!&lt;/p&gt;

&lt;p&gt;I recently went to a dev meetup here in my city. While chatting about the job market, one comment really caught my attention: "Java is making a huge comeback after a slump." That made me stop and wonder: when did it ever leave?&lt;/p&gt;

&lt;p&gt;Honestly, I don't think Java ever left the stage. Even as a front-end dev, I see the demand for Java developers booming, especially in the enterprise world. Companies need people to build new features and maintain legacy systems. And let's face it, their real concern isn't chasing trends, but keeping everything running smoothly. Mission-critical systems aren't replaced overnight. Stability, security, and longevity matter way more.&lt;/p&gt;

&lt;p&gt;One thing we can't ignore is the role social media plays in this perception, constantly feeding us what we already search for and related topics. That's where the danger of "bubbles" lies. Algorithms are designed to show us content that reinforces our beliefs and interests, creating a vicious cycle of information that can lead us to believe a specific tech stack is the only relevant one, when in reality, the market is much more diverse.&lt;/p&gt;

&lt;p&gt;So, before you get swept up in the "X is dead" or "Y is going to dominate everything" narratives, remember that the market is way more complex than the current hype. At the end of the day, every language has its purpose. Knowing this is what helps you decide where to invest your time and energy as a dev. Seek information from diverse sources, talk to professionals from different fields, and experiment with new technologies. The real key to success is the ability to adapt and learn continuously.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>career</category>
      <category>development</category>
      <category>softwaredevelopment</category>
    </item>
  </channel>
</rss>
