<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Keyvan M. Sadeghi</title>
    <description>The latest articles on DEV Community by Keyvan M. Sadeghi (@keyvan_m_sadeghi).</description>
    <link>https://dev.to/keyvan_m_sadeghi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F150657%2F72f4393b-bf7d-48bf-9ece-3d649e5ed55e.jpg</url>
      <title>DEV Community: Keyvan M. Sadeghi</title>
      <link>https://dev.to/keyvan_m_sadeghi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/keyvan_m_sadeghi"/>
    <language>en</language>
    <item>
      <title>Ditching .NET and finding faith again after 10 years!</title>
      <dc:creator>Keyvan M. Sadeghi</dc:creator>
      <pubDate>Tue, 13 Dec 2022 14:05:43 +0000</pubDate>
      <link>https://dev.to/fx/ditching-net-and-finding-faith-again-after-10-years-4d7b</link>
      <guid>https://dev.to/fx/ditching-net-and-finding-faith-again-after-10-years-4d7b</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; &lt;em&gt;.NET MAUI&lt;/em&gt; is a dope multiplatform stack and may well be the perfect candidate for your next app. Don’t dismiss it because it’s &lt;em&gt;“Made in Microsoft.”&lt;/em&gt; You can check out &lt;a href="https://github.com/functionland/fx-files"&gt;Fx Files&lt;/a&gt; as a testimonial to its interop with JS, and the general new .NET direction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My way or the highway!&lt;/strong&gt; That's the prevalent mantra in Big Tech. Even from the grave, Steve Jobs’s guideline of &lt;em&gt;“Be Incompatible!”&lt;/em&gt; is haunting us to this day — when we have a guest over and they can’t charge their phone with our cable! Worse yet, there’s always a &lt;strong&gt;“cult”&lt;/strong&gt; of followers, belittling others who don’t fall in line under the same banner, constantly pointing out tech flaws from the other side, and they are so susceptible to confirmation bias from their peers. The same toxic pattern can sometimes be found in developer circles too.&lt;/p&gt;

&lt;p&gt;Microsoft was no different under Steve Balmer (nor Gates). I should know because I was a die-hard &lt;em&gt;&lt;strong&gt;Microsheep&lt;/strong&gt;&lt;/em&gt; up until 2012 🙈. You had the &lt;em&gt;Microsoft Universe&lt;/em&gt; to drown in, and to be fair it was quite compelling! Don’t you pity those poor backwards fellas who have to open a terminal to do the simplest things? Need an IDE? Behold the mighty &lt;em&gt;Visual Studio&lt;/em&gt;! Need UI? Here you have &lt;em&gt;WPF&lt;/em&gt;, putting the frontier of UX dev at your fingertips! And it’s all drag and drop, with seamless codegen that you can witness live! Also bear in mind, &lt;em&gt;REAL&lt;/em&gt; software runs exclusively on Windows, do you know of a single enterprise app that’s elsewhere?&lt;/p&gt;

&lt;p&gt;Time would prove all wrong, but back then these arguments seemed sound.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Microsoft is a fear factory. Oh, your team is still not Agile? You have to use our software suite that gives MANAGEMENT measurable VISIBILITY on what happens in your org!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;During my studies, classmates were doing their homework in spaghetti C, while I swaggered by and showed off my shiny C# class diagram and glorious WinForms UI! I had a date with destiny though. The first job I landed was at a research lab in Hong Kong. Had a 2-week deadline to deliver a library written in Python, running on Linux, neither of which I’d ever touched! No longer did I have the luxury of being like “Pff, this weird shitty open-source stuff again!” The date was set and I needed to push my code into this other weird thing: GitHub. Thus began my journey. In the decade since, I delved deep into all that open-source stuff, convinced every employer to &lt;a href="https://www.npmjs.com/~keyvan-m-sadeghi"&gt;publish pieces of my work&lt;/a&gt; as open-source, ditched languages and frameworks left and right, and learned to be loyal to nothing if not innovation!&lt;/p&gt;

