<?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 B</title>
    <description>The latest articles on DEV Community by Marco B (@marcobustillo).</description>
    <link>https://dev.to/marcobustillo</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%2F103382%2F54a8c5a3-a293-4c83-b148-776ef6f0c40f.png</url>
      <title>DEV Community: Marco B</title>
      <link>https://dev.to/marcobustillo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marcobustillo"/>
    <language>en</language>
    <item>
      <title>Factory Method Pattern in JS!</title>
      <dc:creator>Marco B</dc:creator>
      <pubDate>Fri, 15 Nov 2024 08:58:47 +0000</pubDate>
      <link>https://dev.to/marcobustillo/factory-method-pattern-in-js-k3d</link>
      <guid>https://dev.to/marcobustillo/factory-method-pattern-in-js-k3d</guid>
      <description>&lt;p&gt;Cover photo credits to: &lt;a href="https://refactoring.guru/" rel="noopener noreferrer"&gt;Refactoring GURU&lt;/a&gt; my go to website for design patterns!&lt;/p&gt;

&lt;p&gt;Before we start going deep in the factory method pattern, let's first define it. The Factory Method pattern is a creational design pattern that provides a way to create objects without specifying the exact class of object that will be created.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problems
&lt;/h2&gt;

&lt;p&gt;Imagine you're building an insurance application that currently offers Life Insurance. As the application gains popularity, users start requesting additional types of insurance, such as Death Insurance. However, the existing codebase is tightly coupled to the Life Insurance class, making it difficult to add new insurance types without significant changes. For instance, you might need to add conditional statements or switch statements to determine which insurance type to use, leading to a complex and inflexible codebase. This approach not only makes it harder to maintain and extend the application but also limits its ability to adapt to changing user needs. A better approach would be to decouple the insurance types from the application's core logic, allowing you to add new insurance types without modifying the existing codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;The Factory Method pattern enables you to decouple object creation from the specific class of object being created. Instead of directly instantiating objects using the new operator, you can use a factory method that returns the desired object. This abstraction allows you to encapsulate the object creation process within the factory method, making it easier to change or extend the creation process without affecting the rest of the code. The factory method returns an object, often referred to as a 'product', which can be an instance of a specific class or a subclass of a base class. By using the Factory Method pattern, you can create a more flexible and maintainable codebase that is less coupled to specific object implementations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Components
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Product - Interface or abstract class that represents the objects that will be created by the factory&lt;/li&gt;
&lt;li&gt;Concrete product - The specific implementation of the product interface&lt;/li&gt;
&lt;li&gt;Factory/Concrete creator - The class responsible for creating objects that implement the product interface. It abstracts the object creation process from the client code&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Code Example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;interface Insurance {
  // Product
  createInsurance();
}

class LifeInsurance implements Insurance {
  // Concrete Product
  createInsurance() {
    // Apply creation logic
    console.log("Life Insurance Created");
  }
}

class DeathInsurance implements Insurance {
  // Concrete Product
  createInsurance() {
    // Apply creation logic
    console.log("Death Insurance Created");
  }
}

