<?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: Marco Fiset</title>
    <description>The latest articles on DEV Community by Marco Fiset (@marcofiset).</description>
    <link>https://dev.to/marcofiset</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%2F176769%2Fb9e4e88f-86e1-4f8b-9f7b-a3e2f6186657.jpg</url>
      <title>DEV Community: Marco Fiset</title>
      <link>https://dev.to/marcofiset</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marcofiset"/>
    <language>en</language>
    <item>
      <title>How I Dealt with a Bug in an Abandoned Library</title>
      <dc:creator>Marco Fiset</dc:creator>
      <pubDate>Fri, 14 Jun 2019 02:10:57 +0000</pubDate>
      <link>https://dev.to/marcofiset/how-i-dealt-with-a-bug-in-an-abandoned-library-17b6</link>
      <guid>https://dev.to/marcofiset/how-i-dealt-with-a-bug-in-an-abandoned-library-17b6</guid>
      <description>&lt;p&gt;&lt;strong&gt;DISCLAIMER:&lt;/strong&gt; This is pretty much the first time I had to deal with such an issue. If you have any suggestions about how this should have been dealt with, feel free to share in the comments :)&lt;/p&gt;




&lt;p&gt;There comes a time in every developer's career where one will discover a bug not in their own code, but in a library they're using. That happened to me quite a few times in the past, but it was the first time it occurred in these particular circumstances.&lt;/p&gt;

&lt;p&gt;Most of the time, when I encounter a bug in a library, I find that it was ultimately fixed in some newer version of the lib. I update my package.json file, &lt;code&gt;npm install&lt;/code&gt; away and my bug is fixed. Sometimes it involves reading through the changelogs to identify any potential breaking change and it's usually a walk in the park.&lt;/p&gt;

&lt;p&gt;This time however, was different.&lt;/p&gt;

&lt;p&gt;The version I was using was 4 years old. There where 100+ issues on the Github repository, alongside 30+ Pull Requests that were yet to be merged. There was a new version in development, but the last commit was written 10 months ago. There was no chance in hell that my bug would be fixed anytime soon, let alone be merged if I decided to fix it myself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Time to Hit the Fork Button
&lt;/h2&gt;

&lt;p&gt;I looked at the code, and since it's a library I was already familiar with, I knew exactly where to look.&lt;/p&gt;

&lt;p&gt;I found the 2 offending lines of code (actually it was the exact same line in 2 different places of the same file), patched them, committed and then pushed to my own fork of the repo. Now, Github was right there, nagging me about my version of the branch which was one commit ahead of the source repository. For good cause, I will definitely take the time to write tests for my bug fix and submit a PR back to the author, even though I have no hope of it being merged anytime soon.&lt;/p&gt;

&lt;p&gt;It was now time to used my patched-up lib in my project. Well, it turns out that &lt;code&gt;npm&lt;/code&gt; can download library straight from Github. All you gotta do is open up your &lt;code&gt;package.json&lt;/code&gt; file, and change the version number of the lib you want to replace with this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;"some-library": "git+https://github.com/username/package.git#tag"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Where &lt;code&gt;username&lt;/code&gt; is your Github (or your organization's) name, &lt;code&gt;package&lt;/code&gt; being the repository name and &lt;code&gt;tag&lt;/code&gt; referencing either a particular commit's SHA-1 number or a tag.&lt;/p&gt;

&lt;p&gt;Now you may think that you're just an &lt;code&gt;npm install&lt;/code&gt; away from your troubles going away, and you would be right! But don't get your hopes up just yet as you may encounter some problems 🙃&lt;/p&gt;

&lt;p&gt;At this point, I was moving back and forth between my own version of the library and the actual published library to make sure that my changes were working as they should. The bug was still there. Oh no. Whatever I did, change my package.json file or deleted my node_modules directory and reinstalling, the wrong version of the library would get installed.&lt;/p&gt;

&lt;p&gt;It turns out that &lt;code&gt;npm&lt;/code&gt; and pretty much every package manager out there uses some form of dependency version locking mechanism. It means that whenever you install a dependency, the exact version you installed will be logged into a file (&lt;code&gt;package-lock.json&lt;/code&gt; in &lt;code&gt;npm&lt;/code&gt;'s case) which, if committed to your repository (you should definitely do so), will ensure that everyone on the team uses the exact same version of each package your project depends on.&lt;/p&gt;

&lt;p&gt;What I needed to do in order to install my own version was to actually open the package-lock.json file and rip out the piece of JSON referencing that particular library. Now &lt;code&gt;npm install&lt;/code&gt; would correctly fetch from my Github repository.&lt;/p&gt;

&lt;p&gt;And surprise! The bug was gone! I quickly transferred ownership of the repository to my organization and updated my package.json file accordingly. Here's to more buggy libraries and forked repositories in the future 🍻🤓&lt;/p&gt;

&lt;p&gt;Feel free to discuss in the comments about some similar situations you might have found yourselves in! Any insights is greatly appreciated by me and anyone who enjoyed this article.&lt;/p&gt;




&lt;p&gt;Hopefully this article was of some use to you 😇&lt;/p&gt;

&lt;p&gt;If it was, please consider following me here and on Twitter for more of this type of content! I'm dedicated to sharing what I learn here, however trivial it may seem to the more advanced of you. Cheers!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>opensource</category>
      <category>github</category>
    </item>
    <item>
      <title>You Should Learn a New Programming Language</title>
      <dc:creator>Marco Fiset</dc:creator>
      <pubDate>Fri, 07 Jun 2019 19:29:15 +0000</pubDate>
      <link>https://dev.to/marcofiset/you-should-learn-a-new-programming-language-37li</link>
      <guid>https://dev.to/marcofiset/you-should-learn-a-new-programming-language-37li</guid>
      <description>&lt;p&gt;I'm comfortable writing C#, PHP and Javascript. Those are the languages I use professionally. While I don't consider myself an expert in any of them, I can at least say that I'm fairly proficient with them. I don't need to deliberately practice my skills at those languages anymore because I know them very well. What I will do from time to time is learn and experiment with new libraries, integrating them into my projets if they solve a problem I have.&lt;/p&gt;

&lt;p&gt;Once you master a language, only learning new libraries will not be enough for you to advance your skills further. Sure, some library might come along and challenge the status quo, but generally you will tend to stick with the patterns you're comfortable with. You get your job done just by going through the motions, without thinking much about what you're doing.&lt;/p&gt;

&lt;p&gt;That's where you stagnate. The last thing you want to do is fall into complacency.&lt;/p&gt;

&lt;p&gt;Past a certain point, if you really want to push your skills further, you need to do something different. No just do "more of the same". Learning a new framework or a language that's very similar to one you already know is just a new way to do the exact same thing. It's easy to learn Java or Python when you already know C# or Javascript. You will feel right at home after a couple weeks.&lt;/p&gt;

&lt;p&gt;You want to learn a language that will make you feel dumb at first. You need to be disoriented in order to grow as a developer. This is where you'll push the boundaries of your knowledge into new territories.&lt;/p&gt;

&lt;p&gt;My personal suggestion would be Clojure. And that's a story for another article ;)&lt;/p&gt;

&lt;p&gt;What would be your suggestion for a programming language that goes off the beaten paths?&lt;/p&gt;

</description>
      <category>learning</category>
      <category>motivation</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