&lt;p&gt;Given this history, I was highly skeptical when my friend &lt;a href="https://dev.to/mehrandvd"&gt;mehrandvd&lt;/a&gt; pitched me .NET for development of our next app. We had, one might say, &lt;em&gt;unrealistic&lt;/em&gt; expectations: a &lt;strong&gt;File Manager&lt;/strong&gt; that runs on Android, iOS, Windows and macOS. It should handle local file operations like copy, rename, etc., as well as utilities like thumbnails, zip extraction and in-app file viewers. The same UI, we decided, should have another tab where you browse your &lt;em&gt;“remote files.”&lt;/em&gt; These could be on any cloud provider, AWS S3 and such, or weirder places like &lt;a href="https://ipfs.tech/"&gt;IPFS&lt;/a&gt;. I.e. being &lt;em&gt;“Backend Agnostic.”&lt;/em&gt; A developer implements an interface, submits the pull request, and the provider shows up as another configurable “source” for your files. We also wanted interoperability between one’s local and remote files, things like syncing a local folder on a remote provider.&lt;/p&gt;

&lt;p&gt;Craziest of all, we wanted all these developed in just 3 months!&lt;/p&gt;

&lt;p&gt;And I kid you not, Mehran and the team delivered! They even managed to squeeze in extra features like code highlighting! Here’s a peek:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/cdifshBgIcU"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Project on GitHub:&lt;br&gt;
&lt;a href="https://github.com/functionland/fx-files"&gt;https://github.com/functionland/fx-files&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here’s the app on Google Play and Microsoft Store:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://play.google.com/store/apps/details?id=land.fx.files"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xhDXMT-n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/functionland/fx-files/main/docs/images/badge-play-store.png" alt="Fx Files on Google Play" title="Fx Files on Google Play" width="564" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://apps.microsoft.com/store/detail/fx-files/9NXL9KB8FBQQ"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--riMdUmkR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://upload.wikimedia.org/wikipedia/commons/thumb/f/f7/Get_it_from_Microsoft_Badge.svg/1024px-Get_it_from_Microsoft_Badge.svg.png" alt="Fx Files on Microsoft Store" title="Fx Files on Microsoft Store" width="880" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(iOS, Mac and remote file integration in an upcoming update.)&lt;/p&gt;

&lt;p&gt;MAUI’s appeal is abstracting away capabilities of different platforms under the same API. For our use case, as an example, we needed to talk with four different file systems. MAUI offers these as a unified &lt;a href="https://docs.microsoft.com/en-us/dotnet/maui/platform-integration/#storage"&gt;Storage API&lt;/a&gt;. Also in edge cases that require you to write platform-specific code, e.g. performance optimization for infinity scroll, you have the freedom to do so.&lt;/p&gt;

&lt;p&gt;Another aspect that surprised me was the way Microsoft has started to play fair with others. MAUI code can work in tandem with other languages and frameworks in your stack. This was a hard requirement for us, since our IPFS integration is a polyglot of Go, Rust, JavaScript and other upstream 🐉s I’m not aware of. This is so unlike the Microsoft I knew! After all, they were once famous for their &lt;a href="https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguish"&gt;EEE strategy&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;A few more data points like MAUI and I may revert to Microsoft believer again! Pivoting the corporate culture at this scale is nothing short of astonishing. I salute Satya Nadella and everyone involved in this shift. Eager to see more!&lt;/p&gt;

&lt;p&gt;Your feedback is much appreciated as always. Hope to get acquainted with you in the comments section! ❤️&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>dotnet</category>
      <category>csharp</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Google Photos open-source alternative with React Native</title>
      <dc:creator>Keyvan M. Sadeghi</dc:creator>
      <pubDate>Thu, 03 Jun 2021 15:57:44 +0000</pubDate>
      <link>https://dev.to/fx/google-photos-open-source-alternative-with-react-native-80c</link>
      <guid>https://dev.to/fx/google-photos-open-source-alternative-with-react-native-80c</guid>
      <description>&lt;p&gt;Greetings fellow DEVs! You've probably heard the news about Google Photos becoming a paid service starting this month. We've been eying this date for a while and were preparing something that we think is kinda cool! Drumroll please... Photos UI partially implemented in React Native! Here's a peek:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Ffunctionland%2Fblog%2Fmain%2Fphotos-intro-dev-to%2Fphotos.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Ffunctionland%2Fblog%2Fmain%2Fphotos-intro-dev-to%2Fphotos.gif" title="Box Photos" alt="Box Photos"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This implementation is backend-agnostic, you can fork the repo and implement an interface to connect it to your own backend! We're also working on an open-source p2p backend implementation, more on this later in the article.&lt;/p&gt;