class InsuranceFactory {
  // Factory
  getInsurance(insuranceType) {
    switch (insuranceType) {
      case "LIFE":
        return new LifeInsurance();
      case "DEATH":
        return new DeathInsurance();
      default:
        throw new Error("Insurance type not found");
    }

}

function main() {
  const insurance = new InsuranceFactory();
  insurance.getInsurance("LIFE").createInsurance();
  insurance.getInsurance("DEATH").createInsurance();
}

main();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9qwvmnul4ax38sx952mt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9qwvmnul4ax38sx952mt.png" alt="Factory pattern" width="470" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A Guide to Case-Insensitive String Comparison</title>
      <dc:creator>Marco B</dc:creator>
      <pubDate>Mon, 27 May 2024 12:55:01 +0000</pubDate>
      <link>https://dev.to/marcobustillo/a-guide-to-case-insensitive-string-comparison-3339</link>
      <guid>https://dev.to/marcobustillo/a-guide-to-case-insensitive-string-comparison-3339</guid>
      <description>&lt;p&gt;There are times that we want to compare strings case-insensitive. We want to perform data validation, searching and filtering, consistency, etc. You can do this multiple ways in JavaScript but do you wonder what's their differences with each other?&lt;/p&gt;

&lt;p&gt;In this article, we'll look into multiple ways how to do Case-Insensitive string comparisons in JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  RegExp
&lt;/h2&gt;

&lt;p&gt;Regular expressions offer a language-agnostic approach to string comparisons, making it easy to migrate these comparisons to other languages. However, using regular expressions for comparisons can come with a performance cost, particularly when dealing with large and complex strings. This is because regular expressions can be computationally intensive, especially when matching patterns in long strings. As a result, it's essential to weigh the benefits of using regular expressions against the potential performance implications when deciding whether to use this approach for string comparisons.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const str1 = "Hello World";
const str2 = "hello world";

const regex = new RegExp(str1, 'i'); // create a regex pattern with case-insensitive flag

console.log(regex.test(str2))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Convert strings to Upper or Lower case
&lt;/h2&gt;

&lt;p&gt;While converting strings to a single case can be a convenient solution for case-insensitive comparisons, it's not without its drawbacks. Converting strings can add unnecessary computational overhead, especially for large and complex strings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const str1 = "Hello World";
const str2 = "hello world";

const areEqual = str1.toUpperCase() === str2.toUpperCase();
const areEqual2 = str1.toLowerCase() === str2.toLowerCase();

console.log(areEqual)
console.log(areEqual2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  localeCompare()
&lt;/h2&gt;

&lt;p&gt;The localeCompare() function is a powerful and efficient method for comparing strings in JavaScript. As the recommended function for performing case-insensitive comparisons, it offers a faster and more reliable alternative to using regular expressions and case-conversion checks. As a built-in method in JavaScript, it can be easily integrated into a variety of environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const str1 = "Hello World";
const str2 = "hello world";

console.log(str1.localCompare(str2, 'en-US', { sensitivity: 'base' }))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Each option has its unique advantages and disadvantages. Ultimately, the best choice depends on the user's specific needs and priorities, requiring a careful evaluation of the trade-offs between each option.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Career Journey</title>
      <dc:creator>Marco B</dc:creator>
      <pubDate>Wed, 23 Aug 2023 03:56:58 +0000</pubDate>
      <link>https://dev.to/marcobustillo/career-journey-52f2</link>
      <guid>https://dev.to/marcobustillo/career-journey-52f2</guid>
      <description>&lt;h2&gt;
  
  
  Recap
&lt;/h2&gt;

&lt;p&gt;My last post here is that I was having my 2020 &lt;a href="https://dev.to/marcobustillo/my-2020-goals-2g8j"&gt;goals&lt;/a&gt;. Unfortunately I wasn't able to accomplish most of the stuff written there. My life went to another direction after that time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happened
&lt;/h2&gt;

&lt;p&gt;After working on one of those goals, A lot has happened from moving to teams to going to a new company&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2020-2021:&lt;/strong&gt; During this time the company I was part of re-shuffled the team. Instead of having the time to work on those goals I needed to be accustomed to the team: New standards, practices, and principles. It was also the reason why I have left the company. I was unhappy with the change.&lt;br&gt;
From having a freedom to follow a day to day process. I was not also happy of always having a buy mindset first before building. I felt like I wasn't valuable anymore to the company/team.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2021-2022:&lt;/strong&gt; This new work I had was a shock to me. Because I needed to report to a client. From having a consistent team to needing to change clients every month or so. At first I was anxious about it because I wasn't a great communicator but over the course of months I got used to it and became a better communicator. On top of that I have the opportunity to use different types of technologies (ohh shiny new toys). I have also felt that I became a better developer I experienced a lot of new challenges and problems that I know for sure that I won't experience if I have sticked to a product based company.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2022-Present&lt;/strong&gt;&lt;br&gt;
A new year a new me. I always wanted to try out doing DevOps so I asked to shift my career from Software Development to DevOps. I was happy with the move I learned a lot and I felt It made me a better software engineer. I learned a lot of the Ops side and it opened my eyes on how valuable knowing that stuff for a software engineer. But it is not always a happy time. For the first 6 months I struggled. Learning about networking, cloud design patterns, and cloud architecture it was a daunting task but I managed to pull through. Gotten a lot of azure certifications and will try to have more. If there's somebody who will ask me for advice moving from software development to DevOps. You will need to be prepared for the steep learning curve ahead! It is not impossible to do and having a developer background already puts you ahead of other people coming from other domain.&lt;/p&gt;

&lt;h2&gt;
  
  
  To the future!
&lt;/h2&gt;

&lt;p&gt;Now even though I am quite happy with my current role I am still doing development. In my free time instead of studying about DevOps or tools relating to it I always see my self doing development projects. Maybe on my next update ill be a developer but who knows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Credits&lt;/strong&gt;:&lt;br&gt;
Cover photo: &lt;a href="https://dribbble.com/allyreevessays"&gt;https://dribbble.com/allyreevessays&lt;/a&gt;&lt;br&gt;
Image resize: &lt;a href="https://www.kapwing.com/tools/resize/gif"&gt;https://www.kapwing.com/tools/resize/gif&lt;/a&gt;&lt;/p&gt;

</description>
      <category>personal</category>
      <category>career</category>
    </item>
    <item>
      <title>MY 2019 YEAR REVIEW AND FIRST DEV.TO POST</title>
      <dc:creator>Marco B</dc:creator>
      <pubDate>Thu, 02 Jan 2020 09:28:22 +0000</pubDate>
      <link>https://dev.to/marcobustillo/my-2019-year-review-and-first-dev-to-post-46af</link>
      <guid>https://dev.to/marcobustillo/my-2019-year-review-and-first-dev-to-post-46af</guid>
      <description>&lt;p&gt;This will be my first ever post in dev.to and last post in 2019. Happy new year's everyone.&lt;/p&gt;

&lt;h1&gt;
  
  
  Career
&lt;/h1&gt;

&lt;p&gt;My career started great in 2019 I moved to a higher paying job, better bosses and found a mentor. It gave me an opportunity to pick up a new skill in GraphQL(Which i really enjoyed learning) and also be able to share and collaborate with people who are experts in front end and backend development. I have learned a lot this year not only in development but also personally.&lt;/p&gt;

&lt;h1&gt;
  
  
  Personal
&lt;/h1&gt;

&lt;p&gt;This year my personal growth has been great. I created my own portfolio websites and other side projects. I am currently on a daily routine that increased my happiness. Travelled to new places which I rarely do.&lt;/p&gt;

&lt;h1&gt;
  
  
  Freelancing
&lt;/h1&gt;

&lt;p&gt;2019 is also the year that I have resumed my freelance work. I worked on a chat app for conventions. This project gave me a lot of new learnings about collaboration and entering an existing codebase that has no structure at all.&lt;/p&gt;

&lt;h1&gt;
  
  
  Investments and Savings
&lt;/h1&gt;

&lt;p&gt;This would be the proudest and happiest thing that happened to me. For 2 years of working I had no savings. i was excited to spend my salary on things that i have never gotten as a child. But this year not only i have savings. I also have emergency funds and investments.(woo hoo)&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;2019 is the best year of my life and hoping in 2020 I continue this and go back here to post my 2020 review&lt;/p&gt;

</description>
      <category>personal</category>
    </item>
    <item>
      <title>MY 2020 GOALS</title>
      <dc:creator>Marco B</dc:creator>
      <pubDate>Thu, 02 Jan 2020 09:27:41 +0000</pubDate>
      <link>https://dev.to/marcobustillo/my-2020-goals-2g8j</link>
      <guid>https://dev.to/marcobustillo/my-2020-goals-2g8j</guid>
      <description>&lt;h1&gt;
  
  
  Goals
&lt;/h1&gt;

&lt;p&gt;My goals for 2020 are:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Learning Go
&lt;/h3&gt;

&lt;p&gt;This is one of my main goals for 2020. Learning about GoLang, building projects and be able to add this skill in my tool belt.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Finish my unfinished projects
&lt;/h3&gt;

&lt;p&gt;I will now start to finish all of my unfinished projects in 2020 so I can showcase it on my portfolio website.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Get my AWS developer certificate
&lt;/h3&gt;

&lt;p&gt;Accomplishing this goal would be one of my happiest moments in 2020&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Continuously write something
&lt;/h3&gt;

&lt;p&gt;I will make this my habit to write something everyday. From blogs, articles, letters and self reflection&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Contribute to open-source
&lt;/h3&gt;

&lt;p&gt;I will make it a habit to contribute to open source&lt;/p&gt;

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