<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Marius Bongarts]]></title><description><![CDATA[❤️ User happiness ＞ hyper-growth 

👨‍💻 Building http://web-highlights.com (80K+ users)
⭐️ 3x Top Writer on Medium: http://medium.com/@mariusbongarts]]></description><link>https://blog.marius-bongarts.de</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 06:10:52 GMT</lastBuildDate><atom:link href="https://blog.marius-bongarts.de/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[The Art of Slow Growth: How I Calmly Grew My Chrome Extension to 100K Users In 5 Years]]></title><description><![CDATA[We all want to change the world, ideally earn a lot of money in the process, and preferably do it as quickly as possible.
We tend to set the bar high for ourselves. Sadly, this often results in letdowns. This is where many of us throw in the towel. B...]]></description><link>https://blog.marius-bongarts.de/the-art-of-slow-growth-how-i-calmly-grew-my-chrome-extension-to-100k-users-in-5-years</link><guid isPermaLink="true">https://blog.marius-bongarts.de/the-art-of-slow-growth-how-i-calmly-grew-my-chrome-extension-to-100k-users-in-5-years</guid><category><![CDATA[Entrepreneurship]]></category><category><![CDATA[marketing]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[#growth]]></category><category><![CDATA[startup]]></category><category><![CDATA[Startups]]></category><dc:creator><![CDATA[Marius Bongarts]]></dc:creator><pubDate>Tue, 04 Jun 2024 12:33:59 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/L-2p8fapOA8/upload/7591621a927fdd2cb1e97a086e4d15c4.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>We all want to change the world, ideally earn a lot of money in the process, and preferably do it as quickly as possible.</p>
<p>We tend to set the bar high for ourselves. Sadly, this often results in letdowns. This is where many of us throw in the towel. But, it’s crucial to realize that overnight success is rare.</p>
<p>In this piece, I want to share a few tips that kept me going and helped my Chrome Extension reach 100K users in 5 years 🐢</p>
<h3 id="heading-dont-rush">Don’t Rush</h3>
<p>Most solopreneurs start their side hustle next to their full-time job. That’s why most of us have time. Still, many of us are rushing!</p>
<blockquote>
<p>The day you stop racing is the day you win the race. — Bob Marley</p>
</blockquote>
<p>Nowadays, so many "overnight" success stories bombard us. We believe that if our side project doesn’t go through the roof in the next few months, we fail.</p>
<p>However, it’s a fact that true success rarely happens overnight.</p>
<p>I am building <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Web Highlights</a> now for over 5 years, and it took me over a year to gain my first 10 users.</p>
<p><strong>TEN users!</strong></p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*mIOZY3nMFTcNp0rrh31qFw.png" alt="Weekly users over time — Web Highlights Chrome Extension" /></p>
<p>And honestly, all of those 10 users were friends and family!</p>
<p>A few months later, the first unknown user signed up — I couldn’t be happier. It took me another whole year to <a target="_blank" href="https://medium.com/@mariusbongarts/my-journey-to-the-first-9-99-with-my-side-project-3edc13dd1f2d">make my first $9.99</a>.</p>
<blockquote>
<p>Most people overestimate what they can do in one year and underestimate what they can do in ten years.<br />― Bill Gates</p>
</blockquote>
<p><strong>If your financial situation doesn’t rely on your product, don’t rush; take your time.</strong></p>
<p>Build habits around your side hustle. Improve your product every day and ensure to create an outstanding product your customers love.</p>
<p>Growth will follow, it just takes time.</p>
<blockquote>
<p>Instead of trying to be a Lion in business, I strive to be a Tortoise. — <a target="_blank" href="https://medium.com/u/3c68f7b89b81">Cameron Scott</a></p>
</blockquote>
<p>To sum this up, <a target="_blank" href="https://medium.com/u/1753cee1bce5">Paul Graham</a> would say: <em>“Build something 100 people love, not something 1 million people kind of like.”</em></p>
<h3 id="heading-dont-measure-yourself-against-an-ideal">Don’t Measure Yourself Against An Ideal</h3>
<p>It’s deep in our genes that we always want more. We rush from milestone to milestone, but forget about what we already achieved.</p>
<p><a target="_blank" href="https://web-highlights.com/">Web Highlights</a> is bringing in about $1,000 every month. That’s awesome and beyond what I had hoped for. I’m really proud of hitting this milestone.</p>
<p>But then I’ll glance at other Chrome Extensions with a similar user base and notice they’re making millions in revenue, with an entire team behind them. This realization brings me down and plunges me into a mental state that Dun Sullivan calls "The GAP":</p>
<blockquote>
<p>There are two ways in which you can measure yourself: against an ideal, which puts you in what I call ‘the GAP,’ and against your starting point, which puts you in ‘the GAIN,’ appreciating all that you’ve accomplished.</p>
</blockquote>
<p>Whenever we are in “<em>the GAP,”</em> we are looking at all the things we could have achieved. This can lead to stress, demotivation, and feelings of sadness. Instead, we should transform our mental state into the <em>“GAIN”</em> and look at all the things we have achieved.</p>
<p>So, instead of looking at others, we should look at ourselves.</p>
<blockquote>
<p>The GAIN creates freedom. The GAP makes you a slave to your unhealthy need. — Dan Sullivan</p>
</blockquote>
<p>This concept has helped me a lot. Whenever I start to compare myself to other businesses, I remind myself to turn my mental state to “the GAIN” and look at all the things I have achieved instead:</p>
<ul>
<li><p>My <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">app</a> is making digital research easier for over 100,000 users worldwide.</p>
</li>
<li><p>I consistently receive heartwarming emails from users expressing their gratitude for how much the app helps them.</p>
</li>
<li><p>My <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a> has an average rating of 4.8 stars with over 1,600 ratings, outshining most extensions in the store.</p>
</li>
</ul>
<p>Yes, true, it’s not making me a living yet. Still, it’s making me a decent amount of passive income every month.</p>
<p>Reflecting on my past goals is helpful for me. Every time I do that, I realize that I have already achieved much more than I ever expected.</p>
<p>So, here is my tip: Next time you feel stressed because you compare yourself to others, don’t focus on what you could do next. Instead, take a moment to appreciate what you’ve already accomplished.</p>
<h3 id="heading-build-a-great-product-first">Build A Great Product First</h3>
<p>Marketing is important — but it’s not everything. Nowadays, you often hear statements like these:</p>
<blockquote>
<p><em>Even the greatest ideas need a megaphone. Without marketing, they’re just whispers in the wind. — Jeffrey Eisenberg in The Rice and Beans Millionaire</em></p>
</blockquote>
<p>or this one:</p>
<blockquote>
<p><em>Great products don’t sell themselves; marketing is the storyteller that brings them to life. — Seth Godin in This Is Marketing</em></p>
</blockquote>
<p>Many solopreneurs hear that and focus everything on marketing while forgetting to build a great product first.</p>
<p>I have realized that for myself a few months ago. I was focusing on Marketing and SEO and gained millions of impressions on Google for <a target="_blank" href="https://web-highlights.com/">web-highlights.com</a>.</p>
<p>Still, I always knew that my product is not yet perfect. Recently, I saw this tweet about two paths we can take: either <strong>make a better product</strong> or <strong>create a mediocre one with more marketing</strong>.</p>
<p>While both strategies are viable, I feel like doing marketing for a “shitty” product shouldn’t be something you should aim for.</p>
<p>I am a true believer that, if you build an awesome product, it will be recognized sooner or later.</p>
<p>Improve your product, create something incredible, and let time do its thing.</p>
<hr />
<p>Thanks for reading!</p>
<p>Want to learn more about how I scaled my <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a> to almost 100,000 users as a solopreneur? <a target="_blank" href="https://medium.com/@mariusbongarts/subscribe">Subscribe to my stories</a> or follow me on <a target="_blank" href="https://www.linkedin.com/in/marius-bongarts-6b3638171/">LinkedIn</a> and <a target="_blank" href="https://twitter.com/MariusBongarts">Twitter</a>.</p>
<p>If you read a lot online, make sure to check out my <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a> loved by 100k+ active user — it’s free and no account is needed.</p>
]]></content:encoded></item><item><title><![CDATA[3 Unusually Painful Mistakes on My Side Project Journey to 100K Users]]></title><description><![CDATA[Mistakes are inevitable when building side projects. Learn from my 3 biggest mistakes to take a shortcut on the path to a successful side hustle.

I have not failed. I’ve just found 10,000 ways that won’t work. — Yevgeniy Brikman

The biggest mistake...]]></description><link>https://blog.marius-bongarts.de/3-unusually-painful-mistakes-on-my-side-project-journey-to-100k-users</link><guid isPermaLink="true">https://blog.marius-bongarts.de/3-unusually-painful-mistakes-on-my-side-project-journey-to-100k-users</guid><category><![CDATA[solopreneur ]]></category><category><![CDATA[Entrepreneurship]]></category><category><![CDATA[Startups]]></category><dc:creator><![CDATA[Marius Bongarts]]></dc:creator><pubDate>Fri, 03 May 2024 05:59:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/hHg9MC-G8_Y/upload/8fd54fea9099683157419b8935c48848.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Mistakes are inevitable when building side projects. Learn from my 3 biggest mistakes to take a shortcut on the path to a successful side hustle.</p>
<blockquote>
<p>I have not failed. I’ve just found 10,000 ways that won’t work. — Yevgeniy Brikman</p>
</blockquote>
<p>The biggest mistake many people make is to believe that mistakes are bad. Yet they are a key reason for success. That’s why I’m not embarrassed by mine and I’m happy to share them with you.</p>
<p>I assure you: You will still make many mistakes — but different ones.</p>
<blockquote>
<p>Winners are not afraid of losing. But losers are. Failure is part of the process of success. People who avoid failure also avoid success.</p>
<p>— Robert Kiyosaki in Rich Dad Poor Dad</p>
</blockquote>
<h3 id="heading-1-never-questioning-growth">1. Never Questioning Growth</h3>
<p>You learn a lot when building on the side. Take Marketing and Search Engine Optimization (SEO), for instance — they’re crucial for any successful business.</p>
<p>But here’s the thing nobody talks about: it’s not all about expanding all the time. Sometimes, the smart move is to focus on improving your product and making your customers happier.</p>
<blockquote>
<p><em>Your product should be so good that even your competitors recommend it. —</em><a target="_blank" href="https://www.brainyquote.com/quotes/elon_musk_949258"><em>Elon Musk</em></a></p>
</blockquote>
<p>For me, learning about SEO was like an addiction. I dug deep into SEO and <a target="_blank" href="https://bettermarketing.pub/3-instant-ways-to-increase-your-google-ranking-d36cf98a933e">shared my learnings in my articles</a>.</p>
<p>Soon I gained millions of impressions on Google and hundreds of thousands of clicks for <a target="_blank" href="https://web-highlights.com/">web-highlights.com</a>:</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*mfpCPWkyUuepAL5Z-3yyDQ.png" alt="Google Search Performance for web-highlights.com." /></p>
<p>Google Search Performance for <a target="_blank" href="https://web-highlights.com/">web-highlights.com</a>.</p>
<p>It was amazing to gain such traffic and my user base grew a lot. Best of all: It was free marketing.</p>
<p>However, too much marketing can lead to neglecting the improvement of the actual product. I was scaling a product that was not ready for the masses yet. I knew there were issues. But, as my time was limited I couldn’t fix them because I focused too much on marketing.</p>
<p>I am a true believer that if you build an exceptional product it will sooner or later be valued and recognized. In <a target="_blank" href="https://medium.com/@mariusbongarts/forget-about-marketing-focus-on-building-an-awesome-product-910039ded684">Forget About Marketing. Focus on Building An Awesome Product</a> I discussed in detail why you should first build an exceptional product before you focus on growth.</p>
<blockquote>
<p>Sometimes the best plan is focused on your current customers’ success, not on chasing leads and growth. — <strong>Paul Jarvis</strong> in <strong>Company of One</strong></p>
</blockquote>
<p>Recently, I saw a great Tweet about it:</p>
<p>While both strategies are viable, I feel like doing marketing for a “shitty” product shouldn’t be something you should aim for.</p>
<p>A few months ago, when I realized that, I stopped any marketing efforts and completely focused on improving my <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a>. Soon my app became significantly faster, more reliable, and way more enjoyable. The user feedback was amazing.</p>
<p>Create something amazing and people will talk about it. Growth will follow. Slowly but steadily.</p>
<blockquote>
<p>Trying to avoid mistakes at all costs, or pretending that mistakes never happen, is not a viable strategy. More realistic is having a plan for when they do happen. — <strong>Paul Jarvis in Company of One</strong></p>
</blockquote>
<h3 id="heading-2-not-building-an-audience-sooner">2. Not Building An Audience Sooner</h3>
<p>Building a community around your business is one of the most important things you can do.</p>
<p>I feel uncomfortable posting on <a target="_blank" href="https://www.linkedin.com/in/marius-bongarts-6b3638171/">LinkedIn</a> and <a target="_blank" href="https://twitter.com/MariusBongarts">Twitter</a>. I don’t like putting myself out there and posting stuff about things most of my LinkedIn friends don’t even care about. At least that’s what it often feels like for me.</p>
<p>If you’re a solopreneur like me you might feel the same way. Still, I can only emphasize the importance of building an online audience.</p>
<p><strong>Get out of your comfort zone and start creating value. Join the 1% on the internet!</strong></p>
<blockquote>
<p>According to the 1% rule, about 1% of Internet users create content, while 99% are just consumers of that content.  — <a target="_blank" href="https://en.wikipedia.org/wiki/1%25_rule">wikipedia.org</a></p>
</blockquote>
<p>I wish I had done this sooner. Everyone has something to share that has value for others.</p>
<p>If you’re building an AI tool, write about how to set up the OpenAI API. If you’re selling clothes, write about mode trends. For example, <a target="_blank" href="https://medium.com/@mariusbongarts/how-to-build-the-medium-text-highlighter-as-a-chrome-extension-with-web-components-b3feccddcd01">my very first Medium article</a> was a guide on creating a Chrome Extension — because that’s what I do, building a <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a>.</p>
<p>I like the idea of a 1000 True Fans by <a target="_blank" href="https://kk.org/thetechnium/1000-true-fans/">Kevin Kelly</a>:</p>
<blockquote>
<p>To be a successful creator you don’t need millions. You don’t need millions of dollars or millions of customers, millions of clients or millions of fans. To make a living as a craftsperson, photographer, musician, designer, author, animator, app maker, entrepreneur, or inventor you need only thousands of true fans. — <a target="_blank" href="https://kk.org/thetechnium/1000-true-fans/">kk.org</a></p>
</blockquote>
<p>It does not matter on which platform or what kind of content you create. Just make sure to create value for your audience.</p>
<blockquote>
<p>A true fan is defined as a fan that will buy anything you produce. — <a target="_blank" href="https://kk.org/thetechnium/1000-true-fans/">kk.org</a></p>
</blockquote>
<p>Soon you will have a follower audience trusting you and willing to buy your products.</p>
<h3 id="heading-3-not-documenting-everything">3. Not Documenting Everything</h3>
<p>I was 22 when I started building <a target="_blank" href="https://web-highlights.com/">Web Highlights</a>. After one year, there were only 10 users. Why would you create documentation for a tool no one uses?</p>
<p>I am not saying you should create documentation the moment you spin off your new side project and validate your idea. However, you should not miss the point when your idea turns into business.</p>
<p>That’s the point where you should document every single process to not make your business completely rely on you.</p>
<p><strong>I have missed that point.</strong></p>
<blockquote>
<p>If you don’t document how your business works, how will someone be able to run it without you? Therefore, you must write down every single process as part of your company’s how-to guide. — The E-Myth Revisited (Blinkist Summary)</p>
</blockquote>
<p>I was naive. Probably like most solopreneurs it didn’t make sense to me to write documentation for a project only I was working on. Honestly, even if someone had told me, I likely wouldn’t have listened.</p>
<p>The points I failed to grasp were that by not writing documentation:</p>
<ul>
<li><p><strong>you’re shutting the door for others to work on the project</strong></p>
</li>
<li><p><strong>your business is much more valuable when well-documented, as it’s far more attractive to buy</strong></p>
</li>
<li><p><strong>documented processes help you save time and identify where things can be automated.</strong></p>
</li>
</ul>
<p>The first two points are crucial. Even if I’m not thinking about hiring others for the project right now, writing documentation significantly boosts the business’s value if you ever consider selling it.</p>
<blockquote>
<p>If your business’s systems are designed to work in the simplest and most efficient way, anyone can run the business, and thus it is appealing to buy. — The <strong>E-Myth Revisited (Blinkist Summary)</strong></p>
</blockquote>
<p><strong>I am trying to catch up but it’s a lot of work.</strong></p>
<p>I do now understand the importance of documenting every single step of a business and I am trying to catch up. It’s just that I could have saved so much time.</p>
<p>Most solo entrepreneurs probably skip writing documentation when they start. That’s fine initially, but if you’re serious about growing your business, it’s best to begin as soon as you can. Perhaps you should, especially if your ultimate aim is to establish a lasting business that you might eventually consider selling.</p>
<p>If you don’t document how your business works, how will someone be able to run it without you?</p>
<p>Thanks for reading!</p>
<p>Want to learn more about how I scaled my <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a> to 100k+ users as a solopreneur? <a target="_blank" href="https://blog.marius-bongarts.de/">Subscribe to my newsletter</a> or follow me on <a target="_blank" href="https://www.linkedin.com/in/marius-bongarts-6b3638171/">LinkedIn</a> and <a target="_blank" href="https://twitter.com/MariusBongarts">Twitter</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Forget About Marketing. Focus on Building An Awesome Product]]></title><description><![CDATA[If you’re just starting your entrepreneur journey to build an awesome product, I bet you don’t like this quote:

Even the greatest ideas need a megaphone. Without marketing, they’re just whispers in the wind. — Jeffrey Eisenberg in The Rice and Beans...]]></description><link>https://blog.marius-bongarts.de/forget-about-marketing-focus-on-building-an-awesome-product</link><guid isPermaLink="true">https://blog.marius-bongarts.de/forget-about-marketing-focus-on-building-an-awesome-product</guid><category><![CDATA[Entrepreneurship]]></category><category><![CDATA[Startups]]></category><category><![CDATA[marketing]]></category><dc:creator><![CDATA[Marius Bongarts]]></dc:creator><pubDate>Sun, 03 Mar 2024 23:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1714715727900/49b521c5-e7e7-47e5-aeb9-e734cb1baac1.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you’re just starting your entrepreneur journey to build an awesome product, I bet you don’t like this quote:</p>
<blockquote>
<p>Even the greatest ideas need a megaphone. Without marketing, they’re just whispers in the wind. — Jeffrey Eisenberg in The Rice and Beans Millionaire</p>
</blockquote>
<p>or this one:</p>
<blockquote>
<p>Great products don’t sell themselves; marketing is the storyteller that brings them to life. — Seth Godin in This Is Marketing</p>
</blockquote>
<p>Don’t we all wish to create a product without the extra hassle?</p>
<p>In this article I want to share the words every indie hacker dreams of hearing: Sometimes, you just need to take a seat and BEGIN CREATING. Improve your product, create something incredible, and let time do its thing.</p>
<h4 id="heading-first-a-quick-side-note">First, a quick side note:</h4>
<ul>
<li><p>I am a developer building projects on the side</p>
</li>
<li><p>No shareholders are dictating any roadmap</p>
</li>
<li><p>I do not financially rely on my product’s success</p>
</li>
</ul>
<p>To put it another way, I am not dependent on the financial success of my side projects and can let time play for me. I’m not a pro marketer yet, and I know marketing does matter. However, I still wanted to get improvement, so I focused on what I could control: the quality of my product.</p>
<blockquote>
<p>Generally, I don’t let my business make me too happy, so that it can’t make me too sad. — Sahil Lavingia in The Minimalist Entrepreneur</p>
</blockquote>
<h3 id="heading-what-made-me-write-this-article">What Made Me Write This Article?</h3>
<p>Isn’t it strange how quickly people can change their minds? Just a few months ago, I was emphasizing the <a target="_blank" href="https://web-highlights.com/blog/3-advanced-ways-to-increase-your-google-ranking/">significance of SEO in my articles</a>, but now I’m suggesting that sometimes it’s better to concentrate on creating a fantastic product.</p>
<blockquote>
<p>If you don’t change your mind frequently, you’re going to be wrong a lot. People who are right a lot want to disconfirm their fundamental biases. — <strong>Jeff Bezos at the</strong> <a target="_blank" href="https://www.fastcompany.com/90360687/jeff-bezos-business-advice-5-tips-from-amazons-remars">MARS conference in Las Vegas</a></p>
</blockquote>
<p>Don’t get me wrong, SEO and Marketing are essential to scale a great business.</p>
<p>However, if you’re a <strong>“</strong>Company of One<strong>”</strong> like me, you need to prioritize wisely. In the past, I spent too much time on SEO and marketing, neglecting the product itself.</p>
<p>There were always a few things that weren’t working quite right but should have been fixed earlier.</p>
<p>If you have a full-time job, spend 30 minutes every morning writing an article for SEO, then post it on <a target="_blank" href="https://twitter.com/MariusBongarts">Twitter</a> and <a target="_blank" href="https://www.linkedin.com/in/marius-bongarts-6b3638171/">LinkedIn</a>. Well, then there simply isn’t much time left to work on new features for a long time without interruption.</p>
<p>That’s why, in the last few months, I dedicated all my efforts to improving the app for my users. I didn’t share any articles here, didn’t tweet or post on <a target="_blank" href="https://www.linkedin.com/in/marius-bongarts-6b3638171/">LinkedIn</a>, and didn’t write blog posts to boost my SEO rankings — <strong>I simply sat down and built!</strong></p>
<h3 id="heading-what-are-the-results">What are the results?</h3>
<p>I wouldn’t be writing this article if I regretted my choice to focus on building and putting marketing aside.</p>
<p>The results are great and I wish I would have done it earlier.</p>
<blockquote>
<p>“The most powerful marketing is the joy customers experience when using your extraordinary product.” — Jeanne Bliss in Chief Customer Officer 2.0</p>
</blockquote>
<p>Here is what happened:</p>
<ul>
<li><p><a target="_blank" href="https://chrome.google.com/webstore/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Web Highlights</a> active users increased from 40,000 to over 70,000</p>
</li>
<li><p>the average Chrome Store rating went from 4.6 stars to 4.8 stars, with over 1,1K+ ratings.</p>
</li>
</ul>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*PBzfwqSFa_bIVRyZpg_G_w.png" alt="Active users grew from ~46K to ~72K in only three months" /></p>
<p>Active users grew from ~46K to ~72K in only three months</p>
<p>I want to highlight that I’m developing a <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a>, and the cool part is, it naturally grows through the Chrome Web Store. Good reviews not only boost your extension’s ranking but also attract more traffic and enhance SEO scores on the platform.</p>
<p>This also goes for apps in the Play Store or App Store. That’s why I would say this article is most relevant to indie developers creating apps on these platforms.</p>
<p>I believe attracting traffic to other SaaS websites could be quite challenging without any marketing efforts.</p>
<h3 id="heading-why-you-should-focus-on-building-an-extraordinary-product">Why You Should Focus on Building An Extraordinary Product</h3>
<h4 id="heading-robust-foundation-for-scaling">Robust Foundation for Scaling</h4>
<p>In ‘The One Thing,’ Gary Keller says that whenever we have to decide what to do next, we should ask:</p>
<blockquote>
<p>What’s the one thing you can do such that by doing it everything else will be easier or unnecessary?</p>
</blockquote>
<p>I have asked myself this question and came to the conclusion that some main parts of my application needed to be refactored and renewed.</p>
<p>This meant a lot of work. It required me to concentrate for many hours straight without being distracted by other things. Only by doing so could I lay the groundwork to scale Web Highlights beyond the 100,000 user mark while maintaining or even improving my good reviews.</p>
<p>I was amazed at how quickly I accomplished things and how wonderfully fast and error-free my application became all of a sudden. In a relatively short time, I was able to make the app significantly faster and more user-friendly.</p>
<p>After just one month and the first release, it became clear that my users were much more satisfied.</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*EtJIku7Ya0GFqfpjVMEp2Q.png" alt="“This extension should have existed since browsers became a thing. It’s useful, well designed, intuitive, and beautiful! Fast, no bugs, also useful for PDFs. It’s the whole package. Warning, you may not be able to do without once you use for a while. Thank you Marius!”" /></p>
<p>Growing numbers of users started to love <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Web Highlights</a>.</p>
<p>After that, I revamped the entire <a target="_blank" href="https://app.web-highlights.com/">web app</a> and even built a completely new <a target="_blank" href="https://web-highlights.com/">landing page</a>. This was long overdue, as I had put both together ages ago during my time at university.</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*379CEtrkScvnPIh_3UKLdA.png" alt="Web Highlights landing page before (left) and after (right) the rebuild." /></p>
<p><a target="_blank" href="https://web-highlights.com/">Web Highlights</a> landing page before (left) and after (right) the rebuild.</p>
<p>I was truly astonished at how I could achieve such significant improvements in less than three months.</p>
<p>These substantial enhancements now provide me with the perfect foundation to focus more on marketing and SEO in the future, knowing that my app is ready for a potential 1 million users.</p>
<h4 id="heading-great-software-has-built-in-marketing">Great Software Has Built-In Marketing</h4>
<p>Just because I’ve focused on development for three months doesn’t mean I haven’t indirectly engaged in marketing efforts.</p>
<blockquote>
<p>The best marketing doesn’t feel like marketing — it feels like an exceptional product that speaks for itself.</p>
<p>— Gary Vaynerchuk in Top Inspiring Thoughts of Gary Vaynerchuk</p>
</blockquote>
<p>Often, a well-structured website itself serves as a marketing tool. As mentioned earlier, I completely rebuilt my landing page for Web Highlights, implementing Server Side Rendering (SSR).</p>
<p>This brings about several SEO benefits, hopefully enhancing my website’s Google ranking in the future.</p>
<p>Additionally, I’ve refreshed some texts and addressed accessibility issues, making the website more accessible to everyone.</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*mtxg7m5k_PkhkNX_dpEQBQ.png" alt="Performance: 94, Accessibility: 96, Best Practices: 100, SEO: 100" /></p>
<p>The Google Lighthouse score is now almost perfect.</p>
<h4 id="heading-word-of-mouth-marketing">Word of Mouth Marketing</h4>
<p>I don’t want to build any product. I don’t want to build a product with the most users. I want to build the best product for my users!</p>
<blockquote>
<p>Your product should be so good that even your competitors recommend it. — <a target="_blank" href="https://www.brainyquote.com/quotes/elon_musk_949258">Elon Musk</a></p>
</blockquote>
<p>I strongly believe that my product holds great value and has the potential to revolutionize the way people organize their online research. Consequently, I anticipate that when the product is truly outstanding, users will recommend it, driving substantial growth.</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*A2WVfkki5b4tDAVeGGyiYA.png" alt="Briana Mar 4, 2024 This extension is amazing! I love that I can write notes with any highlights I make. It’s so helpful and runs smoothly with almost no issue! I recommend it to all of my classmates and friends in college!" /></p>
<p>Word of Mouth Marketing is powerful</p>
<p>That’s the kind of marketing I’m aiming for. It’s likely the reason why the key features of my app are free. I want people to enhance their research, and if they genuinely enjoy the product, they can upgrade to access all the other fantastic features.</p>
<h3 id="heading-final-thoughts">Final Thoughts</h3>
<p>Well, of course, the article’s title is intentionally provocative, and I understand that marketing is a crucial factor for any product.</p>
<p>However, I believe that sometimes it’s more important to have a truly excellent product before promoting something that may not be ready for the masses.</p>
<p>User validation is crucial, but before aiming for a million users, it’s essential to ensure that the product can scale without compromising quality.</p>
<p>Especially as a “Company of One,” it’s wise to choose priorities carefully and sometimes just do what you love most: Building.</p>
<p>Thanks for reading! 🙏🏻</p>
<p>Want to learn more about how I built my <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a>, and scaled it to 100k users? <a target="_blank" href="https://blog.marius-bongarts.de/">Subscribe to my newsletter</a> or follow me on <a target="_blank" href="https://www.linkedin.com/in/marius-bongarts-6b3638171/">LinkedIn</a> and <a target="_blank" href="https://twitter.com/MariusBongarts">Twitter</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Time Vs. Dreams: Why I Decided to Sell My B2B SaaS AI Business]]></title><description><![CDATA[With the rise of ChatGPT, I got really excited to build my own AI business. I was not the only one. As a part-time indie hacker, I faced the daunting challenge of competing against fully dedicated and well-financed competitors eager to capitalize on ...]]></description><link>https://blog.marius-bongarts.de/time-vs-dreams-why-i-decided-to-sell-my-b2b-saas-ai-business</link><guid isPermaLink="true">https://blog.marius-bongarts.de/time-vs-dreams-why-i-decided-to-sell-my-b2b-saas-ai-business</guid><category><![CDATA[side project]]></category><category><![CDATA[solopreneur ]]></category><category><![CDATA[Startups]]></category><category><![CDATA[Entrepreneurship]]></category><dc:creator><![CDATA[Marius Bongarts]]></dc:creator><pubDate>Tue, 11 Jul 2023 22:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1711810124204/3fda1cd2-1f52-474b-b29b-9278ef432060.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>With the rise of ChatGPT, I got really excited to build my own AI business. I was not the only one. As a part-time indie hacker, I faced the daunting challenge of competing against fully dedicated and well-financed competitors eager to capitalize on the emerging AI revolution.</p>
<p>After some time, I realized that it was impossible to continue the business in terms of time. The words of Henry Ford echoed in my mind:</p>
<blockquote>
<p><em>“Failure is simply the opportunity to begin again, this time more intelligently.”</em></p>
</blockquote>
<p>But I couldn’t bear the thought of all my hard work going to waste. Too many side projects have already sunk into oblivion. That’s when I decided to sell the business.</p>
<h3 id="heading-how-it-started">How It Started</h3>
<p>Earlier this year, like so many, I was infected by ChatGPT fever.</p>
<p>As a developer, you really couldn’t help but try out the OpenAI API to develop your own product. And it was so easy: Generate an API token at OpenAI, read up a bit on what tokenizers are. Learn how vector databases like Pinecone work, and off you go.</p>
<p>My idea was to create a platform that enables companies to effortlessly design a chatbot customized to their needs. This chatbot would possess comprehensive knowledge regarding their website and give precise answers to any related question. That’s how <strong>Clever Chat</strong> was born.</p>
<p>Relatively quickly, I had the first prototype on <a target="_blank" href="https://clever-chat.ai/">clever-chat.ai</a> and was deeply impressed by the chatbot’s accurate answers when testing it for several websites.</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*KT5rKUhwu4anI7oXNL5Wlw.png" alt="Clever Chat Landing Page" /></p>
<p>When my initial functional MVP was up and running, March had already arrived. However, those who have published a SaaS product understand that there is still a considerable amount of work that needs to be done, including legal pages, payment providers, and other requirements.</p>
<p>Finally, in May 2023, I was ready to publish my product. Unfortunately, the naive-believed rush for my product failed to materialize…</p>
<h3 id="heading-why-i-decided-to-sell">Why I Decided To Sell</h3>
<p>When the first MVP was ready in March, I felt the urgency to launch the product as soon as possible to not miss out on the ChatGPT hype.</p>
<h4 id="heading-competition">Competition</h4>
<p>Although I strongly believed in my idea, I knew I couldn’t be the only one with a similar product. In the following months, competitors started emerging, like <a target="_blank" href="https://www.chatbase.co/">Chatbase.co</a> or <a target="_blank" href="https://sitegpt.ai/">SiteGPT.ai</a>, who essentially built identical products.</p>
<p>As I had hoped for my product, users flocked to these competing products. Within weeks, these services amassed thousands of users. I felt the pressure to release my product as soon as possible.</p>
<p>Given my limited time for this side project alongside my full-time job, it took a while to launch the product by the end of May.</p>
<p>Unfortunately, the anticipated rush for my product never materialized. I lacked the audience and reach to promote it effectively. Moreover, my limited marketing and sales skills hindered its success within such a short timeframe.</p>
<h4 id="heading-abandonment-of-other-projects">Abandonment of other projects</h4>
<p>The situation with Clever Chat differed from my other side projects, such as the <a target="_blank" href="https://chrome.google.com/webstore/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">PDF &amp; Web Highlighter Chrome extension</a> with over 70,000 active users.</p>
<p>With Web Highlights, I had no time constraints, allowing me to design a solid product and implement SEO strategies over a long time. I could work on them whenever I had spare time.</p>
<p>With Clever Chat, I knew I needed early adopters quickly to stay competitive. However, this self-imposed pressure affected my other side projects as well.</p>
<p><a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1711810242243/56f1ebf7-4f68-499c-bf38-633e57b549ca.png" alt="My beloved side project Web Highlights, whose development was set back by Clever Chat" class="image--center mx-auto" /></a></p>
<p>Months went by without publishing an article on Medium. The time I used to allocate for writing in the morning was now dedicated to developing the product.</p>
<p>Additionally, development for <a target="_blank" href="https://web-highlights.com/">Web Highlights</a> had to be put on hold temporarily.</p>
<p>This realization became one of the primary reasons for my decision to sell Clever Chat. I am passionate about writing technical articles on Medium and helping others understand web development.</p>
<blockquote>
<p>“Success is not the key to happiness. Happiness is the key to success. If you love what you are doing, you will be successful.” — Albert Schweitzer</p>
</blockquote>
<p>Furthermore, I have a profitable side project with <a target="_blank" href="https://web-highlights.com/">Web Highlights</a>, which holds significant importance to me and requires constant development. I envision a tremendous potential for Web Highlights and aim to reach the next milestone of 100,000 users, albeit recognizing that such projects require time and nurturing.</p>
<p>Since I decided to sell Clever Chat a few weeks ago, I have found much happiness in having more time for my other projects.</p>
<p>This reassures me that my decision was the right one.</p>
<h3 id="heading-how-i-sold">How I Sold</h3>
<p>Upon deciding to sell my AI business, a wave of relief washed over me initially. However, it didn’t take long for a series of questions to flood my mind:</p>
<ol>
<li><p>Where should I seek potential buyers for my business?</p>
</li>
<li><p>Will there be interested buyers in acquiring a SaaS without revenue?</p>
</li>
<li><p>What is the valuation of Clever Chat?</p>
</li>
</ol>
<h4 id="heading-1-where-should-i-seek-potential-buyers-for-my-business">1. Where should I seek potential buyers for my business?</h4>
<p>In the past, I had heard of <a target="_blank" href="https://acquire.com/">acquire.com</a>. For me, it looked like they were the market leader in selling SaaS.</p>
<p>Putting my listing out there was easy and didn’t come along with any costs, but it needed to be reviewed by the <em>“curation team.”</em> After only one hour, I received an email stating that my <strong><em>“startup is not a good fit”</em></strong> as it was not generating any revenue from customers.</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*7vehbJ8GfjwL-tO2enBzOw.png" alt="Acquire.com listing team declining my Clever Chat listing" /></p>
<p>I was surprised as I had come across similar listings on their website that didn’t generate revenue.</p>
<p>However, instead of challenging their decision, I explored other platforms. That’s when I came across <em>Flippa.com</em>, which appeared to hold promise as it featured numerous smaller SaaS ventures with no revenue generation.</p>
<p>Placing my listing on Flippa was a straightforward process. In contrast to acquire.com, there was a pre-listing fee involved. I had to pay $49 to Flippa to make my listing visible online.</p>
<p>Additionally, Flippa would charge a 5% success fee if you manage to sell your service through their platform.</p>
<h4 id="heading-2-will-there-be-interested-buyers-in-acquiring-a-saas-without-revenue">2. Will there be interested buyers in acquiring a SaaS without revenue?</h4>
<p>This question was answered very quickly for me. After my listing was online at Flippa.com, I had several interested parties and inquiries on my listing after only a few hours.</p>
<p>In a short span of time, I accumulated over ten potential buyers, although the seriousness of their interests varied. It’s worth mentioning that I came across a few warnings online about occasional scammers on Flippa.</p>
<p>So be careful.</p>
<h4 id="heading-3-what-is-the-valuation-of-clever-chat">3. What is the valuation of Clever Chat?</h4>
<p>That was probably the hardest part for me. On the one hand, Clever Chat wasn’t generating any revenue yet, but I still wanted to be compensated somewhat for the time I had put into developing the product.</p>
<p>Of course, I had a lot of fun and learned a lot, but I always try to avoid developing projects for weeks without releasing them.</p>
<p><a target="_blank" href="https://levelup.gitconnected.com/failing-forward-the-importance-of-publishing-your-side-projects-c5e7d7b889dd"><strong>Failing Forward: The Importance of Publishing Your Side Projects</strong><br />*Developers often take on side projects as a way to explore their passion for programming and learn new technologies…*levelup.gitconnected.com</a></p>
<p>My goal was to get at least $5,000 for Clever Chat, so I set it online for $7,500.</p>
<p>When you consider the tax deductions, transaction fees, etc. this is a nice amount, but broken down to the hours, it’s not that much.</p>
<p>Nevertheless, I would be content to view my time spent not only as a valuable learning experience but also as a modest financial gain.</p>
<h3 id="heading-how-much-i-sold-for">How Much I Sold For</h3>
<p>After a few conversations with potential buyers, I settled on a purchase price of $6,000 with someone from Chile.</p>
<p>I might have gotten more from other buyers, but the process and chemistry with the buyer were just right. The handover process went very easily due to the harmonious and trusting communication.</p>
<p>We also agreed that I would continue to support him as a freelance developer. These conditions were perfect for me, as I had sold my business and also had the chance to continue to develop it myself.</p>
<p>I am really looking forward to our collaboration, and I am glad to have found such a nice buyer with whom I am in daily contact.</p>
<h3 id="heading-final-thoughts">Final Thoughts</h3>
<p>The idea of profiting from the AI hype in recent months was held by many. The temptation to quickly set up a B2B and make it big is tempting, but it also takes time.</p>
<p>I have learned a lot while developing Clever Chat. However, at some point, I realized that I didn’t have the time to continue a B2B in terms of sales and marketing.</p>
<p>Now I am extremely happy and also proud to have sold my first SaaS business. Having the opportunity to further to support the buyer as a freelancer in the development makes me happy as well.</p>
<p>Thanks for reading!</p>
<p>Want to learn more about how I scaled my <a target="_blank" href="https://medium.com/r/?url=https%3A%2F%2Fchromewebstore.google.com%2Fdetail%2Fweb-highlights-pdf-web-hi%2Fhldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a> to 100k+ users as a solopreneur? <a target="_blank" href="https://medium.com/@mariusbongarts/subscribe">Subscribe to my stories</a> or follow me on <a target="_blank" href="https://medium.com/r/?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fmarius-bongarts-6b3638171%2F">LinkedIn</a> and <a target="_blank" href="https://medium.com/r/?url=https%3A%2F%2Ftwitter.com%2FMariusBongarts">Twitter</a>.</p>
<p>If you read a lot online, make sure to check out my <a target="_blank" href="https://medium.com/r/?url=https%3A%2F%2Fchromewebstore.google.com%2Fdetail%2Fweb-highlights-pdf-web-hi%2Fhldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a> loved by 90,000+ active user — it’s free.</p>
]]></content:encoded></item><item><title><![CDATA[Are Web Components Dead?]]></title><description><![CDATA[Recently, I published an article with a different question on a similar topic: Will Web Components Replace Frontend Frameworks? Most of us would say NO. But what's your answer regarding the more controversial question of whether Web Components have a...]]></description><link>https://blog.marius-bongarts.de/are-web-components-dead</link><guid isPermaLink="true">https://blog.marius-bongarts.de/are-web-components-dead</guid><category><![CDATA[Web Components]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[software development]]></category><category><![CDATA[web developers]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Programming Tips]]></category><category><![CDATA[Frontend Development]]></category><dc:creator><![CDATA[Marius Bongarts]]></dc:creator><pubDate>Sun, 19 Jun 2022 22:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/Ap2bCOZrAmc/upload/258bcc2068b2b04d99b8b9cb9951194b.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Recently, I published an article with a different question on a similar topic: <a target="_blank" href="https://medium.com/@mariusbongarts11/will-web-components-replace-frontend-frameworks-535891d779ba">Will Web Components Replace Frontend Frameworks?</a> Most of us would say <strong>NO</strong>. But what's your answer regarding the more controversial question of whether <strong>Web Components</strong> have a future at all?</p>
<p>Let's zoom in and explore why some say that Web Components have already died while others think they're the future of web development.</p>
<hr />
<h3 id="heading-introduction">Introduction</h3>
<p>In 2012, when the W3C launched the <a target="_blank" href="https://www.w3.org/TR/2012/WD-components-intro-20120522/#decorators-vs-custom-elements">first specification</a> of Web Components, many expected that Web Components would revolutionize frontend development. And there is good reason to be optimistic. Web Components promised many remarkable things:</p>
<ul>
<li><p>Reusable components with <strong>plain HTML, CSS, Javascript</strong></p>
</li>
<li><p>Based on <strong>official web standards</strong></p>
</li>
<li><p><strong>No framework</strong> needed</p>
</li>
<li><p>Supported in <strong>all evergreen browsers</strong></p>
</li>
</ul>
<p>But, the idea of creating reusable standalone HTML components based on official web standards without any framework sounded too good to be true. Despite the promising advantages, Web Components continuously struggle to find industrywide adoption. Many developers say they have already died.</p>
<p>Who's right? What is the current state of Web Components? Let's face these questions in detail and explore what web components are, where we can find them, why developers are reluctant to use them, and what the future holds.</p>
<h3 id="heading-what-are-web-components">What are Web Components?</h3>
<p>Web Components are reusable client-side components based on official web standards and supported by all major browsers. They are an excellent way of <strong>encapsulating</strong> functionality from the rest of our code. Not only that, but you can <strong>reuse</strong> them in every web application and web page.</p>
<p>Their purpose is to write strongly encapsulated custom elements to use everywhere. Web Components enable us to develop entirely independently of frontend frameworks.</p>
<blockquote>
<p>The primary benefit of Web Components is that we can use them everywhere. With any framework, or even without a framework. — <a target="_blank" href="https://v3.vuejs.org/guide/web-components.html">vuejs.org</a></p>
</blockquote>
<p><strong><em>How do they work?</em></strong></p>
<p>Here's an example of how an <strong>autonomous web component</strong> can be defined:</p>
<p>You can pass your element to any HTML page like this:</p>
<p><code>&lt;my-web-component value="something"&gt;&lt;/my-web-component&gt;</code></p>
<p>For more details on web components, check out my other articles:</p>
<p><a target="_blank" href="https://medium.com/@mariusbongarts/the-complete-web-component-guide-part-1-custom-elements-a627af805df8"><strong>The Complete Web Component Guide: Custom Elements</strong><br /><em>Become an expert in the future of Web Development (Part 1)</em>medium.com</a></p>
<p><a target="_blank" href="https://medium.com/@mariusbongarts/showcase-your-medium-articles-with-web-components-part-1-basics-d2c6618e9482"><strong>Build Your Own Blog Portfolio with Web Components: The Basics</strong><br /><em>Part 1 — Custom elements, Shadow DOM, and HTML Templates</em>medium.com</a></p>
<h3 id="heading-where-can-you-find-web-components"><strong>Where can you find Web Components?</strong></h3>
<p>The web development world is undoubtedly ruled by frontend frameworks/libraries like <strong>React, Angular, and Vue.js.</strong></p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*vV0OT17uIP-hwxQkYGCQYQ.png" alt="State of JS 2022" /></p>
<p><a target="_blank" href="https://2022.stateofjs.com/en-US/libraries/front-end-frameworks/">State of JS 2022</a></p>
<p>The State of JavaScript Survey of 2021 shows that 80 % of the respondents have used <strong>React</strong>, followed by <strong>Angular</strong> (54 %) and <strong>Vue.js</strong> (51 %). Also, <strong>Svelte</strong> moves up quickly and gets more and more users. Now, where do <strong>Web Components</strong> show up in this ranking? Web Components are entirely based on web standards, so we do not expect them to be listed here. Still, there are libraries like <strong>Lit</strong> that support us in building them. After all, at least 7 % of the respondents have used it.</p>
<hr />
<h4 id="heading-frontend-frameworks-adapt-to-web-components"><strong>Frontend Frameworks adapt to Web Components</strong></h4>
<p>However, this is only half the truth. The most-used frontend frameworks have seen quite a bit of adoption lately. All of them support building official standard-based Web Components.</p>
<p>Let's take <strong>Angular</strong>, which provides the <code>@angular/elements</code> package enabling developers to transform a component into a Web Component quickly.</p>
<blockquote>
<p>“Angular elements are Angular components packaged as custom elements […] “ — <a target="_blank" href="https://angular.io/guide/elements">angular.io</a></p>
</blockquote>
<p>Angular Elements is a minimal, self-contained version of the Angular framework. It is injected as a service to support the component's change-detection and data-binding functionality. If you are interested in how Angular Elements works in detail, here is an interesting <a target="_blank" href="https://www.youtube.com/watch?v=Z1gLFPLVJjY&amp;t=4s">Youtube video by Rob Wormald</a>.</p>
<p>Similarly, also, <strong>Vue.js</strong> supports creating Web Components via the <code>defineCustomElement</code> method.</p>
<blockquote>
<p><em>“Vue supports creating custom elements using exactly the same Vue component APIs […] ” —</em> <a target="_blank" href="https://v3.vuejs.org/guide/web-components.html#passing-dom-properties"><em>vuejs.org</em></a></p>
</blockquote>
<p>Having the most popular and most-used frameworks adapting to Web Components shows that their creators bet on a future with Web Components.</p>
<h4 id="heading-usage-of-web-components">Usage of Web Components</h4>
<p>As we can see, Web Components are more present than we may have thought. However, sometimes a framework is still used to create them. However, how can we measure the actual usage of Web Components? One approach would be to look at how often a website registers at least one <a target="_blank" href="https://medium.com/@mariusbongarts11/the-complete-web-component-guide-part-1-custom-elements-a627af805df8"><strong>custom element</strong></a> by calling <code>customElements.define</code>.</p>
<p>As a reminder, here is how to define a custom element:</p>
<pre><code class="lang-plaintext">class MyWebComponent extends HTMLElement {...}
</code></pre>
<pre><code class="lang-plaintext">window.customElements.define('my-web-component', MyWebComponent);
</code></pre>
<p>For Chrome, we can do that by checking the CustomElementRegistryDefine feature usage on <a target="_blank" href="https://chromestatus.com/metrics/feature/timeline/popularity/1689">chromestatus.com</a>:</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*LIk2CfjSNg1QO2NyGPXswg.png" alt="Percentage of page loads (in Chrome) that use CustomElementRegistryDefine (Source: chromestatus.com)" /></p>
<p>Percentage of page loads (in Chrome) that use CustomElementRegistryDefine (Source: <a target="_blank" href="https://chromestatus.com/metrics/feature/timeline/popularity/1689">chromestatus.com</a>)</p>
<p>You can see that around 20<strong>%</strong> of all websites, viewed in a Chrome browser, register at least one <a target="_blank" href="https://medium.com/@mariusbongarts11/the-complete-web-component-guide-part-1-custom-elements-a627af805df8"><strong>Custom Element</strong></a>. For me, this dramatic growth of Web Components was astonishing. Compared to that, and according to <a target="_blank" href="https://w3techs.com/technologies/comparison/js-angularjs,js-react">w3techs.com</a>, only <strong>2.9 %</strong> (Status: June 2022) of all websites use React.</p>
<p>Well, it seems that Web Components'usage is higher than most of us expected (at least, that is what I assume). But, what about big companies? When looking at job descriptions, most of them require experience with at least one of the most used frontend frameworks — React, Angular, and Vue.js. So, are there companies requiring to know about Web Components? Are there big companies that have decided that Web Components is the best way to implement their frontend?</p>
<p>One of the most famous examples is <strong>Github</strong>. When Github launched over a decade ago, it had a frontend codebase that mostly used jQuery. Over the years, their GitHub monolith grew in size, and they saw the need to implement better encapsulation before the frontend became unmanageable. They chose to use Web Components because their codebase was already structured into component-like behaviors. Furthermore, they could experiment with Web Components alongside their existing frontend infrastructure since it doesn't incur any upfront cost or "buy-in" to a specific framework.</p>
<blockquote>
<p>“We’re using Web Components in a big way at GitHub” — <a target="_blank" href="https://github.blog/2021-05-04-how-we-use-web-components-at-github/">github.blog</a></p>
</blockquote>
<p>But, also Github faced many problems when navigating to a frontend infrastructure using Web Components. There are some common <strong>pain points</strong> that all developers have with the current state of Web Components. That leads us to our next question.</p>
<h3 id="heading-why-are-developers-reluctant-to-use-web-components">Why are developers reluctant to use web components?</h3>
<p>As mentioned at the beginning, there are plenty of reasons to believe that Web Components could replace modern frontend frameworks. Now, a lot of developers are still reluctant to use Web Components. Why is that? Is it because they feel threatened by the thought of Web Components wiping out frontend frameworks? As I already analyzed in my former article '<a target="_blank" href="https://medium.com/@mariusbongarts11/will-web-components-replace-frontend-frameworks-535891d779ba">Will Web Components Replace Frontend Frameworks?</a>' — there is no reason to drop your frontend framework. Quite the reversal, combining frontend frameworks with Web Components is the real secret to success.</p>
<blockquote>
<p><em>As a developer, you are free to use React in your Web Components, or to use Web Components in React, or both. —</em> <a target="_blank" href="https://reactjs.org/docs/web-components.html"><em>reactjs.or</em></a>g</p>
</blockquote>
<p>Nevertheless, there is no getting around the fact that Web Components are not yet fully developed and face many problems and pain points.</p>
<h4 id="heading-problems-of-web-components"><strong>Problems of Web Components</strong></h4>
<p>Let's look at the difficulties Web Components face in the current state. Here are some of the developers' most common problems when working with them.</p>
<p><strong>Shadow DOM</strong></p>
<p>One pain point of Web Components is the <a target="_blank" href="https://medium.com/@mariusbongarts11/the-complete-web-component-guide-shadow-dom-2e40921eb77">Shadow DOM</a>. While the idea of having wholly encapsulated markup and style of components is excellent, there are still many challenges and open questions. For example, how to apply <strong>global styles</strong> to Web Components with shadow roots? Indeed, the Shadow DOM allows us to modify styles within their roots by using, e.g., <strong>Shadow Parts</strong> and <strong>CSS variables</strong>. Also, there are many approaches and workarounds to apply global styles, but I haven't seen the ultimate solution.</p>
<p><a target="_blank" href="https://medium.com/@mariusbongarts/the-complete-web-component-guide-shadow-dom-2e40921eb77"><strong>The Complete Web Component Guide: Shadow DOM</strong><br /><em>Become an expert in the future of Web Development (Part 3)</em>medium.com</a></p>
<p><strong>Github</strong> also faces problems when working with Shadow DOM and is supporting an open Github proposal for <a target="_blank" href="https://github.com/whatwg/dom/issues/831">declarative Shadow DOMs</a>. That could solve some common issues developers face when working with shadow roots.</p>
<blockquote>
<p>These proposals would make it even easier for engineers to ship Web Components and would solve some common pain points that we have with the current state of Web Components. — <a target="_blank" href="https://github.blog/2021-05-04-how-we-use-web-components-at-github/">github.blog</a></p>
</blockquote>
<p>But, the primary motivation for this proposal is the support of Server Side Rendering (SSR) for Web Components. That leads us to the next problem.</p>
<p><a target="_blank" href="https://levelup.gitconnected.com/web-components-at-big-tech-companies-github-812e632e1650"><strong>Web Components at Big Tech Companies: Github</strong><br /><em>If the enterprise can deploy web components so can you!</em>levelup.gitconnected.com</a></p>
<p><strong>Server Side Rendering</strong></p>
<p>All modern frameworks provide a way to server-side render their components. For example, Angular provides <strong>Angular Universal</strong>, React a <strong>ReactDOMServer</strong>, and Vue.js provides a <code>renderToString</code> function.</p>
<p>Using <strong>SSR</strong> in combination with Web Components is practically <strong>difficult</strong> or <strong>impossible</strong> to use. Web Components rely on browser-specific DOM APIs that are unavailable on the server. At least not until you use some headless browser like Puppeteer to pre-render your components and send an initial string to the browser. But, even when pre-rendering your components, we can not yet use the Shadow DOM because we can not represent them declaratively yet. Therefore, it is impossible to send it over in the initial string of HTML. To put it short: <strong>To use Shadow DOM, we need JavaScript</strong>.</p>
<p>Luckily, there are libraries like Lit or Stencil to help us in building Web Components. Stencil already provides their <a target="_blank" href="https://stenciljs.com/docs/hydrate-app"><strong>Hydrate App-Bundle</strong></a> to accomplish SSR, and also <a target="_blank" href="https://medium.com/@mariusbongarts/build-your-own-blog-portfolio-with-web-components-lit-library-2701dffc735f"><strong>Lit</strong></a> is working on a <code>@lit-lab/ssr</code> package for server-side rendering.</p>
<hr />
<p><strong>Accessibility</strong></p>
<p>One more concern we need to keep in mind when working with Web Components is accessibility. <strong>Accessibility</strong> aims to provide a universally accessible global information system for everyone. By that, we ensure that people with disabilities can use all website tools and technologies.</p>
<p><a target="_blank" href="https://medium.com/@mariusbongarts/4-simple-steps-to-make-your-website-accessible-a29ec305da1e"><strong>4 Simple Steps to Make Your Website Accessible</strong><br /><em>“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.” —…</em>medium.com</a></p>
<p>This problem can also be traced back to the <a target="_blank" href="https://medium.com/@mariusbongarts/the-complete-web-component-guide-shadow-dom-2e40921eb77"><strong>Shadow DOM</strong></a>. Typically, you create DOM nodes and append them as children of another element. With Shadow DOM, you create a scoped DOM tree that's attached to the element but separate from its actual children. This scoped subtree is called a <strong>shadow tree</strong> and is essentially a document on its own. Having a new document means that if an id is set inside the shadow DOM, it only has to be unique inside that custom element.</p>
<blockquote>
<p>Web Components are forced to use ARIA to declare their default semantics. — <a target="_blank" href="https://wicg.github.io/aom/explainer.html">wicg.github.io</a></p>
</blockquote>
<p>Hopefully, you know that by using correct <a target="_blank" href="https://javascript.plainenglish.io/stop-using-divs-for-buttons-87a0b3d7945e">semantic elements</a>, you directly provide built-in accessibility features for elements like <strong>buttons</strong> or <strong>forms</strong>. Unfortunately, when creating custom elements we have to add all those properties ourselves to provide the same accessibility features. Ideally, custom elements should have default implicit semantics just like native elements. Luckily, there is the <a target="_blank" href="https://wicg.github.io/aom/explainer.html"><strong>Accessibility Object Model (AOM)</strong></a> proposal, that aims to include this using <code>ElementInternals</code>.</p>
<blockquote>
<p>The <strong>Accessibility Object Model</strong> project aims to improve certain aspects of the user and developer experiences concerning the interaction between web pages and assistive technology. — <a target="_blank" href="https://wicg.github.io/aom/spec/">wicg.github.io</a></p>
</blockquote>
<p>Currently, we are forced to use so-called <strong>ARIA attributes</strong> within our Web Components to express semantics which is implicit for native elements. For example, if we use the <code>selected</code> attribute on an element like this:</p>
<p><code>&lt;custom-option selected&gt;&lt;/custom-option&gt;</code></p>
<p>We would also need to add an <strong>ARIA</strong> <strong>attribute</strong> to it, to provide built-in accessibility features:</p>
<p><code>&lt;custom-option selected aria-selected="true"&gt;&lt;/custom-option&gt;</code></p>
<p>The <strong>AOM</strong> now suggests using <code>ElementInternals</code> to set the default semantics to avoid the need for additional attributes, and also avoid losing its semantics if developers forget to add <strong>ARIA attributes</strong>.</p>
<p>Using <code>ElementInternals</code> would look like this:</p>
<pre><code class="lang-plaintext">class CustomOption extends HTMLElement {
  constructor() {
    super();
    this._internals = customElements.createInternals(this);
  }
  // ...
}
</code></pre>
<p>After all, we can say that providing accessibility for our Web Components is possible. But, at the moment it is still connected to some extra effort.</p>
<h3 id="heading-what-does-the-future-hold">What does the future hold?</h3>
<p>The fact that all modern frontend frameworks count on Web Components shows that their creators are planning with them in the long run. But, as we saw, at the moment, working with Web Components is still connected to some non-trivial problems. That's why most companies that have decided to go the Web Components route use libraries to make their lives easier. For example, Github is using <a target="_blank" href="https://github.com/github/catalyst"><strong>Catalyst</strong></a>. Personally, I like to work with the <a target="_blank" href="https://medium.com/@mariusbongarts/build-your-own-blog-portfolio-with-web-components-lit-library-2701dffc735f"><strong>Lit</strong></a> library from which Catalyst took its inspiration.</p>
<blockquote>
<p>Catalyst, our open source library that makes it easier to write web components — <a target="_blank" href="https://github.blog/2021-05-04-how-we-use-web-components-at-github/">github.blog</a></p>
</blockquote>
<p>Not only Github hit the Web Component way. Many more companies like <strong>Youtube</strong>, <strong>SAP</strong>, <strong>Salesforce,</strong> and many more have realized that combining Web Components with their current frontend architecture is a great way to encapsulate parts of their application.</p>
<blockquote>
<p>YouTube is being rebuilt with Web Components -<a target="_blank" href="https://react-etc.net/entry/youtube-is-being-rebuilt-on-web-components-and-polymer">react-etc.net</a></p>
</blockquote>
<p>Having such big companies count on Web Components supports my personal opinion that there is no future without <strong>Web Components</strong>. But, there is also no near future without <strong>frontend frameworks</strong>. The goal of Web Components was never to replace them but to enhance them.</p>
<p><strong>There is no need to hate Web Components.</strong></p>
<h3 id="heading-final-thoughts">Final Thoughts</h3>
<p>Conclusively, it is beneficial for every developer to have at least heard of Web Components and, at best, even know how to work with them. Existing proposals will hopefully solve many problems of Web Components. We can avoid them using libraries like Lit, Stencil, or Catalyst. The realization that all modern frontend frameworks and many big companies count on Web Components clearly shows that <strong>Web Components are not dead</strong>.</p>
<p>Thanks for reading!</p>
<p>Want to learn more about how I scaled my Chrome Extension to almost 100,000 users as a solopreneur? Subscribe to my stories or follow me on LinkedIn and Twitter.</p>
<p>If you read a lot online, make sure to check out my Chrome Extension loved by 90,000+ active user — it’s free:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://web-highlights.com">https://web-highlights.com</a></div>
]]></content:encoded></item><item><title><![CDATA[How to Compete with Google, Apple, Microsoft, and Co.]]></title><description><![CDATA[Note: This article was originally published on June 13th, 2022 on Medium, and I'm now sharing it on this blog. Although things have evolved since I wrote it, I've decided to keep it unchanged to highlight my personal journey.

In today’s world, big g...]]></description><link>https://blog.marius-bongarts.de/how-to-compete-with-google-apple-microsoft-and-co</link><guid isPermaLink="true">https://blog.marius-bongarts.de/how-to-compete-with-google-apple-microsoft-and-co</guid><category><![CDATA[solopreneur ]]></category><category><![CDATA[buildinpublic]]></category><category><![CDATA[Entrepreneurship]]></category><category><![CDATA[SaaS]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Marius Bongarts]]></dc:creator><pubDate>Sun, 12 Jun 2022 22:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1712921108334/ad340fd4-0db4-4ffe-9448-bf440d920476.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p><strong><em>Note: This article was originally published on June 13th, 2022 on</em></strong> <a target="_blank" href="https://medium.com/@mariusbongarts/my-journey-to-the-first-9-99-with-my-side-project-3edc13dd1f2d"><strong><em>Medium</em></strong></a><strong><em>,</em></strong> and I'm now sharing it on this blog. Although things have evolved since I wrote it, I've decided to keep it unchanged to highlight my personal journey.</p>
</blockquote>
<p>In today’s world, big giants like Google, Apple, Microsoft, and Co. dictate the quality standards for software. People get used to those standards and expect this excellent user experience from every software.</p>
<p>Most users can not imagine how challenging it is to build such great products. Inevitably, they will compare every software to the ones they use every day.</p>
<p>Those extraordinary demands can be challenging for small companies and developers. Competing with companies hiring the best developers in the world is not easy. Imagine you are a startup building new music or video streaming service. Your software needs to be competitive against Spotify, Netflix, and Co. to convince people of your product.</p>
<p>But, developing such a user experience is nearly impossible for small startups. However, you can do something that big competitors can’t — <strong>Doing things that don’t scale.</strong></p>
<h3 id="heading-doing-things-that-dont-scale">Doing Things That Don’t Scale</h3>
<p>What does that mean? Just as users are used to exceptional products with a good user interface, they enjoy a rather average customer service. Their standards for customer service have been set by companies they’ve been customers of, which are mostly big ones. Providing customer service that makes every user feel unique and astonished is impossible when having billions of users. That’s one advantage of being small: <strong>you can provide a level of service no big company can.</strong></p>
<blockquote>
<p>Tim Cook doesn’t send you a hand-written note after you buy a laptop. He can’t. But you can. — <a target="_blank" href="http://paulgraham.com/ds.html?viewfullsite=1">Paul Graham</a></p>
</blockquote>
<p>When you are small, you can take extraordinary measures not just to acquire users but also to make them happy. You can give free rein to your ideas. Once you realize that existing conventions are not the upper bound on user experience, it’s interesting in a very pleasant way to think about how far you could go to delight your users. One example is Wufoo. They sent each new user a hand-written thank you note.</p>
<blockquote>
<p>Your first users should feel that signing up with you was one of the best choices they ever made. — <a target="_blank" href="http://paulgraham.com/ds.html?viewfullsite=1">Paul Graham</a></p>
</blockquote>
<p>If you’re a developer with a personal project like me, you’re the perfect fit to apply the principle. By building an excellent relationship with your users, you will be forgiven for many bugs in your application. For example, a user gave me a 1-star review in the Chrome Web Store for my <a target="_blank" href="https://chrome.google.com/webstore/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Web Highlights Chrome extension</a> because of a bug. I quickly responded to him and offered to fix the bug as soon as possible. Luckily, I was able to fix the bug on the same day. What happened? The user changed his review to a 5-star review:</p>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/hldjnlbobkdkghfidgoecgmklcemanhm"><img src="https://cdn-images-1.medium.com/max/1600/0*YIuzRByGWBN_qghJ.png" alt /></a></p>
<p>Doing things that don’t scale can help in many areas of product development — for example, marketing. A fascinating story is Pinterest. They used to go to Apple stores in their early days and set all the browsers to the Pinterest homepage. They are probably not doing it anymore, but they were successful with it.</p>
<p>Airbnb rented a $ 5.000 camera and went door to door, taking professional pictures of as many New York listings as possible.</p>
<p>There are several stories of companies doing things that don’t scale to acquire their first customers. Get inspired by reading more stories on <a target="_blank" href="https://www.dothingsthatdontscale.com/">dothingsthatdontscale.com</a> and set your product uniquely apart from competitors.</p>
<h3 id="heading-final-thoughts">Final Thoughts</h3>
<p>Being competitive against big software giants is hard. Building high-quality software that is better in terms of quality seems almost impossible. Therefore, we need to make our product unique in a different way. Doing things that don’t scale enables us to do many things that big companies can’t. For example, we can focus on excellent customer service to make every single customer feel unique.</p>
<p>And, who knows? Maybe, if you choose to make your existing users super happy, one day, you will have too many to do so much for. That would be a great problem to have. See if you can make it happen!</p>
<p>I hope you enjoyed reading this article. I am always happy to answer questions, and I am open to criticism. Feel free to contact me at any time 😊</p>
<p>Follow me not to miss my next articles. I write about Typescript, Web Components, Frontend Frameworks, Software Design Patterns, Chrome Extensions, and many more topics! 🙏</p>
<p>Get in touch with me via <a target="_blank" href="https://www.linkedin.com/in/marius-bongarts-6b3638171/"><strong>LinkedIn</strong></a> or follow me on <a target="_blank" href="https://twitter.com/MariusBongarts"><strong>Twitter</strong></a>.</p>
]]></content:encoded></item><item><title><![CDATA[Rule of Three — Three Strikes And You Refactor]]></title><description><![CDATA[One of the most common misunderstandings in software development is the DRY principle — Don’t repeat yourself.
It usually sounds straightforward: The DRY principle states that duplication and repetition in code that exists in two places and repeats t...]]></description><link>https://blog.marius-bongarts.de/rule-of-three-three-strikes-and-you-refactor</link><guid isPermaLink="true">https://blog.marius-bongarts.de/rule-of-three-three-strikes-and-you-refactor</guid><category><![CDATA[Web Development]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[software development]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Marius Bongarts]]></dc:creator><pubDate>Sun, 01 May 2022 22:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/3_U-Y4_0qbg/upload/6f2c087e344cd649947810d0b181f87a.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>One of the most common misunderstandings in software development is the <strong>DRY principle — Don’t repeat yourself</strong>.</p>
<p>It usually sounds straightforward: <a target="_blank" href="https://medium.com/@mariusbongarts11/dry-your-wet-typescript-code-e3c777b3daf9">The DRY principle</a> states that duplication and repetition in code that exists in two places and repeats the same knowledge and business logic should be avoided. In reality, even experienced developers never realize the difference between code duplication and knowledge duplication.</p>
<p>Recognizing the difference between <strong>knowledge</strong> and <strong>accidental duplication</strong> is even hard for experienced developers because a domain understanding of the code is needed.</p>
<h3 id="heading-knowledge-duplication">Knowledge duplication</h3>
<blockquote>
<p><em>“Are we looking at syntax duplication or knowledge duplication?” — Anthony Sciamanna</em></p>
</blockquote>
<p>To spot knowledge duplication basically, two questions have to be answered affirmatively:</p>
<ol>
<li><p><strong><em>Does code exist that looks identical?</em></strong></p>
</li>
<li><p><strong><em>Does the code repeat the same knowledge and logic?</em></strong></p>
</li>
</ol>
<p>Answering the first questions is easy. Assuming you are using a regular expression to validate password strengths:</p>
<p>At some other part of the application, we initialize the same variable. Obviously, code exists that looks identical.</p>
<ol>
<li><em>It does exist code that looks identical ✅</em></li>
</ol>
<p><strong>But, does the code repeat the same knowledge and logic?</strong> This question is the harder one. If you are unsure, you can ask a replacement question: <em>Does changing one code block lead to changing the other?</em></p>
<blockquote>
<p><em>There is true duplication, in which every change to one instance necessitates the same change to every duplicate of that instance. — Robert C. Martin</em></p>
</blockquote>
<p><em>I</em> consciously chose an easy example here. Assuming the regular expression to validate passwords is used for the same application in the same context, we would need to change the code in two places if the logic changes. That means that our application repeats the same knowledge.</p>
<p><em>2. The code repeats the same knowledge and logic</em> ✅</p>
<p>As both conditions are applicable, we can confirm knowledge duplication in the code. We can go ahead and refactor our code by removing the duplicated code.</p>
<p>Maybe, you already realized that answering the second question is not always easy. We need to understand the underlying business logic of the application to avoid removing <strong>accidental duplication</strong>.</p>
<h3 id="heading-accidental-duplication"><strong>Accidental duplication</strong></h3>
<p>To understand accidental duplication, let’s have a look at some example code:</p>
<p>And again, let’s check our questions:</p>
<ol>
<li><p><strong><em>Does code exist that looks identical?</em></strong></p>
</li>
<li><p><strong><em>Does the code repeat the same knowledge and logic?</em></strong></p>
</li>
</ol>
<p>As well as the first example, this code contains some duplicated syntax. Both, the <code>ProductService</code> as well as the <code>FeedbackService</code> are repeating this code block:</p>
<p>We could easily outsource this block of code to the abstract superclass <code>CRUDService</code> . That would save us a few lines of duplicated code.</p>
<ol>
<li><em>It does exist code that looks identical ✅</em></li>
</ol>
<p>Now, what about the second question. Let`s start by asking the replacement question: <em>Does changing one code block lead to changing the other?</em></p>
<p>Presuming our business logic changes:</p>
<blockquote>
<p><strong><em>Feedback can now be created by every user while creating products still requires having the right permissions.</em></strong></p>
</blockquote>
<p>This would lead us to change the <code>FeedbackService</code> class but the <code>ProductService</code> class does not need to be changed. This means that we identified <strong>accidental duplication</strong> and we should not abstract our code.</p>
<p><em>2. The code does not repeat the same knowledge and logic</em> ❌</p>
<blockquote>
<p><em>“If two apparently duplicated sections of code evolve along different paths — if they change at different rates, and for different reasons — then they are not true duplicates” — Robert C. Martin</em></p>
</blockquote>
<p>Imagine having abstracted our code by cleaning up the duplicated code, and not only our two example classes are inheriting from our superclass but many more. We would have un-refactored our code because we cleaned up accidental duplication. This is much worse than having some duplicated code.</p>
<p>Theoretically, we should now be able to differentiate between essential and accidental duplication.</p>
<p><strong>But what if we are not sure?</strong></p>
<h3 id="heading-rule-of-three">Rule of Three</h3>
<blockquote>
<p><em>Three strikes and you refactor</em></p>
</blockquote>
<p>Spotting knowledge duplication isn’t easy, and cleaning up accidental duplication is far more harmful than duplicating code.</p>
<p>The Rule of Three 3️⃣ defines that when you spot some duplicated code and the first two cases aren’t enough to identify shared knowledge, <strong>wait for the third duplicate</strong> before you refactor.</p>
<blockquote>
<p><em>It’s really hard and feels terrible, but close your eyes and try it anyway. —</em> <a target="_blank" href="https://www.justinweiss.com/articles/i-dry-ed-up-my-code-and-now-its-hard-to-work-with-what-happened/"><em>Justin Weiss</em></a></p>
</blockquote>
<p>Martin Fowler defined the Rule of Three in his book <em>Refactoring: Improving the Design of Existing Code:</em></p>
<ul>
<li><p><em>The first time you do something, you just do it.</em></p>
</li>
<li><p><em>The second time you do something similar, you wince at the duplication, but you do the same anyway.</em></p>
</li>
<li><p><em>The third time you do something similar, you refactor.</em></p>
</li>
</ul>
<h3 id="heading-final-thoughts">Final Thoughts</h3>
<p>Duplicated code is one of the major reasons for technical debt and bugs in software. That`s why the DRY principle is one of the most valuable in software development. But, applying it correctly is even more critical.</p>
<p>Remember, whenever you spot dome duplicated code, ask yourself: <em>“Am I looking at</em> <strong><em>duplicated syntax</em></strong> <em>or</em> <strong><em>duplicated knowledge*</em></strong>?”.<em> And if you are not sure, apply the <em>*Rule of Three</em></em>.</p>
<hr />
<p>Thanks for reading!</p>
<p>Want to learn more about how I scaled my <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a> to almost 100,000 users as a solopreneur? <a target="_blank" href="https://medium.com/@mariusbongarts/subscribe">Subscribe to my stories</a> or follow me on <a target="_blank" href="https://www.linkedin.com/in/marius-bongarts-6b3638171/">LinkedIn</a> and <a target="_blank" href="https://twitter.com/MariusBongarts">Twitter</a>.</p>
<p>If you read a lot online, make sure to check out my <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a> loved by 90,000+ active user — it’s free:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://web-highlights.com/">https://web-highlights.com/</a></div>
]]></content:encoded></item><item><title><![CDATA[Publish Your Side Project, Now!]]></title><description><![CDATA[Outside of day-to-day jobs, most developers have projects on the side. Not so many however publish them.
Working on side-projects brings many benefits for developers. They are a great way to learn new technologies and enhance your current skills. But...]]></description><link>https://blog.marius-bongarts.de/publish-your-side-project-now</link><guid isPermaLink="true">https://blog.marius-bongarts.de/publish-your-side-project-now</guid><category><![CDATA[side project]]></category><category><![CDATA[Entrepreneurship]]></category><category><![CDATA[Startups]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[software development]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Marius Bongarts]]></dc:creator><pubDate>Wed, 27 Apr 2022 22:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/VZILDYoqn_U/upload/9036d3dc9712b2143a13c69096039826.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Outside of day-to-day jobs, most developers have projects on the side. Not so many however publish them.</p>
<p>Working on side-projects brings many benefits for developers. They are a great way to learn new technologies and enhance your current skills. But, most importantly, it is fun to develop a project from the ground up on an idea you came up with. You can unleash your full creativity. There are no constraints that you might have in your full-time job.</p>
<blockquote>
<p>For many developers, programming is a labor of love. — <a target="_blank" href="https://insights.stackoverflow.com/survey/2015#profile-sideprojects">StackOverflow</a></p>
</blockquote>
<p>According to the <a target="_blank" href="https://insights.stackoverflow.com/survey/2015#profile-sideprojects">StackOverflow Survey in 2015</a>, 91.7% of developers had active side projects. For me, that is astonishing. Unfortunately, the survey does not reveal how many of them ever made anything public. Without proving it empirically, I would say that only very few side projects are ever released.</p>
<blockquote>
<p>The average developer spends more than 7 hours per week coding on the side. — <a target="_blank" href="https://insights.stackoverflow.com/survey/2015#profile-sideprojects">StackOverflow</a></p>
</blockquote>
<p>In my opinion, that lies in the fact that many developers continue developing their side projects for years. They spent hours creating a product without ever publishing it. Why? Because despite dreaming about making money through their product, the real potential of launching a product nobody likes is far scarier than developing a product nobody’s heard of.</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*-vuzP4JAoPf9S6ZdHNR_Jg.jpeg" alt="Image source (commitstrip.com)" /></p>
<p>Of the several side-projects, I have started, I only published one — the <a target="_blank" href="https://chrome.google.com/webstore/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Web Highlights Chrome extension</a>. I remember very well when I first published the extension in the Chrome Web Store. Was I concerned that nobody likes the extension? Yes. Was I concerned that users would complain about bugs? Yes.</p>
<p>But more importantly, was I excited to publish my first side-project publicly in the Chrome Web Store? Yes, I was. So, what happened? <strong>Did I launch a product nobody likes?</strong></p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://blog.marius-bongarts.de/my-journey-to-the-first-999-with-my-side-project">https://blog.marius-bongarts.de/my-journey-to-the-first-999-with-my-side-project</a></div>
<p> </p>
<p>Let’s put it that way: It could have started better. After one month, I have had <strong>four</strong> users — Me, my brother, my mum, and a friend. Two months later, I have had <strong>eight</strong> users — Me, my brother, my mum, and five friends. My brother used to be (and still is) a “bug-hunter” and always sent me screenshots to fix stuff and my friends were more or less using it to do me a favor. But, I remember the day on March 12th, 2020 — The first unknown user signed up. I couldn’t be happier!</p>
<p>After a year, I was a proud developer of an extension with 123 active users. Meanwhile, there are 2906 active users. This is still not an overwhelming amount. But much more important to me is that many users love the application as much as I do.</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*xRs3o2Rp-usnQlEi1uHkcg.png" alt /></p>
<p>So ask yourself: What could happen? It might be that nobody will notice your product. Or maybe, users will not like your product and will get rid of it again. You might also receive negative reviews. So what?</p>
<blockquote>
<p><em>We can be truly successful only at something we’re willing to fail at. If we’re unwilling to fail, then we’re unwilling to succeed. — Mark Manson</em></p>
</blockquote>
<p>It would be best to establish a mindset where failure is not a bad thing. Actually, failure is necessary for growth. Let me emphasize that by quoting Mark Manson:</p>
<blockquote>
<p>If you think about a young child trying to learn to walk, that child will fall down and hurt itself hundreds of times. But at no point does that child ever stop and think, “Oh, I guess walking just isn’t for me. I’m not good at it.” Avoiding failure is something we learn at some later point in life.</p>
</blockquote>
<p>Projecting this to side projects means that even if your first side project is not a success. Maybe your second, third, or fifteenth is. Never give up and realize that at the end of all of your projects — whether successful or unsuccessful, paid or unpaid, finished or unfinished — you will always win: new experiences, new contacts, and new findings about yourself!</p>
<blockquote>
<p>I have not failed. I’ve just found 10,000 ways that won’t work. — Yevgeniy Brikman</p>
</blockquote>
<p>Another significant advantage of publishing your side project is the opportunity to show your work to others. When interviewing for development jobs, it’s not uncommon to be asked if you’ve completed any side projects. Having a <a target="_blank" href="https://github.com/MariusBongarts">GitHub profile</a> is also expected in many cases, and potential employers may ask to see your profile. I can say that having a running Chrome extension with several hundred users caused amazement during my job interviews as an entry-level employee.</p>
<h3 id="heading-final-thoughts">Final Thoughts</h3>
<p>Developers often take on side projects. However, it’s a common scenario that many of these side projects will sink into oblivion. Do you have a side project? Don’t be afraid to show it! I hope this article can finally motivate you to publish your side project. Launching your product is the very first step towards an exciting future.</p>
<p>If you are interested in the whole story of my Web Highlights side-project, you might want to read <a target="_blank" href="https://medium.com/@mariusbongarts11/my-journey-to-the-first-9-99-with-my-side-project-3edc13dd1f2d"><strong>My Journey to the First $ 9.99 with My Side Project</strong></a>.</p>
<p>I hope you enjoyed reading this article. I am always happy to answer questions, and I am open to criticism. Feel free to contact me at any time 😊</p>
<p>Get in touch with me via <a target="_blank" href="https://www.linkedin.com/in/marius-bongarts-6b3638171/"><strong>LinkedIn</strong></a> or follow me on <a target="_blank" href="https://twitter.com/MariusBongarts"><strong>Twitter</strong></a>. Also, check out my <a target="_blank" href="https://chrome.google.com/webstore/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">PDF &amp; Web Highlighter Chrome</a> extension if you haven’t.</p>
]]></content:encoded></item><item><title><![CDATA[My Journey to the First $ 9.99 with My Side Project]]></title><description><![CDATA[Note: This article was originally published on April 4th, 2022 on Medium, and I'm now sharing it on this blog. Although things have evolved since I wrote it, I've decided to keep it unchanged to highlight my personal journey.


When it comes to produ...]]></description><link>https://blog.marius-bongarts.de/my-journey-to-the-first-999-with-my-side-project</link><guid isPermaLink="true">https://blog.marius-bongarts.de/my-journey-to-the-first-999-with-my-side-project</guid><category><![CDATA[Programming Blogs]]></category><category><![CDATA[side project]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[chrome extension]]></category><category><![CDATA[Build In Public]]></category><category><![CDATA[passive income]]></category><dc:creator><![CDATA[Marius Bongarts]]></dc:creator><pubDate>Sun, 03 Apr 2022 22:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/SoT4-mZhyhE/upload/0203ce4fcbab94f9db4a4e54032e0adc.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p><strong><em>Note: This article was originally published on April 4th, 2022 on</em></strong> <a target="_blank" href="https://medium.com/@mariusbongarts/my-journey-to-the-first-9-99-with-my-side-project-3edc13dd1f2d"><strong><em>Medium</em></strong></a><strong><em>,</em></strong> and I'm now sharing it on this blog. Although things have evolved since I wrote it, I've decided to keep it unchanged to highlight my personal journey.</p>
</blockquote>
<hr />
<p>When it comes to product development, there is a simple rule that I always follow:</p>
<blockquote>
<p>Build something 100 people love, not something 1 million people kind of like. — Paul Graham</p>
</blockquote>
<p>With that in mind, I realized that I reached 1 % of that goal right after I launched the first version of my <a target="_blank" href="https://web-highlights.com/"><strong>Web Highlights</strong></a> Chrome Extension. I loved my extension. That is why I developed it. It gave me confidence that there must be people searching for the same practical extension. One that enables you to save text and bookmarks on the web more efficiently. Medium inspired me with its text-highlighter. I wanted to create one that works similarly but on every website.</p>
<h3 id="heading-just-do-it">Just Do It</h3>
<blockquote>
<p>If you’re not embarrassed by your first release, you’ve launched too late.— Yevgeniy Brikman</p>
</blockquote>
<p>The biggest hurdle to take is to <a target="_blank" href="https://javascript.plainenglish.io/publish-your-side-project-now-1e3bb170c079">launch your product</a>. The problem is that many developers continue developing their side projects for years. They spent hours creating a product without ever publishing it. Why? Because despite dreaming about making money through their product, the real potential of launching a product nobody likes is far scarier than developing a product nobody's heard of.</p>
<blockquote>
<p>We can be truly successful only at something we’re willing to fail at. If we’re unwilling to fail, then we’re unwilling to succeed. — Mark Manson</p>
</blockquote>
<p>So ask yourself: What could happen? It might be that nobody will notice your product. Or maybe, users will not like your product and get rid of it again. You might also receive negative reviews. So what?</p>
<blockquote>
<p>I have not failed. I’ve just found 10,000 ways that won’t work. — Yevgeniy Brikman</p>
</blockquote>
<p>I remember when I first launched my <a target="_blank" href="https://chrome.google.com/webstore/detail/web-highlights-%20-bookmark/hldjnlbobkdkghfidgoecgmklcemanhm">Web Highlights Chrome Extension</a> in November 2019. After one month, I have had <strong>four</strong> users - Me, my brother, my mum, and a friend. Two months later, I have had <strong>eight</strong> users - Me, my brother, my mum, and five friends. My brother used to be (and still is) a "bug-hunter" and always sent me screenshots to fix stuff and my friends were more or less using it to do me a favor. But, I remember the day on March 12th, 2020 - The first unknown user signed up. I couldn't be happier!</p>
<p>After a year, I was a proud developer of an extension with 123 active users. Meanwhile, there are <strong>2703</strong> active users (Update from November 2022: <strong>6590</strong> active users). This is still not an overwhelming amount. But much more important to me is that many users love the application as much as I do.</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*xRs3o2Rp-usnQlEi1uHkcg.png" alt /></p>
<hr />
<h3 id="heading-do-things-that-dont-scale">Do Things That Don't Scale</h3>
<blockquote>
<p>Tim Cook doesn’t send you a hand-written note after you buy a laptop. He can’t. But you can. — Yevgeniy Brikman</p>
</blockquote>
<p>When you are small, you have one significant advantage: You can do things manually that don't scale but will be highly recognized by your users. One possible option is to focus on outstanding <strong>customer service</strong>. Mostly big companies have set our standards for customer service. You can stand out from these standards and make an extraordinary effort not just to acquire users but also to make them happy.</p>
<blockquote>
<p>Once you realize that existing conventions are not the upper bound on user experience, it’s interesting in a very pleasant way to think about how far you could go to delight your users. — <a target="_blank" href="http://paulgraham.com/ds.html?viewfullsite=1">Paul Graham</a></p>
</blockquote>
<p>With an excellent relationship with your users, you will be forgiven for many bugs in your application. For example, a user gave me a 1-star review in the <a target="_blank" href="https://chrome.google.com/webstore/detail/web-highlights-%20-bookmark/hldjnlbobkdkghfidgoecgmklcemanhm">Chrome Web Store</a> because of a bug. I quickly responded to him and offered to fix the bug as soon as possible. Luckily, I was able to fix the bug on the same day. What happened? The user changed his review to a 5-star review:</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*ylvj9eXcoMnXNqoOg9Xyfw.png" alt /></p>
<p>Doing things that don't scale can help in many areas of product development — for example, marketing. A fascinating story is Pinterest. They used to go to Apple stores in their early days and set all the browsers to the Pinterest homepage. They are probably not doing it anymore, but they were successful with it. Airbnb rented a $ 5.000 camera and went door to door, taking professional pictures of as many New York listings as possible. And, Wufoo sent each new user a hand-written thank you note.</p>
<p>There are several stories of companies doing things that don't scale to acquire their first customers. Get inspired by reading more stories on <a target="_blank" href="https://www.dothingsthatdontscale.com/">dothingsthatdontscale.com</a> and set your product uniquely apart from competitors.</p>
<hr />
<h3 id="heading-validate-your-product-design">Validate Your Product Design</h3>
<blockquote>
<p>A user interface is like a joke. If you have to explain it, it’s not that good. — Yevgeniy Brikman</p>
</blockquote>
<p>Unfortunately, when you are a programmer, you know so much about your software that you think of it completely different from the users. We often can not remember what it was like not to know every detail of the program — this is called the <strong>curse of knowledge</strong>.</p>
<blockquote>
<p>[…] the <strong>curse of knowledge</strong>, a cognitive effect beautifully demonstrated by a Stanford study: When a tapper taps, she is hearing the song in her head. Go ahead and try it for yourself — tap out “The Star-Spangled Banner.” It’s impossible to avoid hearing the tune in your head. Meanwhile, the listeners can’t hear that tune — all they can hear is a bunch of disconnected taps, like a kind of bizarre Morse Code. — Yevgeniy Brikman</p>
</blockquote>
<p>So, how can we validate our product design? The easiest way is to let others use your product without explaining anything. Ask your mother, father, or, even better, grandma to use your product. It is crucial to only observe without helping. Your product design should be fine if they can navigate your application successfully.</p>
<blockquote>
<p>The number-one goal of all computer users is to not feel stupid. — Yevgeniy Brikman</p>
</blockquote>
<p>Over time, I realized that my extension was sometimes terrible regarding product design. The only problem: I was not aware of it.</p>
<p>My extension offers to create folders and subfolders. You can create subfolders by dragging a folder onto another folder and deleting folders by dragging them onto a bin icon. At some point, I realized that many users didn't get that.</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*PcRHF18WoMBWCbYEjTjDTQ.png" alt /></p>
<p>To realize those problems earlier, getting as much feedback as possible from your users is necessary. Make sure that users can contact you quickly by revealing any contact channel. That might be a contact email address or even a live chat functionality on your website.</p>
<p>I took action and added a simple Google Forms page, which opens every time a user uninstalls the extension. That enables me to reveal the problems and wishes of users earlier. Furthermore, I implemented a guided tutorial that navigates through most of the functionality for freshly signed-up users to ensure all functionality is evident to everyone.</p>
<h3 id="heading-offer-one-time-payments">Offer One-Time Payments</h3>
<p>In 2021, I made users pay a one-time payment of $ 9.99 if they wanted to store more than 50 highlights. It was a tough decision, and I wondered if any user would spend money to use my extension. I consciously decided to offer a "pay once, use forever" payment option to decrease barriers to paying the amount. I think everyone hates abonnements, and I wanted to provide a fair price to use my extension forever.</p>
<p>In July 2021, I received the first payment. It is not that much, but it meant the world to me. I am still so so far from making a living from my extension. But, that is real passive income. Every single confirmation email of receiving $ 9.99 puts a smile on my face. And I am very excited about where the road is going in the following years.</p>
<h3 id="heading-talk-about-your-product">Talk About Your Product</h3>
<p>For me, talking about my product and making it public was, at the same time, one of the most important and also the most difficult. When I first launched the <a target="_blank" href="https://chrome.google.com/webstore/detail/web-highlights-%20-bookmark/hldjnlbobkdkghfidgoecgmklcemanhm">Web Highlights Chrome Extension</a> in the Chrome Web Store, I couldn't be sure if people would like the extension as much as I do. I asked a few friends if they could test the extension, but I had the feeling they were not wholly convinced of it. Afterward, I know that that's because they were not actively looking for an extension that enables you to highlight the web.</p>
<p>Any product or application exists to solve a specific problem. Users who love my extension were looking for a solution to organize their web research efficiently. My extension solves their problem.</p>
<p>Still, you should never be shy about your product. Talk about it whenever and wherever possible. Actually, that is why I started writing articles on Medium. Here is my very first Medium article:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://medium.com/@mariusbongarts11/how-to-build-the-medium-text-highlighter-as-a-chrome-extension-with-web-components-b3feccddcd01">https://medium.com/@mariusbongarts11/how-to-build-the-medium-text-highlighter-as-a-chrome-extension-with-web-components-b3feccddcd01</a></div>
<p> </p>
<p>Frankly speaking, I am writing this article right now to get more users to love my extension. But, I hope everyone else is also getting some value out of it and can apply my learnings. Eventually, I realized that writing technical articles is something I like. If someone had told me two years ago that I am writing blog articles on Medium, I would have thought they were crazy. So why don't you try it as well?</p>
<p>Start blogging about your application, talk to colleagues, and ask for opinions. <strong>Don't be shy</strong>.</p>
<h3 id="heading-final-thoughts">Final Thoughts</h3>
<p>I hope my side-project journey to the first $ 9.99 can finally motivate you to <a target="_blank" href="https://javascript.plainenglish.io/publish-your-side-project-now-1e3bb170c079">publish your side project</a>. Launching your product is the very first step towards an exciting future. Remember that you can only succeed if you are willing to fail. So, don't worry too much. <strong><em>After all, it's only a side project.</em></strong> Take advantage of being small and do things that don't scale. That will differentiate you from big competitors. Validate your product design to ensure users understand all of your functionality. And finally, don't be shy. Talk and write publicly about your product. That will give more people the benefit of enjoying your product.</p>
<p>I hope you enjoyed reading this article. I am always happy to answer questions, and I am open to criticism. Feel free to contact me at any time 😊</p>
<p>Follow me not to miss my next articles. I write about Typescript, Web Components, Frontend Frameworks, Software Design Patterns, Chrome Extensions, and many more topics! 🙏</p>
<p>Get in touch with me via <a target="_blank" href="https://www.linkedin.com/in/marius-bongarts-6b3638171/"><strong>LinkedIn</strong></a> or follow me on <a target="_blank" href="https://twitter.com/MariusBongarts"><strong>Twitter</strong></a>.</p>
]]></content:encoded></item><item><title><![CDATA[Will Web Components Replace Frontend Frameworks?]]></title><description><![CDATA[“Any headline that ends in a question mark can be answered by the word no.” — Ian Betteridge

Betteridge's law of headlines describes most likely your response to the offensive headline of this article. I never understood the ongoing war between Web ...]]></description><link>https://blog.marius-bongarts.de/will-web-components-replace-frontend-frameworks</link><guid isPermaLink="true">https://blog.marius-bongarts.de/will-web-components-replace-frontend-frameworks</guid><category><![CDATA[Web Development]]></category><category><![CDATA[software development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[Web Components]]></category><dc:creator><![CDATA[Marius Bongarts]]></dc:creator><pubDate>Sun, 10 Oct 2021 22:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1713710542108/2b9181cb-4570-487c-b448-65bc73ec11a5.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>“Any headline that ends in a question mark can be answered by the word no.” — Ian Betteridge</p>
</blockquote>
<p><a target="_blank" href="https://en.wikipedia.org/wiki/Betteridge%27s_law_of_headlines">Betteridge's law of headlines</a> describes most likely your response to the offensive headline of this article. I never understood the ongoing war between Web Components and JavaScript frameworks like Angular, React, VueJs, etc. Yet, combining the two could make the world of frontend development so much easier and more efficient.</p>
<p><strong><em>Disclaimer:</em></strong> <em>I know React is a library and not a framework, but for the purposes of this post I will refer to it as a framework.</em></p>
<hr />
<p>It seems that many developers feel threatened by the thought of Web Components wiping out frontend frameworks. That won't happen because they are built to solve different problems.</p>
<blockquote>
<p>“Most people who use React don’t use Web Components, but you may want to […].” — <a target="_blank" href="https://reactjs.org/docs/web-components.html">https://reactjs.org</a></p>
</blockquote>
<p>It is a shame that Web Components are still going so unnoticed these days. In this article, I will tell you when you should use them and why they will play a <strong>significant role</strong> in the future of frontend web development.</p>
<h3 id="heading-what-are-web-components">What are Web Components?</h3>
<p>Web Components are reusable client-side components based on official web standards and supported by all major browsers. They are an excellent way of <strong>encapsulating</strong> functionality from the rest of our code. Not only that, but you can <strong>reuse</strong> them in every web application and web page.</p>
<p>Web Components enable us to develop entirely independently of frontend frameworks.</p>
<blockquote>
<p>The primary benefit of Web Components is that we can use them everywhere. With any framework, or even without a framework. — <a target="_blank" href="https://v3.vuejs.org/guide/web-components.html">vuejs.org</a></p>
</blockquote>
<h4 id="heading-how-do-they-work">How do they work?</h4>
<p>Here's an example of how an <strong>autonomous web component</strong> can be defined:</p>
<pre><code class="lang-javascript"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyWebComponent</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">HTMLElement</span> </span>{...}
</code></pre>
<pre><code class="lang-javascript"><span class="hljs-built_in">window</span>.customElements.define(<span class="hljs-string">'my-web-component'</span>, MyWebComponent);
</code></pre>
<p>You can pass your element to any HTML page like this:</p>
<p><code>&lt;my-web-component value="something"&gt;&lt;/my-web-component&gt;</code></p>
<p>For more details on web components, check out this series of articles:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://javascript.plainenglish.io/showcase-your-medium-articles-with-web-components-part-1-basics-d2c6618e9482">https://javascript.plainenglish.io/showcase-your-medium-articles-with-web-components-part-1-basics-d2c6618e9482</a></div>
<p> </p>
<h3 id="heading-when-should-you-use-web-components">When should you use Web Components?</h3>
<p>Imagine a company that has developed a highly complex web application using React. Several hundred developers are working on it full-time. They created their own internal React component library to have a robust set of ready-made UI components such as buttons, inputs, dialogs, and so on. That helps to <a target="_blank" href="https://javascript.plainenglish.io/dry-your-wet-typescript-code-e3c777b3daf9">minimize code duplication</a> within the system, which is great!</p>
<p>As we all know, the software industry is one of the fastest-growing and changing industries. This is accompanied by many changes and innovations in Software Engineering. Assuming, next year, someone will release the ultimate frontend framework, which will overshadow any existing one.</p>
<p>More and more developers are adopting the new framework. Over the years, companies will use the framework for new projects, and some will migrate existing ones. React wouldn't be efficient anymore, and finding good React developers is getting more complicated and expensive.</p>
<blockquote>
<p><strong>Vendor lock-in</strong> refers to a situation where the cost of switching to a different vendor is so high that one is essentially stuck with the original vendor.</p>
</blockquote>
<p>The company in our example would be <strong>"locked-in"</strong> to the inferior frontend library React. Switching to the new framework would be very expensive and may interrupt business operations. Every single frontend component of the application would have to be migrated to the new framework.</p>
<blockquote>
<p>“Vendor lock-in is when someone is essentially forced to continue using a product or service regardless of quality” — <a target="_blank" href="https://www.cloudflare.com/learning/cloud/what-is-vendor-lock-in">cloudflare.com</a></p>
</blockquote>
<hr />
<p><strong>What could the company have done to reduce the costs of vendor-lock-in initially?</strong></p>
<p>The use of <strong>standards</strong> makes systems more tolerant to change. As you probably have suspected: The company could have created <strong>Web Components</strong> for their UI components. Even React itself is suggesting the use of Web Components in their official documentation:</p>
<blockquote>
<p>Most people who use React don’t use Web Components, but you may want to, especially if you are using third-party <strong>UI components that are written using Web Components</strong>. — <a target="_blank" href="https://reactjs.org/docs/web-components.html">https://reactjs.org</a></p>
</blockquote>
<p>While Web Components provide strong encapsulation for reusable elements that must be shared across multiple projects, React provides a declarative library that keeps the DOM in sync with your data. The two goals are complementary.</p>
<blockquote>
<p>“As a developer, you are free to use React in your Web Components, or to use Web Components in React, or both.” — <a target="_blank" href="https://reactjs.org/docs/web-components.html">reactjs.org</a></p>
</blockquote>
<p><strong>You just don't need React to create a reusable button!</strong> Meaning, whenever you plan to have multiple projects with different technology stacks in which you need to share components, go ahead and build Web Components.</p>
<h3 id="heading-why-should-you-learn-web-components">Why should you learn Web Components?</h3>
<p>Escaping vendor-lock-in is one of many reasons why you should learn and use Web Components. Here are a few more reasons why you should definitely have a look at Web Components:</p>
<h4 id="heading-web-components-are-widely-used">Web Components are widely used.</h4>
<p>The chart below shows the percentage of page loads (in Chrome) that calls <code>customElements.define</code> at least once.</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*Uy7W_TELvQtahfRDTRr2Gg.png" alt="Percentage of page loads (in Chrome) that use CustomElementRegistryDefine (Source: chromestatus.com)" /></p>
<p>You can see that more than <strong>15 %</strong> of all websites, viewed in a Chrome browser, register at least one <a target="_blank" href="https://medium.com/@mariusbongarts11/the-complete-web-component-guide-part-1-custom-elements-a627af805df8"><strong>Custom Element</strong></a>. Compared to that and according to <a target="_blank" href="https://w3techs.com/technologies/comparison/js-angularjs,js-react">w3techs.com</a> only <strong>2.3 %</strong> of all websites use React.</p>
<h4 id="heading-frontend-frameworks-support-web-components">Frontend frameworks support Web Components.</h4>
<p>Earlier in the article, we already figured out that React supports creating encapsulated and reusable Web Components. Not only React but also Angular and VueJS are supporting this idea.</p>
<p>Let's have a look at Angular. Angular provides the <code>@angular/elements</code> package which enables developers to transform a component into a Web Component quickly.</p>
<blockquote>
<p><em>“Angular elements</em> are Angular components packaged as <em>custom elements […]</em> “— <a target="_blank" href="https://angular.io/guide/elements">angular.io</a></p>
</blockquote>
<p>And also, VueJS is supporting Web Components via the <code>defineCustomElement</code> method.</p>
<blockquote>
<p>“Vue supports creating custom elements using exactly the same Vue component APIs […] ” — <a target="_blank" href="https://v3.vuejs.org/guide/web-components.html#passing-dom-properties">vuejs.org</a></p>
</blockquote>
<h4 id="heading-you-understand-what-is-going-on-under-the-hook">You understand what is going on under the hook.</h4>
<p>As we already know, many modern frontend frameworks support the idea of Web Components. Some of them, especially VueJS, are building on the foundation of web standards.</p>
<p>Knowing the three main technologies (<a target="_blank" href="https://javascript.plainenglish.io/the-complete-web-component-guide-part-1-custom-elements-a627af805df8"><strong>Custom Elements</strong></a>, <a target="_blank" href="https://medium.com/@mariusbongarts11/the-complete-web-component-guide-shadow-dom-2e40921eb77"><strong>Shadow DOM</strong></a>, and <a target="_blank" href="https://medium.com/@mariusbongarts11/the-complete-web-component-guide-html-templates-a957f1ee43fc"><strong>HTML Templates</strong></a>) of Web Components will help you understand how your JavaScript framework does all the magic.</p>
<p>If you have worked with VueJS you are probably familiar with the <code>scoped</code> attribute which you can pass to a style element.</p>
<pre><code class="lang-plaintext">&lt;style scoped&gt;
/* local styles */
&lt;/style&gt;
</code></pre>
<p>The <code>scoped</code> attribute will make styles of a VueJS component only apply to elements of the current component only. If you are familiar with the three main technologies of Web Components, you probably already know which technology VueJS uses here — the <a target="_blank" href="https://medium.com/@mariusbongarts11/the-complete-web-component-guide-shadow-dom-2e40921eb77"><strong>Shadow DOM</strong></a>.</p>
<blockquote>
<p>“This is similar to the style encapsulation found in Shadow DOM.” — <a target="_blank" href="https://vue-loader.vuejs.org/guide/scoped-css.html#mixing-local-and-global-styles">vuejs.org</a></p>
</blockquote>
<p>Shadow Trees enable us to keep the markup and style of components separate from other code on the page to prevent mixing up the styling of different parts of the website. Check out this article to learn more about <strong>Shadow DOM</strong>:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://medium.com/@mariusbongarts/the-complete-web-component-guide-shadow-dom-2e40921eb77">https://medium.com/@mariusbongarts/the-complete-web-component-guide-shadow-dom-2e40921eb77</a></div>
<p> </p>
<h4 id="heading-it-makes-learning-new-frontend-frameworks-easy">It makes learning new frontend frameworks easy.</h4>
<p>Many people say that if you master one programming language, it is easy to learn any other. The same applies to frontend frameworks.</p>
<p>During university, I have had the pleasure of learning the fundamentals of Web Components. Before that, I mainly worked with Angular. Today, I have worked with all three big frameworks — React, VueJS, and Angular.</p>
<p>The last one I had to learn was React. Due to my experience with Web Components and the two other frameworks, it was effortless for me to get started with React. In the end, it is always the same with a different syntax: You create components. You need to pass data up or down the DOM tree. You need to render some data.</p>
<h4 id="heading-networking-effect">Networking effect</h4>
<p>Chances are high that you have used some kind of Material Design Framework. There is Angular Material for Angular, Vuetify for VueJs, and Material UI for React. And of course, there are plenty more. One might be a little bit better than the other. Still, each of them provides mainly the same reusable UI components like buttons, inputs, dialogs, etc. The implementation is always done with the corresponding framework.</p>
<p>Wouldn't it be nice we could all share our web components in a single unified web? We could pick the best UI components without caring about frameworks. That would make us independent from JavaScript frameworks. Using Web Components would heavily reduce the costs of changing between them.</p>
<p>There are already a few Web Component libraries maintained by companies like e.g., Google and SAP:</p>
<ul>
<li><p><a target="_blank" href="https://github.com/material-components/material-web"><strong>Material Web Components (MWC):</strong></a> Collection of Web Components following Google's Material Design principles.</p>
</li>
<li><p><a target="_blank" href="https://github.com/PolymerElements?page=3"><strong>Polymer Elements:</strong></a> Google's Polymer library lets you build encapsulated, reusable Web Components that work like standard HTML elements</p>
</li>
<li><p><a target="_blank" href="https://github.com/vaadin/vaadin"><strong>Vaadin Web Components:</strong></a> Vaadin components is an evolving set of high-quality user interface web components</p>
</li>
<li><p><a target="_blank" href="https://github.com/SAP/ui5-webcomponents"><strong>OpenUI5</strong></a><strong>:</strong> SAP's rich set of enterprise-grade reusable UI elements driven by a lightweight framework</p>
</li>
</ul>
<p>Unfortunately, I think those components are not as mature as for example React's Material UI. The more developers are contributing to this, the better it will get.</p>
<h4 id="heading-learning-web-components-is-easy">Learning Web Components is easy.</h4>
<p>Learning Web Components is easier than you might think. They consist of three main technologies:</p>
<ul>
<li><p><a target="_blank" href="https://javascript.plainenglish.io/the-complete-web-component-guide-part-1-custom-elements-a627af805df8"><strong>Custom elements</strong></a></p>
</li>
<li><p><a target="_blank" href="https://medium.com/@mariusbongarts11/the-complete-web-component-guide-html-templates-a957f1ee43fc"><strong>HTML templates</strong></a></p>
</li>
<li><p><a target="_blank" href="https://medium.com/@mariusbongarts11/the-complete-web-component-guide-shadow-dom-2e40921eb77"><strong>Shadow DOM</strong></a></p>
</li>
</ul>
<p>Get started by following this series of articles:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://javascript.plainenglish.io/the-complete-web-component-guide-part-1-custom-elements-a627af805df8">https://javascript.plainenglish.io/the-complete-web-component-guide-part-1-custom-elements-a627af805df8</a></div>
<p> </p>
<p>Assuming you are using a library like <a target="_blank" href="https://javascript.plainenglish.io/build-your-own-blog-portfolio-with-web-components-lit-library-2701dffc735f">Lit</a> or Stencil, development is not that different, let alone more complicated than using a modern JavaScript library. Have a look at this series of articles to build your own Medium Blog portfolio with Web Components.</p>
<p>It will start by using plain HTML, CSS, and JavaScript. After that, it will use the <a target="_blank" href="https://javascript.plainenglish.io/build-your-own-blog-portfolio-with-web-components-lit-library-2701dffc735f">Lit</a> library to make development easier.</p>
<h3 id="heading-final-thoughts">Final Thoughts</h3>
<p>Web Components will not replace frontend frameworks in the near future. Nevertheless, they can enhance those frameworks by replacing their component layer with a native and uniform solution.</p>
<hr />
<p>Thanks for reading!</p>
<p>Want to learn more about how I scaled my Chrome Extension to almost 100,000 users as a solopreneur? Subscribe to my stories or follow me on LinkedIn and Twitter.</p>
<p>If you read a lot online, make sure to check out my Chrome Extension loved by 90,000+ active user - it's free:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://web-highlights.com">https://web-highlights.com</a></div>
]]></content:encoded></item><item><title><![CDATA[When You SHOULD Duplicate Code]]></title><description><![CDATA[Recently I published the article Prevent Duplicated TypeScript Code. A good friend of mine approached me and said:

“Great article, I learned a lot!”

I was a little bit astonished because he is a way better developer than me. I asked:

“What exactly...]]></description><link>https://blog.marius-bongarts.de/when-you-should-duplicate-code</link><guid isPermaLink="true">https://blog.marius-bongarts.de/when-you-should-duplicate-code</guid><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[software development]]></category><category><![CDATA[design patterns]]></category><dc:creator><![CDATA[Marius Bongarts]]></dc:creator><pubDate>Tue, 05 Jan 2021 23:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/Na3ZV7aBT0U/upload/03e8b1db455c248fbe22e10f02e50e26.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Recently I published the article <a target="_blank" href="https://javascript.plainenglish.io/dry-your-wet-typescript-code-e3c777b3daf9">Prevent Duplicated TypeScript Code</a>. A good friend of mine approached me and said:</p>
<blockquote>
<p>“Great article, I learned a lot!”</p>
</blockquote>
<p>I was a little bit astonished because he is a way better developer than me. I asked:</p>
<blockquote>
<p>“What exactly did you learn?”</p>
</blockquote>
<p>He replied:</p>
<blockquote>
<p>“I never thought about the difference between code duplication and knowledge duplication. It was great that you focused on differentiating this.”</p>
</blockquote>
<p>He was talking about <strong>accidental duplication</strong>. Removing it will make your code harder to read and harder to change in the future.</p>
<blockquote>
<p><strong>Accidental duplication is code that looks similar but represents different logic.</strong></p>
</blockquote>
<p>The fact that my friend had the same perception as I had while writing the post made me write this article to explain with some examples how to identify the difference between <strong>essential duplication</strong> and <strong>accidental duplication.</strong></p>
<h3 id="heading-what-is-the-dry-principle-about">What is the DRY principle about?</h3>
<p>If you want to have a detailed introduction to the <strong>“Don’t repeat yourself” (DRY) principle</strong> I suggest reading my <a target="_blank" href="https://javascript.plainenglish.io/dry-your-wet-typescript-code-e3c777b3daf9">recent article</a> first. This article will only give a short introduction to the principle and focuses on the pitfalls of applying the DRY principle.</p>
<hr />
<p>The DRY principle states that duplication and repetition in code, that exists in two places and <strong>repeats the same knowledge and business logic</strong> should be avoided. The principle is credited to Andy Hunt and Dave Thomas and is stated in their book <a target="_blank" href="https://www.amazon.com/gp/product/0135957052/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0135957052&amp;linkCode=as2&amp;tag=webhighlights-20&amp;linkId=0bdbf88ce0a118807c4b3cc3edfb863f">The Pragmatic Programmer</a>:</p>
<blockquote>
<p><em>“Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.” —</em> Andy Hunt and Dave Thomas</p>
</blockquote>
<p>Notice that Andy Hunt and Dave Thomas are pointing out “every <strong>piece ofknowledge</strong>” and <strong>not</strong> “every <strong>piece of code</strong>”. Understanding the difference is essential to identify accidental duplication.</p>
<h3 id="heading-knowledge-duplication">Knowledge Duplication</h3>
<blockquote>
<p>“Are we looking at syntax duplication or knowledge duplication?” — Anthony Sciamanna</p>
</blockquote>
<p>To spot knowledge duplication basically, two questions have to be answered affirmatively:</p>
<ol>
<li><p><em>Does code exist that looks identical?</em></p>
</li>
<li><p><em>Does the code repeat the same knowledge and logic?</em></p>
</li>
</ol>
<hr />
<h4 id="heading-1-example-knowledge-duplication">#1 Example: Knowledge Duplication</h4>
<p>Let’s have a look at this example:</p>
<p>#1 Example: Knowledge Duplication</p>
<p>We have two <code>signUp</code> functions. One in the client and the other in our server. Let’s answer our questions:</p>
<h4 id="heading-1-does-code-exist-that-looks-identical">1. Does code exist that looks identical? ✅</h4>
<p>The alarm bells should ring here for every developer. It is obvious that both functions are sharing duplicated code.</p>
<h4 id="heading-2-does-the-code-repeat-the-same-knowledge-and-logic">2. Does the code repeat the same knowledge and logic? ✅</h4>
<p>This question is the harder one. If you are not sure you can ask a replacement question: <em>Does changing one code block lead to changing the other one?</em></p>
<blockquote>
<p>“There is true duplication, in which every change to one instance necessitates the same change to every duplicate of that instance.” — Robert C. Martin</p>
</blockquote>
<p><em>I</em> consciously chose an easy example here. Obviously, the validation of credentials is the same for the <code>signUp</code> function in the client as the one in the server. If we for example chose to increase the needed password length to 7 we would need to change it in two places. If we forgot to change it in one place, it would lead to a bug.</p>
<hr />
<p>Since both questions are affirmed, we can confirm that there is some knowledge duplication in the code. Let`s refactor our code by extracting our code into helper functions. Since the client and the server are living in different environments we have to <a target="_blank" href="https://javascript.plainenglish.io/share-code-between-react-client-and-express-server-5dc0977faa76">create a shared library</a>.</p>
<p><strong>#1 Example: Knowledge Duplication</strong></p>
<p>Notice that each function has only one responsibility to comply with the SOLID principles, in particular the <strong>Single Responsibility Principle</strong>.</p>
<blockquote>
<p>“The Single Responsibility Principle states that a given method/class/component should have a single reason to change” — Robert C. Martin in <a target="_blank" href="https://www.amazon.com/gp/product/0132350882/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0132350882&amp;linkCode=as2&amp;tag=webhighlights-20&amp;linkId=384bd36dd0f905173f14773389477972">Clean Code</a></p>
</blockquote>
<p>Looks much better and cleaner, right? Now we could change our credential validation in one single source of truth.</p>
<h3 id="heading-accidental-duplication">Accidental Duplication</h3>
<blockquote>
<p>Duplication is far cheaper than the wrong abstraction</p>
</blockquote>
<p>Recognizing the difference between knowledge duplication and accidental duplication is even hard for experienced developers because a domain understanding of the code is needed. That is also why <strong>static analysis tools</strong> are great to detect duplicated syntax but they can not tell (at least not yet) if it is also a <strong>duplication of knowledge</strong>.</p>
<hr />
<h4 id="heading-2-example-accidental-duplication">#2 Example: Accidental Duplication</h4>
<p>Let`s start with another example by looking at this code:</p>
<p>#2 Example: Accidental Duplication</p>
<p>And again, let’s check our questions:</p>
<h4 id="heading-1-does-code-exist-that-looks-identical-1">1. Does code exist that looks identical? ✅</h4>
<p>As well as the first example, this code contains some duplicated syntax. Both, the <code>ProductService</code> as well as the <code>FeedbackService</code> are duplicating this code block:</p>
<p>#2 Example: Accidental Duplication</p>
<p>We could easily outsource this block of code to the abstract superclass <code>CRUDService</code> . That would save us a few lines of duplicated code.</p>
<h4 id="heading-2-does-the-code-repeat-the-same-knowledge-and-logic-1">2. Does the code repeat the same knowledge and logic? ❌</h4>
<p>Let`s start by asking the replacement question: <em>Does changing one code block lead to changing the other one?</em></p>
<p>Presuming our business logic changes:</p>
<blockquote>
<p><em>Feedback can now be created by every user while creating products still requires having the right permissions.</em></p>
</blockquote>
<p>This would lead us to change the <code>FeedbackService</code> class but the <code>ProductService</code> class does not need to be changed. This means that we identified <strong>accidental duplication</strong> and we should not abstract our code.</p>
<blockquote>
<p>“If two apparently duplicated sections of code evolve along different paths — if they change at different rates, and for different reasons — then they are not true duplicates” — Robert C. Martin</p>
</blockquote>
<p>Imagine having abstracted our code by cleaning up the duplicated code and not only our two example classes are inheriting from our superclass but many more. We would have ended up un-refactoring our code because we cleaned up accidental duplication. This is much worse than having some duplicated code.</p>
<h3 id="heading-minimizing-accidental-duplication">Minimizing Accidental Duplication</h3>
<p>Often you just can’t entirely remove accidental duplication, but you can minimize it by complying with the SOLID principles and using good naming.</p>
<h4 id="heading-3-example-minimize-accidental-duplication">#3 Example: Minimize Accidental Duplication</h4>
<p>Let’s illustrate how to minimize accidental duplication by looking at this example:</p>
<p>#3 Example: Minimizing Accidental Duplication</p>
<h4 id="heading-1-does-code-exist-that-looks-identical-2">1. Does code exist that looks identical? ✅</h4>
<p>Obviously, the functions <code>toFileName</code> and <code>toFolderName</code> are both transforming a string to an underscore string. The code is exactly the same, therefore duplicated code exists.</p>
<h4 id="heading-2-does-the-code-repeat-the-same-knowledge-and-logic-2">2. Does the code repeat the same knowledge and logic? ❓</h4>
<p>To answer this question let`s go ahead and apply the DRY principle <strong>incorrectly.</strong></p>
<p>We have noticed that the functions <code>toFileName</code> and <code>toFolderName</code> are identical. The obvious solution would be to merge both functions into one <code>toFileOrFolderName</code> function. Now we can use it in our <code>saveFile</code> method:</p>
<p>#3 Example: Minimizing Accidental Duplication</p>
<hr />
<p><strong><em>Why is that wrong?</em></strong></p>
<p>Imagine it was decided that file names should now also have a timestamp in front of their name. A new developer in the project should implement this new requirement and is facing our <code>toFileOrFolderName</code> function. What I often see is a solution like this:</p>
<p>#3 Example: Minimizing Accidental Duplication</p>
<p>By eliminating our original functions we have caused our new function <code>toFileOrFolderName</code> to do more than one thing, that is violating the <strong>Single Responsibility Principle</strong>.</p>
<p>The fact that our original two functions do the same thing is an <strong>accident</strong>. One transforms file names and the other folder names. We don`t want the caller of <code>toFileName</code> to know anything about folder names and we don`t want the caller of <code>toFolderName</code> to know anything about file names.</p>
<hr />
<p><strong><em>How to minimize the duplication correctly?</em></strong></p>
<p>Let`s restore our initial <code>toFileName</code> and <code>toFolderName</code> functions and get rid of the low-level duplication by creating the function <code>toUnderscore</code> :</p>
<p>#3 Example: Minimizing Accidental Duplication</p>
<p>By following the <strong>Single Responsibility Principle</strong> each function maintains a single level of abstraction and has only one single reason to change.</p>
<p>Even though we didn`t eliminate the accidental duplication entirely we minimized it by getting rid of the low-level duplication of transforming a string to underscore.</p>
<hr />
<p>Theoretically, we should now be able to differentiate between essential and accidental duplication… <strong>But what if we are not sure?</strong></p>
<h3 id="heading-rule-of-three"><strong>Rule of Three</strong></h3>
<blockquote>
<p>“Three strikes and you refactor”</p>
</blockquote>
<p>Source: <a target="_blank" href="https://giphy.com/gifs/dallasmavs-YlkCKp0EttSa7jxg6y">https://giphy.com/gifs/dallasmavs-YlkCKp0EttSa7jxg6y</a></p>
<p>Spotting knowledge duplication isn’t easy and cleaning up accidental duplication is far more harmful than having duplicated code.</p>
<p>The Rule of Three 3️⃣ basically defines that when you spot some duplicated code and the first two cases aren’t enough to clearly identify shared knowledge, <strong>wait for the third duplicate</strong> before you refactor.</p>
<blockquote>
<p>“It’s really hard and feels terrible, but close your eyes and try it anyway.” — <a target="_blank" href="https://www.justinweiss.com/articles/i-dry-ed-up-my-code-and-now-its-hard-to-work-with-what-happened/">Justin Weiss</a></p>
</blockquote>
<p>Martin Fowler defined the Rule of Three in his book <a target="_blank" href="https://www.amazon.com/gp/product/0134757599/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0134757599&amp;linkCode=as2&amp;tag=webhighlights-20&amp;linkId=1382f4638ff19240dda8604060ae8809"><em>Refactoring: Improving the Design of Existing Code</em></a><em>:</em></p>
<ul>
<li><p><em>The first time you do something, you just do it.</em></p>
</li>
<li><p><em>The second time you do something similar, you wince at the duplication, but you do the duplicate thing anyway.</em></p>
</li>
<li><p><em>The third time you do something similar, you refactor.</em></p>
</li>
</ul>
<h3 id="heading-final-thoughts">Final Thoughts</h3>
<p>Duplicated code is one of the major reasons for technical debt and bugs in software. That`s why the DRY principle is one of the most valuable ones in software development. But, applying it correctly is even more important.</p>
<p>Remember, whenever you spot dome duplicated code ask yourself: <em>“Am I looking at<strong><strong>duplicated syntax</strong></strong>or<strong>**duplicated knowledge</strong></em>*?”.* And if you are not sure, apply the <strong>Rule of Three</strong>.</p>
<hr />
<p>Thanks for reading!</p>
<p>Want to learn more about how I scaled my <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a> to almost 100,000 users as a solopreneur? <a target="_blank" href="https://medium.com/@mariusbongarts/subscribe">Subscribe to my stories</a> or follow me on <a target="_blank" href="https://www.linkedin.com/in/marius-bongarts-6b3638171/">LinkedIn</a> and <a target="_blank" href="https://twitter.com/MariusBongarts">Twitter</a>.</p>
<p>If you read a lot online, make sure to check out my <a target="_blank" href="https://chromewebstore.google.com/detail/web-highlights-pdf-web-hi/hldjnlbobkdkghfidgoecgmklcemanhm">Chrome Extension</a> loved by 90,000+ active user — it’s free:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://web-highlights.com/">https://web-highlights.com/</a></div>
]]></content:encoded></item></channel></rss>