&lt;p&gt;If you like what you see, there are ways you can help us take it to the next level:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Star the repo &lt;a href="https://github.com/functionland/photos" rel="noopener noreferrer"&gt;on GitHub&lt;/a&gt;!&lt;/li&gt;
&lt;li&gt;Join &lt;a href="https://github.com/functionland/photos/discussions" rel="noopener noreferrer"&gt;the discussions&lt;/a&gt;,
tell us what you think about where it needs to go from here.&lt;/li&gt;
&lt;li&gt;Contribute code! Photos is currently being maintained only by
&lt;a href="https://github.com/ehsan6sha" rel="noopener noreferrer"&gt;Ehsan&lt;/a&gt;, he's eager to welcome new collaborators!&lt;/li&gt;
&lt;li&gt;We have lots of cool things planned, including a Kickstarter campaign! &lt;a href="https://groups.google.com/g/functionland" rel="noopener noreferrer"&gt;Join the mailing list&lt;/a&gt;
to hear about all updates!&lt;/li&gt;
&lt;li&gt;We're actively seeking funding, if you can help with this in any way, please &lt;a href="https://www.linkedin.com/in/keyvanmsadeghi/" rel="noopener noreferrer"&gt;drop us a message&lt;/a&gt;!&lt;/li&gt;
&lt;li&gt;You can also follow us on
&lt;a href="https://twitter.com/functionland" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;,
&lt;a href="https://t.me/functionland" rel="noopener noreferrer"&gt;Telegram&lt;/a&gt; and
&lt;a href="https://www.youtube.com/channel/UCAyjxikGGQTcJvjrhZyYhpA" rel="noopener noreferrer"&gt;YouTube&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is still at prototype stage and not ready for prime time, but we wanted to share early to hear your valuable feedback and hopefully have those of you who are interested join us to build a community around an ambitious yet noble goal:&lt;/p&gt;

&lt;h2&gt;
  
  
  Ending &lt;em&gt;Big Tech&lt;/em&gt;'s reign by building open-source &lt;strong&gt;p2p&lt;/strong&gt; apps!
&lt;/h2&gt;

&lt;p&gt;Making Photos paid? Really? Haven't Google already made billions by training AI models from our pictures and videos? Us &lt;a href="https://www.netflix.com/title/81254224" rel="noopener noreferrer"&gt;being the product&lt;/a&gt; was not enough, we should also pay now?&lt;/p&gt;

&lt;p&gt;I don't want to sound arrogant or ungrateful. Truth be told, I personally owe Big Tech a great deal! The very ability to write these words for example, I wouldn't know them if it wasn't for Windows (and me being a nerd)! And I was able to use Windows because a version of it existed that probably even Microsoft wasn't aware of: &lt;a href="https://www.shouldiremoveit.com/MRT-Windows-XP-Farsi-Interface-Pack-24170-program.aspx" rel="noopener noreferrer"&gt;MRT Windows&lt;/a&gt;! (MRT being the initials of the dude who created it)&lt;/p&gt;

