<?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: Kapil Kaisare</title>
    <description>The latest articles on DEV Community by Kapil Kaisare (@kapilkaisare).</description>
    <link>https://dev.to/kapilkaisare</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%2F196675%2Fb2cebe83-9853-414d-8ae8-1f45f626dd79.jpeg</url>
      <title>DEV Community: Kapil Kaisare</title>
      <link>https://dev.to/kapilkaisare</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kapilkaisare"/>
    <language>en</language>
    <item>
      <title>How much framework do you need?</title>
      <dc:creator>Kapil Kaisare</dc:creator>
      <pubDate>Fri, 15 Apr 2022 13:55:50 +0000</pubDate>
      <link>https://dev.to/kapilkaisare/how-much-framework-do-you-need-5257</link>
      <guid>https://dev.to/kapilkaisare/how-much-framework-do-you-need-5257</guid>
      <description>&lt;p&gt;This essay starts a series that explores and tests a hypothesis I've nursed for a couple of years; that &lt;strong&gt;it should be possible to build a web UI without the use of a framework&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In a frontend-focused software engineering career spanning nearly 15 years, I've seen frameworks come and go. After a few years of working with jQuery, I switched to using Backbone, then invested a good three years understanding Sencha ExtJS, then dropped that as it faded from prominence to use Angular(2+) for the next four, and am now, at the time of this writing, wrangling a legacy Ember codebase, strangling it into a React-ish application.&lt;/p&gt;

&lt;p&gt;The conceptual leap from jQuery and Backbone to Sencha ExtJS was perhaps the most significant, but since then, all frameworks have more or less offered similar ways of building web applications, save for React Hooks, which fronts a more functional paradigm. &lt;strong&gt;The conceptual sameness between these frameworks, coupled with the differences in their DSLs, caused a sense of framework fatigue&lt;/strong&gt; as I found myself learning yet another way of doing the same thing. Learning something new that does not add to your actual ability to build something is - I propose - a waste of time.&lt;/p&gt;

&lt;p&gt;Also consider: use a framework in an application long enough, and you will run into an architectural pattern that's not easily supported by the rules of the framework. &lt;strong&gt;Your ability to bend those rules will be determined by your understanding of the framework internals&lt;/strong&gt; - a far cry from the general approach of treating the framework like a black box. I offer that frameworks like Angular, which boasts of its own compiler and a renderer interface, are difficult to learn. Angular in particular offers no documentation on its internals.&lt;/p&gt;

&lt;p&gt;With that in mind, I'd like to clarify going in that I'm not advocating not using a framework. I define a framework as a collection of design patterns, and propose that &lt;strong&gt;a team should consider building their own framework using libraries and tooling that they understand well&lt;/strong&gt;. This offers the advantage of growing an awareness of the application internals within the team, which brings with it the flexibility of changing a component of the framework for another that better suits the team's purpose.&lt;/p&gt;

&lt;p&gt;To build the browser based client of a web application, you need your framework to provide:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A means of composing HTML into templatized, reusable blocks;&lt;/li&gt;
&lt;li&gt;A router that, based off the change in the url, determines what component gets rendered; and&lt;/li&gt;
&lt;li&gt;A way to build and use services that represent the application domain, perhaps fronting a state management solution.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Full fledged frameworks like Angular offer tightly coupled versions of all three. React, by itself, offers just the first, which in turn allows a team to swap individual components (like a router, or state manager) depending on what suits it best.&lt;/p&gt;

&lt;p&gt;To test this hypothesis, I shall be building a toy web application (a todo app - what else?) without using a framework, using libraries that I think will serve my needs best. To compose my HTML into reusable components, I shall be using StencilJS, a web component toolchain. I've yet to see a router that I can use independent of a framework, so I shall explore in ensuing posts the construction of one. For state management, I'll probably use RxJS to build out my services. There will be no backend persistence; I will be using local storage for this experiment.&lt;/p&gt;

&lt;p&gt;More to follow.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>webcomponents</category>
    </item>
    <item>
      <title>The Case for Web Components</title>
      <dc:creator>Kapil Kaisare</dc:creator>
      <pubDate>Thu, 14 Apr 2022 18:57:36 +0000</pubDate>
      <link>https://dev.to/kapilkaisare/the-case-for-web-components-5h7o</link>
      <guid>https://dev.to/kapilkaisare/the-case-for-web-components-5h7o</guid>
      <description>&lt;p&gt;From late 2018 to - at the time of this writing - 2022, I've found myself advocating and defending web components. This advocacy stems from framework fatigue induced by switching from jQuery to Sencha ExtJS to Angular to React to Svelte. For the most part, each framework has brought with it a DSL one needs to acquire to use effectively, but which is rendered obsolete when one begins working with a new framework.&lt;/p&gt;