&lt;p&gt;Being born into a country disconnected from the global economy, we didn't have legitimate access to software such as Windows, but &lt;em&gt;Mr. MRT&lt;/em&gt; had &lt;em&gt;BitTorrent&lt;/em&gt; and lots of blank CDs to cater us :) &lt;em&gt;p2p&lt;/em&gt; was the missing piece to the puzzle: although we had in effect &lt;em&gt;unwarranted access&lt;/em&gt; to Microsoft's &lt;em&gt;intellectual property&lt;/em&gt;, a whole generation of developers was raised thanks to (unlawful) democratized access to software. Instead of the stereotypic &lt;em&gt;Jihadists&lt;/em&gt; that the world expected, these people turned out quite civilized, some of them who moved abroad are now working for the Big Tech.&lt;/p&gt;

&lt;p&gt;A large population of US citizens, meanwhile, didn't (by enforced law) have free access to Windows. Those who ended up attacking the Capitol in January might've acted different had they been growing up with Windows as kids!&lt;/p&gt;

&lt;p&gt;Hopefully the above example conveys the importance of free access to software, free both as in speech and as in beer!&lt;/p&gt;

&lt;h3&gt;
  
  
  Does a workable solution for delivering and maintaining free software actually exist?
&lt;/h3&gt;

&lt;p&gt;Yes and no. There are architectural and operational issues. We can, however, arrive at a solution by refactoring to &lt;a href="https://medium.com/fabric-ventures/what-is-web-3-0-why-it-matters-934eb07f3d2b" rel="noopener noreferrer"&gt;&lt;em&gt;Web 3.0&lt;/em&gt;&lt;/a&gt;! It helps us address several challenges:&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Servers are expensive, how to pay for them without charging the users?
&lt;/h4&gt;

&lt;p&gt;True, any application with enough users comes with a big monthly AWS bill. But why isn't this an issue for dev tools? We've had top notch UIs even for niche use cases such as &lt;a href="https://github.com/tannerlinsley/react-query-devtools" rel="noopener noreferrer"&gt;state management in a specific library&lt;/a&gt;. Duh! These don't need a server :) our dev machines &lt;strong&gt;are&lt;/strong&gt; the server for these tools. Hmm... developers have their own servers, right...&lt;/p&gt;

&lt;p&gt;What if users had their own &lt;strong&gt;"Personal Server"&lt;/strong&gt; too? This model has worked for &lt;a href="https://www.plex.tv/" rel="noopener noreferrer"&gt;Plex&lt;/a&gt; as an example, how about taking it one step further? Every house has a fridge for keeping food, would it make sense to also have a &lt;strong&gt;"store of data"&lt;/strong&gt;? This is the main idea here, there's a niche who already have PCs at home (PC gamers, people still keeping their old PCs, etc.), we can write software that turns a PC to a server for a household's data needs.&lt;/p&gt;

&lt;p&gt;In reality, the leverage that the Big Tech holds us hostage over is:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Ffunctionland%2Fblog%2Fmain%2Fphotos-intro-dev-to%2FPileHDD.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Ffunctionland%2Fblog%2Fmain%2Fphotos-intro-dev-to%2FPileHDD.png" title="Pile of HDDs" alt="HDD pile"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For sure, serving the world population takes acres upon acres of data centers. But for a household? Wouldn't a Raspberry Pi and a few TB of HDD be enough? We can even package this in a gadget for it to be more appealing. We can also accommodate for Cloud features like reliable backups in this p2p setting, a copy of one's photos can be backed up at another location, e.g. parents' house.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Concept for personal server, aka &lt;strong&gt;"Box"&lt;/strong&gt;, read more on &lt;a href="https://fx.land" rel="noopener noreferrer"&gt;fx.land&lt;/a&gt;&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Ffunctionland%2Fblog%2Fmain%2Fphotos-intro-dev-to%2Fbox.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Ffunctionland%2Fblog%2Fmain%2Fphotos-intro-dev-to%2Fbox.png" title="Box concept" alt="Box concept"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Doing both backend and frontend is hard
&lt;/h4&gt;

&lt;p&gt;Absolutely! We need to fix this. Google and the like have armies of developers working on each app, how can anyone compete? Don't fret! We can seek help from millions of frontend JavaScript developers around the world! They are already building all kinds of cool apps. Backend is not really an issue, many of them are well versed at using serverless cloud functions. So if we can provide the same &lt;strong&gt;"Developer Experience"&lt;/strong&gt;, can we have these brilliant people aboard?&lt;/p&gt;

&lt;p&gt;To address the need for backend, and also the limited compute power of the hardware that may be used, the solution that we're currently implementing is &lt;strong&gt;"Managed Services"&lt;/strong&gt;. For a start, we are developing 2 protocols on top of &lt;a href="https://libp2p.io/" rel="noopener noreferrer"&gt;libp2p&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;File Protocol&lt;/strong&gt;: for uploading and downloading files, this provides the function of a traditional file server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Protocol&lt;/strong&gt;: for persisting JSON data. This would be the Web 3.0 equivalent of REST or GraphQL endpoints. By linking the JSON data as &lt;a href="https://specs.ipld.io/block-layer/codecs/dag-json" rel="noopener noreferrer"&gt;DAG-JSON&lt;/a&gt; and saving it with &lt;a href="https://ipfs.io/" rel="noopener noreferrer"&gt;IPFS&lt;/a&gt;, we also get the conventional database-like queries.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Work on more managed services are on the way. We'll need &lt;em&gt;Machine Learning&lt;/em&gt; services for an app like Photos soon!&lt;/p&gt;

&lt;p&gt;These managed services are packaged in a JavaScript module, &lt;code&gt;@functionland/graph&lt;/code&gt;, so the complexities of what happens behind the scene is abstracted away for the app developer. They'll have an experience very similar to using serverless functions. Voila!&lt;/p&gt;

&lt;p&gt;This work is being pursued in the &lt;strong&gt;"box"&lt;/strong&gt; monorepo:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/functionland/box" rel="noopener noreferrer"&gt;github.com/functionland/box&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  3. If an app is open source, how can the developer make a living from it?
&lt;/h4&gt;

&lt;p&gt;This one is a long standing question in open source, and &lt;em&gt;Blockchain&lt;/em&gt; may finally give us an answer. It's ironic that prominent blockchains such as &lt;em&gt;Bitcoin&lt;/em&gt; have become somewhat centralized, true decentralization happens when average people run validator nodes. That's not the case today, but if there is a future where every home has a server, true decentralization can start! Newer generation blockchains are way less resource intensive, take &lt;a href="https://minaprotocol.com/" rel="noopener noreferrer"&gt;Mina&lt;/a&gt; for example, a snapshot of the whole chain will always be 22KB! &lt;/p&gt;

&lt;p&gt;So we can have home servers also be blockchain validator nodes, effectively printing money around the clock! We can then have a decentralized version of an &lt;em&gt;App Store&lt;/em&gt;, downloading and updating apps from this store can happen on-chain and be paid. But users won't be paying out of pocket, they'll pay with a portion of coins mined on their server (freedom tax :).&lt;/p&gt;

&lt;p&gt;This aspect is still very much at ideation stage, we'd love to brainstorm and hear what you think about it.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. Would the User Experience be compromised in any way?
&lt;/h4&gt;

&lt;p&gt;If anything, UX will be improved. There is no privacy concern, users &lt;em&gt;physically own&lt;/em&gt; their data. There's no advertisement, no lock-in. And in open source, anything that has use cases also has a community of contributors around it. So no longer we'll see useful apps become adware (anyone remember &lt;em&gt;ShareIt&lt;/em&gt;?). No orphaned app stuck with last update from years ago. All the cool things that we developers enjoy in our open source workflow, now up for grabs by the masses in everyday apps!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Eagerly looking forward to hearing your comments! Please don't hesitate to bash the whole idea to the ground! We don't mind at all. Only in common wisdom shall we thrive, no one soul knows all, most definitely not the noobs who started this :) -- Love and peace, Functionland&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>showdev</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>Building Chat Web Components with StencilJS and Ionic 4</title>
      <dc:creator>Keyvan M. Sadeghi</dc:creator>
      <pubDate>Mon, 29 Jul 2019 19:29:02 +0000</pubDate>
      <link>https://dev.to/keyvan_m_sadeghi/building-chat-web-components-with-stenciljs-and-ionic-4-537b</link>
      <guid>https://dev.to/keyvan_m_sadeghi/building-chat-web-components-with-stenciljs-and-ionic-4-537b</guid>
      <description>&lt;p&gt;Greetings to the amazing DEV community! I wanted to share with you my experience building a Web Component library using StencilJS and hear your precious feedback/comments.&lt;/p&gt;