&lt;p&gt;Generally, &lt;strong&gt;a framework is collection of design patterns coupled with a means of enforcing them.&lt;/strong&gt; If you've built your application right (think hexagonal architectures), you should be able to port your application from one framework to another without having to touch the majority of the codebase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Web UI frameworks aren't like other frameworks because in addition to a collection of design patterns, they also provide a means of composing reusable widgets from atomic, native elements.&lt;/strong&gt; This means of composition is unique to each framework, even when they have a common DSL like JSX. The uniqueness of each framework's composition mechanism means that widgets built in one framework cannot be ported to another.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Frameworks come and go&lt;/strong&gt;, and on a platform that's evolving as quickly as the web browser, this is truer than most. The framework du jour might seem irreplaceable now, but at some point in the course of your project, you will run into limitations that have been solved by a newer framework. The limiting factor at that time becomes the cost of rebuilding your existing widgets for the new framework; try explaining to management why they need to fund, and allocate time for, the construction of UIs they already paid for. And even when they're willing, engineers can hardly be expected to be excited about the prospect of building the same UI again. Switching to a new framework this way is effectively a rewrite, and a rewrite brings with it the risk of recreating defects the team has already fixed.&lt;/p&gt;

&lt;p&gt;So, understandably, management and engineering leadership express reticence at the prospect of a framework change. And as engineers struggle with fitting newer patterns into a framework that wasn't designed to support them, the quality of the codebase declines, leading to more defects and reduced team velocity. This in turn lowers confidence, which increases resistance to the idea of attempting a framework driven rewrite. The downward spiral continues until the cost of maintaining the codebase is judged equal to, or in excess of, that of rewriting the web application. The framework du jour is now eagerly embraced, and the cycle begins anew.&lt;/p&gt;

&lt;p&gt;If one accepts that a framework change is inevitable (and perhaps even desirable) in a long living codebase, then a team's focus should be on &lt;strong&gt;minimizing the cost of a framework switch&lt;/strong&gt;. Web Components offer a means to this end. They are a collection of four specifications (&lt;a href="https://w3c.github.io/webcomponents/spec/custom/"&gt;Custom Elements&lt;/a&gt;, &lt;a href="https://w3c.github.io/webcomponents/spec/shadow/"&gt;Shadow DOM&lt;/a&gt;, &lt;a href="https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-module-system"&gt;ES Modules&lt;/a&gt; and &lt;a href="https://html.spec.whatwg.org/multipage/scripting.html#the-template-element/"&gt;HTML Templates&lt;/a&gt;) that collectively provide a means to building and deploying reusable widgets. A web component can be built once, and used across applications built with different frameworks. And because these are standards, they are less likely to be rendered obsolete, and are guaranteed to be supported across all modern web browsers.&lt;/p&gt;

&lt;p&gt;While you can build components directly from the supporting Web APIs, you might find it productive to use a library that's been built to support this task. &lt;a href="https://lit.dev"&gt;Lit&lt;/a&gt; and &lt;a href="https://stenciljs.com"&gt;StencilJS&lt;/a&gt; are two of several libraries with acompanying tooling to help you build web components. And because they compile to the same 'target', they give you an additonal advantage: if you choose to switch web component libraries at some point in the future, you can make the switch for new components without having to rewrite the old ones, and use both in the same application.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;a href="https://w3c.github.io/webcomponents/spec/custom/"&gt;Custom Element&lt;/a&gt; specification&lt;/li&gt;
&lt;li&gt;The &lt;a href="https://w3c.github.io/webcomponents/spec/shadow/"&gt;Shadow DOM&lt;/a&gt; specification&lt;/li&gt;
&lt;li&gt;The &lt;a href="https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-module-system"&gt;ES Module&lt;/a&gt; specification&lt;/li&gt;
&lt;li&gt;The &lt;a href="https://html.spec.whatwg.org/multipage/scripting.html#the-template-element/"&gt;HTML Template&lt;/a&gt; specification&lt;/li&gt;
&lt;li&gt;&lt;a href="https://lit.dev"&gt;Lit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stenciljs.com"&gt;StencilJS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

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