&lt;p&gt;Here's what I've built:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2Fgt0TjLS.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2Fgt0TjLS.gif" alt="Assister Chat"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://assister.ai/chat/" rel="noopener noreferrer"&gt;Live Demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/assister-ai/assister/blob/master/packages/chat/README.md" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  The Problem
&lt;/h1&gt;

&lt;p&gt;First let's discuss why I chose Web Components, we've seen debates here on why one &lt;a href="https://dev.to/shihn/why-i-use-web-components-my-use-cases-1nip"&gt;would&lt;/a&gt; and &lt;a href="https://dev.to/richharris/why-i-don-t-use-web-components-2cia"&gt;wouldn't&lt;/a&gt; use web components.&lt;/p&gt;

&lt;p&gt;You've probably seen a lot of Chatbots popping out in various webpages. These are usually proprietary add-ons that people buy from a vendor, adding them to the page with a script that pushes an &lt;code&gt;iframe&lt;/code&gt; to the &lt;code&gt;body&lt;/code&gt;. &lt;a href="https://www.intercom.com/" rel="noopener noreferrer"&gt;Intercom&lt;/a&gt; and &lt;a href="https://www.drift.com/" rel="noopener noreferrer"&gt;Drift&lt;/a&gt; seem to be popular. I was thinking about an Open Source alternative and Web Components seemed a natural fit, main reason being that&lt;code&gt;ShaddowDOM&lt;/code&gt; prevents CSS conflicts with the host app.&lt;/p&gt;

&lt;h1&gt;
  
  
  Technology Choice
&lt;/h1&gt;

&lt;p&gt;I &lt;a href="https://github.com/assister-ai/assister/issues/7" rel="noopener noreferrer"&gt;struggled&lt;/a&gt; &lt;strong&gt;a lot&lt;/strong&gt; on the choice for the right tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  You should think long and hard about &lt;strong&gt;React&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;People either love or hate React, but the truth of the matter is that its influence is &lt;strong&gt;HUGE&lt;/strong&gt;. Earlier this year, there was a long and heated discussion on &lt;a href="https://github.com/mdn/sprints/issues/967#issuecomment-464257121" rel="noopener noreferrer"&gt;MDN Docs spring planning repo&lt;/a&gt; about why a web standards body is using a non-standard library. David Flanagan makes a sound argument IMO that attracting contributors without using React is hard. So that's one side, contributors.&lt;/p&gt;

&lt;p&gt;The other side is people using your components. React developers most likely &lt;strong&gt;will ignore your library&lt;/strong&gt; if they can't use it within JSX in ways they're accustomed to (&lt;code&gt;ref={}&lt;/code&gt; for example).&lt;/p&gt;

&lt;h2&gt;
  
  
  View vs. Logic
&lt;/h2&gt;

&lt;p&gt;A simple fact about standard HTML is often times ignored, I'm guilty of this myself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;you don't &lt;em&gt;see&lt;/em&gt; anything that's not &lt;em&gt;described&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt; I've been described, therefore I am! &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;chat-pane&lt;/code&gt; is an example of breaking that rule. It contains logic and shows elements (&lt;code&gt;chat-input&lt;/code&gt;) that are not described.&lt;/p&gt;

&lt;p&gt;I was about to do the exact same with &lt;code&gt;chat-message&lt;/code&gt;, I thought it'd be cool for &lt;code&gt;chat-message&lt;/code&gt; to have an attribute named &lt;code&gt;meta&lt;/code&gt; that contains information about its author, date sent, date read, etc. so it can render the footer based on these &lt;code&gt;meta&lt;/code&gt; data. &lt;strong&gt;Not cool!&lt;/strong&gt; That's not the HTML way of of doing things.&lt;/p&gt;

&lt;p&gt;HTML was the &lt;em&gt;"View"&lt;/em&gt; of the web way before all these front-end frameworks. If we're creating Web Components, we should strive for expanding the HTML vocabulary with the same semantics. People mock that attributes are just strings in web components. Mock all you want! This has been an elegant design of HTML that has withstood the test of time, and decouples HTML from JS/JSON.&lt;/p&gt;

&lt;p&gt;That said, I'm not at all against having higher level components that embed application logic. However, the place for those are inside the specific application, not the general web component that we're designing for reuse.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ionic 4
&lt;/h2&gt;

&lt;p&gt;Another choice that I made was to reuse components from &lt;code&gt;Ionic&lt;/code&gt;. In retro, I'm happy with that choice. Ionic components may seem overwhelming at first, but you come to realize that they are not complex at all, things like &lt;code&gt;ion-content&lt;/code&gt; and &lt;code&gt;ion-item&lt;/code&gt; are essentially glorified &lt;code&gt;div&lt;/code&gt;s with some useful utilities! Kudos to Ionic team's flexibility for moving to Web Components in &lt;code&gt;v4&lt;/code&gt;. There're still quirks, for instance, &lt;a href="https://ionicframework.com/docs/api/virtual-scroll" rel="noopener noreferrer"&gt;&lt;code&gt;ion-virtual-scroll&lt;/code&gt;&lt;/a&gt; is currently Angular-only. My guess is Ionic Components will only get better in time. Using them in Stencil was seamless, unsurprisingly, as they are both made by the same company.&lt;/p&gt;

&lt;h1&gt;
  
  
  StencilJS, does it have the answers?
&lt;/h1&gt;

&lt;p&gt;Let's first talk about the &lt;strong&gt;compiler&lt;/strong&gt; thing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;tag&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;chat-message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;styleUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;message.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Message&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See the name of that class, &lt;code&gt;Message&lt;/code&gt;? What do you think will happen if I change it to &lt;code&gt;JustinBieber&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nothing!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Nothing breaks, everything still works! You know why? Because the name of this class doesn't have any semantics at all. The class doesn't &lt;code&gt;extend&lt;/code&gt; the HTMLElement class, or any other class. It's just there for that &lt;code&gt;@Component&lt;/code&gt; decorator to create a host of other classes from it! Namely:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;HTMLChatMessageElement&lt;/code&gt;: generated by the compiler for natively interfacing with the element. This one does extend &lt;code&gt;HTMLElement&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;interface ChatMessage extends JSXBase.HTMLAttributes&amp;lt;HTMLChatMessageElement&amp;gt;&lt;/code&gt;: this is the beauty. Remember React users? Covered by the compiler!&lt;/p&gt;

&lt;p&gt;I was "meh" about using TypeScript at first, but you know what? Stencil automated creation of &lt;a href="https://github.com/assister-ai/assister/tree/master/packages/chat/src/components/message" rel="noopener noreferrer"&gt;documentation pages&lt;/a&gt; from the types alone. That coupled with not having to write a &lt;code&gt;types.d.ts&lt;/code&gt; and maintaining it for the project, I think it was a win.&lt;/p&gt;

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

&lt;p&gt;So is StencilJS the answer? IMO, hell yeah! For a specific scenario though. If you are a shorthanded dev like me, Stencil automates &lt;strong&gt;a lot&lt;/strong&gt; for you. In doing so however, it falls in the framework of the &lt;a href="https://www.technotification.com/2019/03/frameworks-vs-libraries-computer-science.html/" rel="noopener noreferrer"&gt;framework/library category&lt;/a&gt;. On the other hand, the end results adhere perfectly to web standards. Do a &lt;code&gt;view page source&lt;/code&gt; on the &lt;a href="https://assister.ai/chat/" rel="noopener noreferrer"&gt;demo page&lt;/a&gt;, fills me with joy to see this is possible again.&lt;/p&gt;

</description>
      <category>html</category>
      <category>webcomponents</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
