<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Roy Kass on Medium]]></title>
        <description><![CDATA[Stories by Roy Kass on Medium]]></description>
        <link>https://medium.com/@royk?source=rss-f090ede3e53c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3fmkBVrueUXgwA_sjEKTjg.jpeg</url>
            <title>Stories by Roy Kass on Medium</title>
            <link>https://medium.com/@royk?source=rss-f090ede3e53c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 10:28:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@royk/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Rise of the Cyborg Developers]]></title>
            <link>https://medium.com/israeli-tech-radar/the-rise-of-the-cyborg-developers-2f977773db71?source=rss-f090ede3e53c------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f977773db71</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[management]]></category>
            <category><![CDATA[trends-and-insights]]></category>
            <category><![CDATA[ai-and-ml]]></category>
            <dc:creator><![CDATA[Roy Kass]]></dc:creator>
            <pubDate>Tue, 11 Feb 2025 10:58:42 GMT</pubDate>
            <atom:updated>2025-02-11T10:58:42.170Z</atom:updated>
            <content:encoded><![CDATA[<p><em>“Without change, something sleeps inside us… The sleeper must awaken.” — Duke Leto Atreides, Dune.</em></p><blockquote><em>A </em><strong><em>cyborg</em></strong><em> (short for </em><strong><em>cybernetic organism</em></strong><em>) is a being that combines </em><strong><em>biological</em></strong><em> and </em><strong><em>mechanical</em></strong><em> elements to enhance or sustain its functionality. Cyborgs can be human or non-human entities, where the integration of artificial components extends, supports, or replaces natural biological systems.</em></blockquote><p>If you read the above definition, you can see that there is nothing written about the cybernetic parts being wired into your body. So, in a sense, one can claim that GenAI is a cybernetic augmentation of our minds — capable of offering us “hand crafted” solutions to custom problems that we are required to solve. Thus extending and supporting our natural biological thinking systems — essentially making us cyborgs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ENRoLvbB_FnqVeGkGZrrlg.jpeg" /><figcaption>Celebrating augmentation with AI (Photo by Pavel Danilyuk).</figcaption></figure><p>I’m a frontend tech lead at <a href="https://www.tikalk.com/">Tikal</a>. I was always interested in AI: I took 2 academic courses when doing my software engineering Bsc. (intro to AI and AI planning). I also took Coursera’s Machine learning course over a decade ago, by none other than Prof. Andrew Ng (Which was very interesting).</p><p>In the past, I also worked a bit with Google’s Dialogflow (an NLP framework for conversational UI) and Tensorflow (an image recognition tool) — where I developed a strong feeling that conversational UI is the future of UI.</p><p>In the past year, due to the ongoing AI revolution I worked with various tools, including: ChatGPT, Claude, Gemini, Co-pilot (both in VSCode and Webstorm), Leonardo, Midjourney, Suno, Sora, llamaIndex and others.</p><p>I also hosted 4 podcast episodes about GenAI in the SDLC (software development life cycle), lectured about it and hosted an experts panel about it.</p><p>On my spare time, as a hobby, I’m developing a game in Unity — and I used GenAI there very frequently, for code and for asset generation.</p><p>GenAI keeps changing the industry — and us as developers.</p><h3>My first real GenAI supported feature development</h3><p>A while ago, I was requested to develop a very unusual horizontal funnel graph for a client.</p><p>With manual research, this task would take me about <strong>6–8 days</strong> to complete. This is since I wanted to use the current library the client uses, mold and bend it to the requirements presented to me — and it needed a lot of knowledge and experience in the library, which I didn’t have. I knew that library in a basic manner.</p><p>I decided to give GenAI a chance and used ChatGPT. I took my time to write a nice detailed prompt and asked for a solution. The first solution wasn’t great, but it gave me an idea and a direction. I took that road and refined the solution by chatting further with the GenAI. Eventually, I finished the feature in <strong>3 days</strong>.</p><p>Of course, I needed to manually sculpt the solution to the write format and data — but that was the domain in which I had the knowledge and skill that was required.</p><p>In the end, the GenAI made a huge difference in time to delivery. It made the research part a relative breeze — and it made my client happy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_4sirAevI1llRX5aBrRxQw.jpeg" /><figcaption>There’s nothing like the first time (Photo by Cottonbro studio).</figcaption></figure><h3>The age of the prototype</h3><p>Not long ago, when trying to use a new library or technology to build a feature or an infrastructure, a substantial research phase was required.</p><p>Research usually involved reading some manuals, frantically searching the internet for answers of advanced subjects and manipulations, reading various exotic answers on stack overflow, while failing to build a proper segment of working code — until success was finally achieved.</p><p>So the process was -</p><ol><li>Research.</li><li>Prototype/POC.</li><li>Manual finalization.</li><li>Production ready code.</li></ol><p>This, of course, might have included several iterations.</p><p>Today, with GenAI and code generation — we can essentially skip the research phase to get to our prototype. At this point, we just improve the prototype until it reaches the final result.</p><p>This is not a small hop ahead — This is a major leap forward!<br>Research takes a lot of time, especially for advanced cases and syntax you’re not well versed in.</p><p>The new, GenAI assisted process goes something like this:</p><ol><li>Prompt the GenAI — it’s usually better to give it context, the technologies you want to include, the problem you’re trying to solve, rules and guidelines, your mindset when addressing the problem, etc.</li><li>Review the prototype — usually, we will aim for a working code, which is somewhat of a POC at this phase. Review it, run it — and write down what is missing or incorrect — and send it to the GenAI. This phase reiterates until you are satisfied with the result.</li><li>Manually sculpt the result to finalize it — You can usually use inline code suggestions from a GenAI to speed up this phase.</li><li>Production ready code.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AdI9oYR0SARqwmlK3hhVzQ.jpeg" /><figcaption>Prototype — experiment with your ideas (Photo by Pavel Danilyuk)</figcaption></figure><h3>Strategical research</h3><p>A certain type of research requires a more theoretical approach, that isn’t satisfied by a prototype. For example, when you need to compare a framework or a library, or when you need to create a large scale architecture. The downside of GenAI is that the training results we use are in the past — and we usually require the most updated knowledge in these cases. For this, tools like <a href="https://www.perplexity.ai/">Perplexity</a> were created. Tools like that can search the web when answering. They combine the capabilities of a GenAI, responding with hand tailored responses to the question given. But, they also have the capabilities of a search engine — returning links to relevant search results they base their answers on. It’s important to note that some of the common GenAI now also have this capability in some of their models, like ChatGPT.</p><h3>New architectures</h3><p>I had an interesting discussion with a colleague of mine who is also an AI enthusiast. We talked about the future of UI, if conversational UI will be the core way of interacting with applications. In this orientation, we will have a UI which is completely conversational (and will be addressed vocally or by typing a text). But, this UI will be connected to the “frontend” and “backend”.</p><p>The frontend will be the way the GenAI will visualize its answers. It’s essentially a collection of components that the GenAI will be able to populate with the requested data and attributes. For example, a sortable, filterable table of users. <br>To retrieve the data required, the backend will expose an API that the GenAI can use.</p><p>In this way, we are extending the GenAI with both visual and data abilities. The input is conversational and the output to the user will be visual, using data. The design should be modular, ever extending the abilities of the GenAI. Since the current AI assistants on mobile devices and PCs are getting better by the day, this could be the direction the applications will be consumed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Swk7zuZhrGAuIMeloCGk6Q.jpeg" /><figcaption>New tools enable new architectures (Photo by Andrea De Santis)</figcaption></figure><h3>Embracing the technology</h3><p>As a professional developer and engineer, I learned an interesting truth about technology -</p><p>Resist the waves, and you will never master them. Submit to them — and you will be able to navigate the seas.</p><p>In other words — when learning a new technology, you need to be in an accepting mindset, otherwise your resistance will make it hard for you to study and eventually master it.</p><p>GenAI is not different in that sense. I still work with developers who say “it’s not there yet”. They say that because they used it at the beginning and didn’t experience the amazing change it went through in the last year. This leaves them behind in a sense. I believe that eventually they will need to adapt to the new situation — and there will be a price to pay for that lag.</p><h3>Don’t we lose skills in the process?</h3><p>Of course we do. We’re losing parts of our semi-manual research capabilities. We’re losing some motivation to deeply study certain subjects that are required for a problem at hand.</p><p>But here’s the question — are these skills needed in the very near future?</p><p>Let me ask you this: when was the last time you used the yellow pages? A paper printed encyclopedia chapter? Navigated with a physical map? Sent a Morse coded telegraph message? Fixed a tape recorder cassette?</p><p>The nature of technological revolutions is that they make the old skills obsolete.</p><p>You will lose skills- but in return you will gain new ones that will become essential.</p><p>Our role in development incrementally changes with GenAI. We become the “directors” of the development of a specific feature. We have the know-how: the specific context, requirements, standards and definition of done. We need to direct the GenAI to assist us with a solution for this problem, that abides all that. We can take it from a problem to a POC and from there — to the finalized product.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aT9fYUElDL728IVnoGwLJw.jpeg" /><figcaption>Searching the yellow pages- yet another skill “lost”. (Photo by Katie)</figcaption></figure><h3>Shifting left</h3><p>Shift left is a concept that aims to shorten resolution times and reduce costs by solving issues earlier in the support process. To achieve that, the people involved should usually be able to solve problems that are outside of their “natural” domain of expertise.</p><p>Since GenAI can augment our capabilities in any field, it can help us in domains we didn’t even think about touching before. Need to change the pipeline definitions? Create a complex SQL query? Conjure that annoying css class? GenAI can do it for you. So A frontend developer can now become a fullstack one (to a certain complexity). A Devops/platform engineer can do certain backend tasks instead of helplessly seeking for a suitable expert to assist them. Even support might be able to create a pull request that fixes that annoying quirk in the UI detected by the user. A UI/UX can play with actual coded UI to see the results of their ideas.</p><p>Essentially, you can expand your domain to nearby other domains when augmented by GenAI.</p><h3>The 3 major fronts of progress</h3><p>It’s not AI alone that’s progressing dramatically. Humanity is making aggressive progression on 2 other fronts:</p><p>On the <strong>energy</strong> front, we have nuclear fusion. Unlike nuclear fission, which produces nuclear waste — the fusion doesn’t. It produces helium, which is an inert gas. Making it a clean and relatively safe energy.</p><p>This means we will be able to produce vast amounts of clean energy.</p><p>On the <strong>computation power</strong> front, we have quantum computers. These computers use quantum entanglement, making problems that took standard computers an unreasonable amount of time to solve- be solvable within a <a href="https://blog.google/technology/research/google-willow-quantum-chip/">much shorter time</a>. Since all current encryption relies on the time it takes to solve those problems, it will completely change software security as we know it, as well.</p><p>Combined with the AI revolution we can have an AI that has immense computing power and is not virtually bound by energy consumption limitations. It’s even scary to think about it.</p><p>Honorable mentions are 3D printing that can materialize digital concepts created by AI and the robotic industry advancements that give AI a physical manifestation.</p><p>It is also important to note that all sides are not pulling any breaks regarding AI, including the competition between the USA and China, with the introduction of DeepSeek.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kyIcbV8s3eGv7IQU3EJPhA.jpeg" /><figcaption>A Tokamak nuclear fusion reactor (<a href="https://commons.wikimedia.org/w/index.php?curid=73919081">By Rswilcox — Own work, CC BY-SA 4.0</a>)</figcaption></figure><h3>Will AI replace us?</h3><p>That is the ultimate question, isn’t it? It’s very hard to even guess the answer. Things are changing so rapidly. But, after talking to and reading from several experts in the field, I have an educated guess.</p><p>If we review the industrial revolution, we can see a clear increase in the GDP — gross domestic product.</p><p>This means that we didn’t stay in the same levels of production. Production increased dramatically, while people found different occupations that fit the new era. Those who didn’t change — remained without a job.</p><p>In our terms, if a manual developer can produce a feature in a certain timeframe, a GenAI augmented developer, a “cyborg” developer if you will — can produce more features in that timeframe, thus increasing productivity. History shows us that companies never said “that’s enough production for us”. Which means that while you augment yourself, or your developers with GenAI — you will match the future standard of production. Don’t do it — and you will underproduce.</p><p>In other words, AI will not necessarily replace us, at least in the near future, but <strong>people who use AI will replace people who don’t</strong>.</p><p>As for the mid to far future, it’s really hard to say. Some answers can be found in the <a href="https://en.wikipedia.org/wiki/Transhumanism">trans-humanistic</a> philosophy that suggests that we should harmonize ourselves with AI, redefining life and sentience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VRpZlS2LUu3cEajIFwJsEw.jpeg" /><figcaption>Awaken, sleeper! (Photo by Victor Freitas)</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f977773db71" width="1" height="1" alt=""><hr><p><a href="https://medium.com/israeli-tech-radar/the-rise-of-the-cyborg-developers-2f977773db71">The Rise of the Cyborg Developers</a> was originally published in <a href="https://medium.com/israeli-tech-radar">Israeli Tech Radar</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Guarded Routes in Next.js]]></title>
            <link>https://medium.com/israeli-tech-radar/guarded-routes-in-next-js-e7f980ee68dd?source=rss-f090ede3e53c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7f980ee68dd</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[routing]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[full-stack]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Roy Kass]]></dc:creator>
            <pubDate>Mon, 23 Dec 2024 16:46:28 GMT</pubDate>
            <atom:updated>2025-01-01T08:38:17.650Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How to prevent access to routes and hide their tabs in a clean manner?</em></p><p>Have you ever noticed how your code looks like when you’re creating tabs in a layout.tsx ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K92l4QGSm9ZgIpnqyFFA6A.png" /></figure><p>It doesn’t end there, does it? This very same code repeats itself in a different manner: when you have to decide whether you show the route that is tied to the same tab, in case the user will (for some reason) use the direct URL for it.</p><p>So we have code duplication and also a very messy code. Can we do better?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HFkm9HSFo-8lGXlhXnw5UA.jpeg" /><figcaption>Guarding the path (Photo by <a href="https://unsplash.com/@robertoc95?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Roberto Catarinicchia</a> on <a href="https://unsplash.com/photos/person-in-red-and-yellow-suit-iFybCTTloJs?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a>)</figcaption></figure><h4>Echoes From The Past</h4><p>I recalled from years ago, when I was using Angular (2+) and there was a feature called <a href="https://angular.dev/guide/routing/common-router-tasks#preventing-unauthorized-access">“route guards”</a>. It essentially allows you to add a function to each route to see if it’s allowed or not. It looked like this:</p><pre>{<br>  path: ‘/your-path’,<br>  component: YourComponent,<br>  canActivate: [yourGuardFunction],<br>}</pre><h4>What About Next.js?</h4><p>Working on Next.js I noticed that the equivalent checks for the “guard functions” repeats themselves. We usually check for :</p><ul><li>Feature flags</li><li>Role authorization (including a role within a certain context)</li><li>Licensing (the level of license the user paid for)</li><li>etc..</li></ul><p>There are some special cases and there is sometimes a need to redirect the user if the path is not allowed.</p><p>All of this should be checked twice- once for the ability to show/hide a tab that is relevant for this route and the other to forbid/allow access to the route regardless.</p><p>So, I thought I could do better than just allow a function per route: I could lay out an infrastructure that will require some initial configuration, but from that point each feature, layout and page added — will be much easier. Also, there will be a <strong>single source of truth</strong> when deciding if a route/tab should be available or not.</p><h4>My Variation of Guarded Routes</h4><p>Since I was very happy with the solution, I created this package: <br><a href="https://www.npmjs.com/package/guarded-routes-next">https://www.npmjs.com/package/guarded-routes-next</a></p><p>The package is a very small wrapper for my solution. Let’s see how you can set it up in your project:</p><pre>npm install guarded-routes-next</pre><ul><li>Create a folder called guarded-routes (exact name is not mandatory).</li><li>Create a types.ts file that will have our GuardedRoutes interface:</li></ul><pre>// src/guarded-routes/types.ts<br>export interface GuardedRoutes {<br>  featureFlaggedRoutes: Record&lt;string, string[]&gt;;<br>  roleBasedRoutes: Record&lt;string, any[]&gt;;<br>  specialChecksRoutes?: Record&lt;string, () =&gt; Promise&lt;boolean&gt;&gt;;<br>  defaultRedirects?: Record&lt;<br>    string,<br>    (pathname: string, searchParams: URLSearchParams) =&gt; Promise&lt;string&gt;<br>  &gt;;<br>}</pre><p>GuardedRoutes breaks our checks into their types and has a map of path to anything (usually an Array, but not always, as shown in specialRouteChecks and defaultRedirects). <strong>The idea is to have a collection of values</strong> (or just one value)<strong> for a path we want to guard by a specific check</strong>. The relationship between the values and the functionality is defined in the relevant check function for each prop in GuardedRoutes.</p><h4>Dealing with the middle man</h4><ul><li>Now let’s create our special middleware in guardedMiddleware.ts:</li></ul><pre>// src/guarded-routes/guardMiddleware.ts<br>import { NextRequest, NextResponse } from &#39;next/server&#39;;<br>import { getFlags } from &#39;@/app/server-actions&#39;;<br>import { generateGuardedRoutes, GetApplicationGuardedRoutesFunc, searchMapForRoute } from &#39;guarded-routes-next&#39;;<br>import { GuardedRoutes } from &#39;@/guarded-routes/types&#39;;<br>import { safePageGuardedRoutes } from &#39;@/app/safe-page/guardedRoutes&#39;;<br><br>// this is an example of using a function to check for roles<br>const checkRouteForRole = (getApplicationGuardedRoutes: GetApplicationGuardedRoutesFunc&lt;GuardedRoutes&gt;) =&gt; async (pathname: string) =&gt; {<br>  const { roleBasedRoutes } = getApplicationGuardedRoutes();<br>  const roles: string[] | undefined = searchMapForRoute(pathname, roleBasedRoutes);<br>  if (!roles) return true;<br>  return !roles.includes(&#39;admin&#39;);<br>};<br><br>// this is an example of using a function to check for feature flags<br>const checkRouteForFeatureFlag = (getApplicationGuardedRoutes: GetApplicationGuardedRoutesFunc&lt;GuardedRoutes&gt;) =&gt; async (pathname: string) =&gt; {<br>  const { featureFlaggedRoutes } = getApplicationGuardedRoutes();<br>  const featureFlags: string[] | undefined = searchMapForRoute(pathname, featureFlaggedRoutes);<br>  if (!featureFlags) return true;<br>  return await getFlags(featureFlags);<br>};<br><br>// this is an example of using a function to check for custom special conditions<br>const checkRouteForSpecialChecks = (getApplicationGuardedRoutes: GetApplicationGuardedRoutesFunc&lt;GuardedRoutes&gt;) =&gt; async (pathname: string) =&gt; {<br>  const { specialChecksRoutes } = getApplicationGuardedRoutes();<br>  const relevantRouteValues = searchMapForRoute(pathname, specialChecksRoutes!);<br>  if (!relevantRouteValues) return true;<br>  return relevantRouteValues();<br>};<br><br><br></pre><p>This file has several parts at first we define the check functions — each of them corresponds to a relevant property of the GuardedRoutes interface.</p><p>Keep in mind that here you are limited only by your imagination.</p><p>Note All of these functions are wrapped with a function that gets getApplicationGuardedRoutes. This is because each feature will have its own guarded routes. The packages merges all those together into a single GuardedRoutes instance.</p><p>Since it uses a reduce function, an initial value is also needed (we’ll see that shortly).</p><p>Note that the check functions also use the provided searchMapForRoute, which knows how to search the merged GuardedRoutes instance.</p><h4>You shall not pass!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7e61EaQ4Z2ERDeFlvUC8jw.jpeg" /><figcaption>Thou shall not pass! (Photo by <a href="https://unsplash.com/@tex450?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Matthew Ball</a> on <a href="https://unsplash.com/photos/a-lego-wizard-with-a-staff-and-a-hat-X32GrdVqMBA?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a>)</figcaption></figure><p>The second part is the main isPathAllowedWithGetApplicationGuardedRoutes function, which is essentially an isPathAllowed function wrapped again with a function that gets getApplicationGuardedRoutes.</p><pre>// src/guarded-routes/guardMiddleware.ts<br><br>// this function gets the application guarded routes from the generateGuardedRoutes function<br>// it will result in the isPathAllowed function being able to check the route against the guarded routes<br>const isPathAllowedWithGetApplicationGuardedRoutes = (getApplicationGuardedRoutes: GetApplicationGuardedRoutesFunc&lt;GuardedRoutes&gt;) =&gt; async (pathname: string) =&gt; {<br>  return (<br>    (await checkRouteForRole(getApplicationGuardedRoutes)(pathname)) &amp;&amp;<br>    (await checkRouteForFeatureFlag(getApplicationGuardedRoutes)(pathname)) &amp;&amp;<br>    (await checkRouteForSpecialChecks(getApplicationGuardedRoutes)(pathname))<br>  );<br>};</pre><h4>Dealing with Rejection</h4><p>Next, we have a definition of how the middleware will behave in case a certain path is not allowed. Notice how you can add a redirect functionality here.</p><pre>// src/guarded-routes/guardMiddleware.ts<br><br>// here you define how the middleware should  behave when a route is rejected (isPathAllowed returns false)<br>const middlewareReject = (getApplicationGuardedRoutes: GetApplicationGuardedRoutesFunc&lt;GuardedRoutes&gt;) =&gt; async (request: NextRequest) =&gt; {<br>  const { nextUrl } = request;<br>  const { host, protocol, pathname, searchParams } = nextUrl;<br>  const defaultRedirect = searchMapForRoute(pathname, getApplicationGuardedRoutes().defaultRedirects!);<br>  const targetRedirect = defaultRedirect &amp;&amp; (await defaultRedirect(pathname, searchParams));<br>  return targetRedirect<br>    ? NextResponse.redirect(`${protocol}${host}${targetRedirect}`)<br>    : NextResponse.error(&#39;not found&#39;, { status: 404 });<br>};</pre><h4>Wrapping it all together</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gxrOKmXtLOIsenJ2u8urtQ.jpeg" /><figcaption>Let’s wrap it together (Photo by <a href="https://unsplash.com/@kadh?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Kira auf der Heide</a> on <a href="https://unsplash.com/photos/person-holding-box-BkigsnKJK34?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a>)</figcaption></figure><p>This initial values, the wrapped isPathAllowed function (isPathAllowedWithGetApplicationGuardedRoutes), the array with all the instances of GuardedRoutes (will be explained shortly) and the middlewareReject are all inserted into the generation function, generateGuardedRoutes:</p><pre>const { isPathAllowed, guardMiddleware } = generateGuardedRoutes({<br>  isPathAllowedWithGetApplicationGuardedRoutes,<br>  initValue: {<br>    roleBasedRoutes: {},<br>    specialChecksRoutes: {},<br>    featureFlaggedRoutes: {},<br>    defaultRedirects: {}  <br>  } as GuardedRoutes,<br>  applicationGuardedRoutes: [<br>    // your feature guarded routes go here.<br>  ],<br>  middlewareReject<br>});<br><br>export { guardMiddleware, isPathAllowed };</pre><p>This creates 2 artifacts that we will use in 2 different parts.</p><p>The guardeMiddleware will be used inside our Next.js middleware.ts file:</p><pre>// middleware.ts<br>import { guardMiddleware } from &#39;@/guarded-routes/guardMiddleware&#39;;<br><br>export function middleware(request: NextRequest, response: NextResponse) {<br>  return guardMiddleware(request, response); // you can add other middlewares here<br>}<br><br>export const config = {<br>  matcher: [&#39;/((?!api|_next/static|_next/image|favicon.ico).*)&#39;]<br>};</pre><p>The isPathAllowed will be used inside an RSC (React Server Component) Tab:</p><pre>// src/components/tabs/Tab.tsx<br>export async function Tab(props:TabProps) {<br>    if (!await isPathAllowed(props.path)) {<br>        return null;<br>    }<br>    return &lt;ClientTab {...props} /&gt;;<br>}</pre><p>Notice the ClientTab which is not an RSC, but a usual client side react component.</p><p>This is the setup stage. Now each time we create a feature or a layout.tsx, we will create a GuarededRoutes instance for it. It will look like something this:</p><pre>export const safePageGuardedRoutes: GuardedRoutes = {<br>  roleBasedRoutes: {<br>    &#39;/safe-page-feature/admin-only-route&#39;: [&#39;admin&#39;]<br>  },<br>  featureFlaggedRoutes: {<br>    &#39;/safe-page-feature/beta-route&#39;: [&#39;betaFeature&#39;]<br>  },<br>  specialChecksRoutes: {<br>    &#39;/safe-page-feature/special-route&#39;: async () =&gt; {<br>      // Custom check logic<br>      return true;<br>    }<br>  },<br>  defaultRedirects: { //this is an example of how to redirect to a default route in case of rejection<br>    &#39;/safe-page-feature/beta-route&#39;: async (pathname, searchParams) =&gt; {<br>      // Custom redirect logic<br>      return &#39;/login&#39;;<br>    }<br>  }<br>};</pre><p>Note that you can use /absolute-path/feature-path/* to make sure all paths that are under /absolute-path/feature-path/ (including itself) will adhere to the same condition.</p><p>In addition, the same route can appear in several checks, the relationship will be the same as you define it in your isPathAllowed function.</p><p>We will add this to the generation function:</p><pre>const { isPathAllowed, guardMiddleware } = generateGuardedRoutes({<br>  ...<br>  applicationGuardedRoutes: [<br>    safePageGuardedRoutes<br>  ],<br>  ...<br>});</pre><p>When adding Tabs it will look much cleaner</p><pre>&lt;div className=&quot;flex gap-1&quot;&gt;<br>  &lt;Tab path=&quot;/safe-page-feature/admin-only-route&quot;&gt;Admin Only&lt;/Tab&gt;<br>  &lt;Tab path=&quot;/safe-page-feature/beta-route&quot;&gt;Beta&lt;/Tab&gt;<br>  &lt;Tab path=&quot;/safe-page-feature/special-route&quot;&gt;Special&lt;/Tab&gt;<br>&lt;/div&gt;</pre><h4>Conclusion:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6fOpgtI19MJiKRNZK6scQA.jpeg" /><figcaption>Concluding is important (Photo by <a href="https://unsplash.com/@earbiscuits?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Juan Rumimpunu</a> on <a href="https://unsplash.com/photos/gray-monkey-in-bokeh-photography-nLXOatvTaLo?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a>)</figcaption></figure><p>While the setup requires some work, when we develop a feature we can streamline our development using the guarded routes.<br>By doing this, we simplify the code of each feature, while allowing a single source of truth for each path.</p><p>one thing to note before we finish — the middleware of Next.js runs in<a href="https://nextjs.org/docs/pages/api-reference/edge"> Edge runtime context </a>which has lesser abilities than the usual Node.js. This means that some libraries will need creative solutions like a reverse proxy, or a request to your node server in order to allow them to work. This is a design problem within the infrastructure of Next.js, which doesn’t originate from the solution I just offered you.</p><p>Having said that, I hope you will find this solution clean and valuable as I did.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7f980ee68dd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/israeli-tech-radar/guarded-routes-in-next-js-e7f980ee68dd">Guarded Routes in Next.js</a> was originally published in <a href="https://medium.com/israeli-tech-radar">Israeli Tech Radar</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Next.js, Why Now?]]></title>
            <link>https://medium.com/israeli-tech-radar/why-next-js-why-now-19921874cb99?source=rss-f090ede3e53c------2</link>
            <guid isPermaLink="false">https://medium.com/p/19921874cb99</guid>
            <category><![CDATA[trends-and-insights]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Roy Kass]]></dc:creator>
            <pubDate>Wed, 14 Aug 2024 08:10:30 GMT</pubDate>
            <atom:updated>2024-09-22T10:45:02.041Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The calculated risks and benefits of moving from React to Next.js</em></p><p>In the ever-evolving world of web development, making the right choice of technology stack can significantly impact your project’s success. React has been a popular choice for building user interfaces due to its simplicity and flexibility.</p><p>However, can it get even better, especially when it reaches a certain complexity? Are the technical pros and cons the only relevant concern when deciding whether to move to another technology or to stay with the current one? This is where Next.js, a powerful framework built on top of React, comes into play.</p><p>In this article, we’ll explore why transitioning from React to Next.js can be a game-changer for your web development projects.</p><h3>The Rising Popularity of Next.js</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qBt_t35AOTfX6Lg54bK1VA.jpeg" /><figcaption>Photo by Elina Volkova</figcaption></figure><p>I’m Roy Kass, a Tech leader at <a href="https://www.tikalk.com/">Tikal</a>, with more than 16 years of experience in the Frontend industry.</p><p>Before diving into the technical benefits, let’s talk about the buzz around Next.js.</p><p>The frontend ecosystem is fiercely competitive, and popularity can often signal a framework’s staying power. I overviewed the importance of this in my previous article — <a href="https://medium.com/israeli-tech-radar/fear-driven-development-c6b427521f14">Fear Driven Development</a>, which I urge you to read.</p><p>If you look at <a href="https://npmtrends.com/next">npm trends</a>, you’ll see a consistent rise in downloads for Next.js, while GitHub stars and community engagement continue to soar. Next.js isn’t just a trend — it’s becoming a standard.</p><p>Its competition (<a href="https://remix.run/">Remix</a>), while existent, functioning and developing, <a href="https://npmtrends.com/@remix-run/react-vs-next">is not really on par</a> in terms of popularity.</p><h3>The Benefits</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ofhYkeKLpVUbQL3LF7vB_Q.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@joeyc?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Joe Caione</a></figcaption></figure><h3>Server-Side Rendering (SSR)</h3><p>One of the most compelling reasons to switch to Next.js is its built-in support for server-side rendering (SSR). While React renders components on the client side, Next.js allows pages to be rendered on the server before being sent to the client. This results in faster page loads, improved SEO, and a better user experience. SSR can be particularly beneficial for content-heavy websites and applications where initial load time is critical. The performance boost is well felt, when compared with profiling tools like lighthouse.</p><h3>Static Site Generation (SSG)</h3><p>Next.js also supports static site generation (SSG), enabling you to pre-render pages at build time. This approach combines the benefits of static websites (speed and security) with the flexibility of dynamic content. By generating static HTML files for each page, you can serve them directly from a CDN, significantly reducing the load on your server and ensuring rapid content delivery.</p><p>Next.js automatically detects which pages can be statically generated.</p><h3>Server Actions</h3><p>Next.js simplifies the creation of backend APIs, by using a unique kind of magic. Instead of defining an API route and creating code that handles it, you just create a file that has “use server” on top and exports only async functions.</p><p>Both server code and client code can use those functions. When they are called from the client side, the whole API routing is generated for you, and your code just calls a “server function”. <br>In my opinion, this feature alone is an enormous upgrade to your developer experience.</p><h3>Improved Development Experience</h3><p>Next.js emphasizes developer experience. It uses a SWC (Speedy Web Compiler) Rust compiler, just like in Vite, but modified. Since Next.js isn’t an SPA, it doesn’t need to load all the code in advance, just a very particular subtree of it. To support that, it has a very strong automatic code splitting, which also enables hot module replacement for development purposes. Next.js also has a convention over configuration approach, making most of your development decisions quite easy and well constructed — a clear signature of a framework. In addition, Next weaves together the server/client code in a very streamlined way.</p><h3>SEO and Performance Optimization</h3><p>Out-of-the-box SEO optimization is another significant advantage of using Next.js. By rendering pages on the server and providing better control over meta tags and headers, Next.js ensures that search engines can effectively crawl and index your content. Additionally, features like automatic image optimization, built-in analytics, and AMP support help you deliver high-performance, search-friendly websites.</p><h3>File Based Routing (App Router)</h3><p>Instead of configuring the routes as an object, or a list of components, Next.js leverages a highly standardized file base routing system to implement routing. This takes care of layouts, pages, errors (including not found and other), loading and more. From my experience, this actually simplifies your code and orders it in a very clear manner. It also enables the partition of the application per page, reducing size tremendously.</p><p>It is important to note that about a year ago, Next.js made the transition from the more complicated-to-use Pages Router to the more streamlined App Router, making server components much easier — and enabling the use of server actions.</p><h3>Better Software Security</h3><p>Having part of your code on the server side, unlike in a SPA, makes your code more secure, because it’s not exposed to the client. If you only use React, you will have to have all this code exposed on the client side, even though it will be uglified and minified (as this is somewhat reversible).</p><h3>It’s “Enhanced React”</h3><p>Next.js has React inside it. You basically write React with a thin layer of Next.js framework around it. Making the transition easy and keeping most of your React expertise value.</p><p>There’s no need to learn a completely new technology from scratch.</p><h3>A Framework, Not A Library</h3><p>Unlike React, Next.js gives you a full stack and methodology to work with. Although some parts are interchangeable, the solution is somewhat holistic. This brings better standardization and allows for a much better scaling-up experience. For many, this is the real downside of vanilla React — it can never exist on its own, and it creates a jungle of some badly design architectures, without clear and standard best practices.<br>Even React has on its main page this quote:</p><blockquote>“<em>React is a library. It lets you put components together, but it doesn’t prescribe how to do routing and data fetching. To build an entire app with React, we recommend a full-stack React framework like Next.js or Remix.</em>”</blockquote><h3>Technological Readiness</h3><p>Next.js is not like JSP or ASP. It’s a new-generation technology that does a lot for you. Unlike a regular MPA, the development experience is much more fluid and automatic, reducing the boilerplate code and letting you focus on what’s important. This wasn’t possible with SPAs and earlier MPAs.</p><h3>Things to consider</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a9bKJrqyCT53eJaOdcOVtg.jpeg" /><figcaption>Photo by Alotrobo</figcaption></figure><h3>Hydration Errors</h3><p>Hydration errors are caused after nextjs bundles the SSR code and while it expects to render something, a whole different thing is rendered on the client side.</p><ol><li>You can either solve the actual problem (which is usually important, like a provider up the chain that couldn’t prefetch data, for example).</li><li>Suppress them using suppressHydrationWarning (this is an element prop)</li><li>Or even turn off the SSR for the relevant components (I don’t recommend this), by using:</li></ol><pre>const MyComponent = dynamic(() =&gt; import(&#39;../components/MyComponent&#39;), { ssr: false })</pre><h3>Window Does Not Exist Error</h3><p>This usually happens because the client side is exposed to different things like window, document, local/session storage, etc — that are not exposed to the server. If your client component includes such things, an error that “window is undefined” will pop up while building. This can be addressed in several ways:</p><ol><li>Unlike !window, this will not produce an error:</li></ol><pre>typeof window !== &#39;undefined&#39;</pre><p>2. useEffect — code in a useEffect is client-only and doesn’t produce this error.</p><h3>Two Debuggers Required</h3><p>Unlike a SPA, which you debug on the browser only, a Next.js application has 2 parts — the client code, which you debug as usual using your browser developer tools — and a Node server, which you need to debug separately. Since the stitching together of client and server is done semi-automatically by Next.js, it’s sometimes harder to orient yourself, but this should improve with enough experience.</p><h3>Caching and Optimizations on Production Build Only</h3><p>When developing you will not enjoy some of Next.js most prominent features, which are aimed to dramatically speed up the application. This is probably to speed up build time during each change in development, but still — the application feels much slower in development than it will on production.</p><h3>Fetch for Caching</h3><p>It is also important to note that Next.js monkey-patched the native fetch for caching. This means that if you don’t use fetch, you won’t be able to enjoy a part of the caching done by Next.js. There are some solutions for Axios users that use <a href="https://tanstack.com/query/latest/docs/framework/react/guides/ssr">Tanstack Query</a>, and also some (experimental) solutions for <a href="https://github.com/apollographql/apollo-client-nextjs">Apollo GraphQL</a>.</p><h3>Bundling Time</h3><p>For some reason, It’s very rarely mentioned, but for every page you ask, the Next.js bundles its content for you. This is done 17 times faster than a regular JS transpiler, as Next.js is using a SWC, but it still takes a bit on the first time.</p><h3>Client Component Props</h3><p>If you mark a component as “use client” and it is placed in a server component, it is expected that all the props of that component can be serialized. This is because in Next.js components are data — and these props are serialized to the client side. Therefore, the value of the props for these specific components can’t be functions (for example user interaction handlers like onClick), or non JSON objects (like objects that have a different prototype than Object, for example).</p><h3>Black Boxed Magic</h3><p>Some of the behaviors are heavily encapsulated within the framework, so it is harder to drill down to the root cause. Also, some code will already be heavily obfuscated when it reaches the browser.</p><p>This is the price you pay for the magic Next.js does for you, which is quite powerful.</p><h3>Excellent Clean Slate Experience Vs Conversion</h3><p>If you’re starting a new project- starting with Next.js is a no-brainer. The experience is very clean and streamlined.</p><p>However, if you are converting from an existing React project, the conversion might pose some challenges, as there are many moving parts in a React tech stack — and not all of them are Next.js ready from the box. It is, however, a feasible step. Take note that every major technological conversion is a challenge, for example — from a single repo to Nx.</p><h3>Why Now?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*JS5RBDACXpsxMILP" /><figcaption>General Adoption Curve</figcaption></figure><p>To the best of my knowledge and for the time this is written, Next.js is currently in the <strong>early majority</strong> phase of the adoption curve.</p><p>This is a good timing to get into a frontend technology — you get fewer bumps than the innovators and early adopters and you get the most of out of the lifespan of the technology.</p><p>Next.js offers benefits that are well above what previous SSR technologies used to offer.</p><p>It is also positioned in the best position to inherit the current undisputed ruler of the frontend — React.</p><p>As with any technological choice, it is a choice that bears risks and rewards.</p><p>Saying that I believe that the risks are manageable and the rewards are great. More than that - taking no action at this phase will be missing an opportunity to adopt a promising technology at the optimal time to adopt it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19921874cb99" width="1" height="1" alt=""><hr><p><a href="https://medium.com/israeli-tech-radar/why-next-js-why-now-19921874cb99">Why Next.js, Why Now?</a> was originally published in <a href="https://medium.com/israeli-tech-radar">Israeli Tech Radar</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fear Driven Development]]></title>
            <link>https://medium.com/israeli-tech-radar/fear-driven-development-c6b427521f14?source=rss-f090ede3e53c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6b427521f14</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[full-stack]]></category>
            <dc:creator><![CDATA[Roy Kass]]></dc:creator>
            <pubDate>Mon, 17 Jun 2024 14:31:45 GMT</pubDate>
            <atom:updated>2024-06-23T14:23:19.933Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Why Frontend Tech Choices Are Not Only Driven By Merit?</em></p><p>How do you choose a Frontend framework or library to work with?</p><p>The truth is, that the frontend business is a very ruthless one:</p><p>It’s either you are aware of the ongoing changes and switch your horse at the right time, or you’ll find yourself on the sidetrack with a dead or barely moving horse.</p><p>“Nonsense!” You might say… well, let me tell you a scary story because you might be in one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u2BsrbGXqyk3zK-vRufbmA.jpeg" /><figcaption>The frontend is scary! (photo by Julia Volk)</figcaption></figure><p>I’m Roy Kass, a Tech leader at <a href="https://www.tikalk.com/">Tikal</a>, with more than 16 years of experience in the Frontend industry.</p><p>Once upon a time, when the frontend industry was very young, there was a marvelous technology named <a href="https://en.wikipedia.org/wiki/Apache_Flex">Adobe Flex</a>. <br>Flex was set upon an infrastructure of <a href="https://en.wikipedia.org/wiki/Adobe_Flash">Flash</a> which used a vector drawing plugin that you install in the browser to operate. Its most prominent version, version 3, was introduced in 2007. It was a revolution — Flex introduced many features that didn’t exist in one place until then, like virtual scrolling, dynamic libraries, full static typing and tree shaking during compilation. Flex developers were the most coveted assets in the industry. Up until Steve Jobs, the CEO of Apple wrote a <a href="https://en.wikipedia.org/wiki/Thoughts_on_Flash">letter</a> saying the Adobe Flash plugin will not be allowed in iOS hardware from now on. As a result, Adobe delivered Flex to the community (it was renamed “Apache Flex”) but kept her plugin as proprietary. This was, in effect, an abandonment of the technology. In 2012, it was quite clear that the technology was on its way to its demise.</p><p>The once highly courted developers of Flex, needed to convert to other technologies, like AngularJS.</p><p>How do I know all this? I was one of those Flex developers. Moving from Flex to HTML5 and AngularJS was a struggle.</p><p>“OK, but that’s just one instance!” you might say.</p><p>Well, this happened again with the move from AngularJS to Angular 2.</p><p>AngularJS reached a certain point where it was too slow and too old. Google created Angular 2 which had breaking changes. You had to decide if you should invest time doing the move, searching for another technology (for example React), or paying the price for staying on a dying horse.<br>I know more than one company that overstayed on AngularJS, causing them to make a tremendous effort at a very late hour to completely change the technology using a micro-frontends approach. Staying was not only hard — it was now a security risk, as the technology was deprecated.</p><p>It happened one more time when we realized Angular 2 (now a few versions ahead) was diminishing in the market due to poor decision-making (a very long Beta with bugs and poor performance for example, many breaking changes and also a black box sort of complexity).</p><p>Soon, React took over the market. Most of the companies were using it.</p><p>Some might argue that it’s because React is simpler to learn and use. Angular enthusiasts would say that it fails on larger scales, where you need a more structured framework.</p><p>It didn’t matter — because eventually the right political decisions were made by Meta (React), which won the market. The discussion between whether to choose React or Angular faded away in time, making React the favorite. Angular is still alive for now, but the community is much smaller than React’s.</p><p>And to all the Angular devotees that shake their heads while reading this — I truly sympathize, as I was one of you.</p><p>I didn’t even mention technologies like JQuery, Ember, Haxe, CoffeeScript and many many more that went down the same path (and there were A LOT of them).</p><p>In the end, those frontend technologies are open-sourced. This means that if the community loses interest, you get less support. The discussion is diverted to the more popular libraries. Your wells of knowledge dry out. In the end, you don’t get updates and there are security issues as well.</p><p>Also — it’s much easier to recruit highly qualified personnel for the more popular technologies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1i0l_at7IbNPMZ1JsfPjqg.jpeg" /><figcaption>POV: using a dead technology</figcaption></figure><p><strong>Fronted technologies don’t live to old age. Adapt on time or pay a dear price.</strong></p><p><em>React is somewhat an anomaly in this sense, and it’s bound to enter a cocoon and rise as NextJS (more to come on that in the following articles).</em></p><p>It’s important for me to say that I do not like this situation. It makes the choices divert from a cold discussion about the merits of a technology to its popularity. Some technologies that are not that popular may be a better choice if you look at their capabilities alone. I also understand how controversial this subject might be.</p><p>But — this “fear-driven choice” is how the Frontend field has been evolving for more than 15 years. Something very substantial needs to change for it to be different — and for the meanwhile, you need to take this consideration as a major one.</p><h3>So How Do You Check a Tech’s Popularity?</h3><p>First, head to <a href="https://npmtrends.com/">NPM Trends</a> and compare the technology you’re interested in with its competition.</p><p>For example, let’s test <a href="https://npmtrends.com/@angular/core-vs-react-vs-vue">React, Angular and Vue</a> (there seems to be a weird “blip” there for Vue at the end of 2022, let’s ignore it, as it must be a bug):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a_DvvAXeKhS-sOLd" /></figure><p>In the graph you can see that React is far ahead of Vue and Angular in terms of downloads. This is a good KPI to know its extent of use.</p><p>Now let’s compare their Github stats: <br><a href="https://github.com/facebook/react"><strong>React</strong></a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yW8F8viOxwB5qBb7" /></figure><p><a href="https://github.com/angular"><strong>Angular</strong></a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1amJ-xEnVdc8RBKh" /></figure><p><a href="https://github.com/vuejs/core"><strong>Vue</strong></a>(core):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P3N6mMplLu6Uz2Lc" /></figure><p>Can you see the pattern?<br>React has much more traffic in all senses — more people are starring, forking and watching it than the 2 others combined!</p><p>Another interesting livability check is seeing when and where were the latest commits (and why).</p><p>This is a good test to see if new code is being inserted into the library, or if is it actually stagnant:</p><p><strong>React:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pg_DOarsOertXpwy" /></figure><p><strong>Angular</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XYB8fx7dZFS8dzRV" /></figure><p><strong>Vue</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X8_8EvU7NvPDjDWR" /></figure><p>The best case we’re looking for is days. We can even settle for a few weeks up to 1–3 months. If you start seeing 4+ months, it means there’s a problem with the maintenance of this library.</p><p>In this case, while all of them are alive according to the latest commits (1–2 days ago), It’s quite clear that React is leading with popularity over Vue and Angular in all other aspects. <br>Does it mean it’s absolutely better in every sense? <strong>No</strong>.</p><p>But is this a major consideration? In the Frontend world — <strong>the answer is an echoing YES</strong>.</p><p>When examining frontend technologies, even smaller ones like a Component library system or even a single component — make sure the one you choose is as alive and popular as possible.</p><p>As long as popularity remains a major KPI for the survivability and sustainability of Frontend technologies, this should be a major consideration when selecting a technology to work with.</p><p>Choose the most lively ones because a dead or dying horse will not get you far — and if you’re on the 2nd or 3rd in popularity, then keep checking for livability and popularity periodically. That said, it’s all eventually an educated bet. Some surprises may create sudden shifts — just stay alert for them.</p><p>In the next article, I will show why NextJS might be the next horse you should pick.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qH2rX2JVs5TdaEhnzsEvPA.jpeg" /><figcaption>Choosing the winning horse is a wise bet in frontend</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6b427521f14" width="1" height="1" alt=""><hr><p><a href="https://medium.com/israeli-tech-radar/fear-driven-development-c6b427521f14">Fear Driven Development</a> was originally published in <a href="https://medium.com/israeli-tech-radar">Israeli Tech Radar</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[There’s a disease festering in your code — and it could reach a terminal state.]]></title>
            <link>https://medium.com/israeli-tech-radar/theres-a-disease-festering-in-your-code-and-it-could-reach-a-terminal-state-87607b85278f?source=rss-f090ede3e53c------2</link>
            <guid isPermaLink="false">https://medium.com/p/87607b85278f</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[management-and-leadership]]></category>
            <category><![CDATA[trends]]></category>
            <category><![CDATA[tech-debt]]></category>
            <dc:creator><![CDATA[Roy Kass]]></dc:creator>
            <pubDate>Tue, 23 May 2023 11:19:29 GMT</pubDate>
            <atom:updated>2023-05-23T11:19:29.150Z</atom:updated>
            <content:encoded><![CDATA[<h3>There’s a disease festering in your code — and it could reach a terminal state</h3><h3>It’s called technical debt</h3><p>What would happen if you take a loan from a loan-shark, but when payday comes, you just take another loan?</p><p>The price will eventually become unbearable.</p><p>What will happen if you never clean your home and just add more furniture and items to it?</p><p>The price of negligence becomes heavier as time progresses.</p><p>It’s the same with your code.</p><p>If you keep adding features and never take care of your technical debt — eventually you’ll end with a huge pile of messy, unmanageable code. Every feature will have a high price — both anticipated and not anticipated (AKA bugs). According to recent studies, companies pay on average 20%-40% of their development time dealing with issues that are related to tech debt.</p><p>Is this treatable? Yes.</p><p>Is it difficult to treat? Yes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m0pugMhTEGut1PZtuDp2vw.jpeg" /><figcaption>A Plague Doctor (Photo by Espanto MX)</figcaption></figure><p>Tech debt is a problem that is not always visible or understandable for the R&amp;D managers.</p><p>The sales team is selling, the product needs more features, and now is not the time for maintenance.</p><p>But in truth, this needs to be managed and understood, now.</p><p>And luckily, there’s an iterative process that can help you identify, manage and ultimately solve the problem in an ongoing manner. Let’s do it step by step:</p><h3>Identify The Problem</h3><p>We, as the R&amp;D, can’t fight an invisible enemy. We need to map out our tech debt.</p><p>The developers are usually aware of the pain points when developing new features.</p><p>They know that adding code to a certain part will be shaky, they know that their CI/CD is slow (or nonexistent). Maybe they’re missing parts of the process like PRs or some tool to help them abide standards like a lint tool.</p><p>The developers know.</p><p>So the first step would be discussing the tech debt with them.</p><p>Triage your tech debt: What’s missing? What’s wrong? What needs refactoring? Where do we miss infrastructure? What code duplications are common?</p><p>Don’t disregard or dismiss things casually. Trust the process to keep the important things solved first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QFrhdWdAeyOg5YGQCI26rA.jpeg" /><figcaption>Identify the problem! (Photo by Artem Podrez)</figcaption></figure><h3>Create Tickets</h3><p>For each item you identified, create a ticket in your ticket system.</p><p>Some tickets will be more like an (in agile terms) “epic” and some more like a “story” or a “task”.</p><p>Rough scoping is important for identifying quick wins later on.</p><p>Try to be detailed enough when creating the tickets, so that you’re ready for the next step.</p><h3>Put a Price Tag On It</h3><p>Ballpark estimates for each ticket will help you understand if a certain tech debt ticket will take a lot of time, or if it’s a quick win that you can get value from.</p><p>The price is the effort invested in the ticket in story points, hours or days — whichever measure you use for product features.</p><p>We are creating a system here, in which technical items hold their place and values among other tickets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H4kDQAjEA7UBxD6yOdtG1A.jpeg" /><figcaption>Price it!</figcaption></figure><h3>Prioritize</h3><p>Now we order the tickets by priority.</p><p>It’s important to note — the priority here is the priority of the developers, not the product.</p><p>Why? Because they know what makes it hard for them — and it’s their time.</p><p>High value — low cost tickets are the most valuable ones, and should get the highest priority. Sometimes a small change could speed up everything in the process, for example:</p><p>Common patterns that are written in the code with small to medium variations could be written once and reused.</p><p>Developer experience is affected by the process and its tools — add a linter, create code snippets, use generators, write unit tests, e2e tests (end to end), create a system of mocks, etc.</p><p>Discuss the priority in the most objective manner possible.</p><h3>Allocate Time</h3><p>The most dire problem with tech debt in the industry, is that its time is not protected enough.</p><p>This is the most crucial part of owning and solving the problem — if you don’t allocate time specifically for your tech debt, you just won’t get to do it.</p><p>The standard is 20%. This could be a day a week (per developer), 2 days of a 10 day sprint, a week out of 5 weeks, etc.</p><p>Fixing product bugs is not tech debt. A common mistake is to allocate time for bugs and tech debt. It usually results in fixing bugs only, not leaving time for the tech debt. Don’t mix the two.</p><p>Communicate the allocated time to all stakeholders. Everyone should know that during this time the developers are occupied closing tech debt tickets.</p><p>If managers don’t allocate the time, the whole process will collapse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JVBhRvsQBAkwVquZKmU4Cw.jpeg" /><figcaption>Allocate time! (Photo by Giallo)</figcaption></figure><h3>Start Closing Tickets</h3><p>Now we have the problem visible, its solutions written, priced and prioritized.</p><p>We can now act and start closing our tech debt.</p><p>Allocate developers to the prioritized ticket — Mind their cost.</p><p>Let the developers estimate it better — this could change the priority.</p><p>In this phase sometimes the product and development negotiate on the urgency of a certain ticket, because this part needs a feature soon and the tech debt might “freeze” it for too long.</p><p>Negotiating this is ok, as long as the ticket, which has priority, returns right after — and we don’t create a pattern of postponing tickets indefinitely. This needs to be managed closely.</p><h3>Rinse and Repeat</h3><p>Taking care of the tech debt never ends. It’s an ongoing process, just like developing product features. This means you open a ticket every time you see a need for a cleanup, maintenance, infrastructure, etc. Every week/sprint — you prioritize your tech debt backlog again. Then you allocate time for it and close those tickets.</p><p>This way you keep your tech debt in check, your application healthy and your velocity optimal.</p><h3>A Few Final Words</h3><p>Some people will read this and tell themselves — “this is too much work”.</p><p>But from my 15 years of experience, which include being a tech lead for most of the time and also several years of being a team leader of teams varying in size (2–12),</p><p>I can testify that I have seen it happen almost always: negligence of the tech debt will always return to bite the company eventually — and “eventually” comes faster than you think.</p><p>You’re already paying the price, so it’s better to take the initiative rather than being reactive and putting out ever incrementing “fires”.</p><p>There’s no escaping this — quick and dirty is a losing game.</p><p>Choose to win.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MMMTQHWCa5BPsivhBDIZTw.jpeg" /><figcaption>Win!</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87607b85278f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/israeli-tech-radar/theres-a-disease-festering-in-your-code-and-it-could-reach-a-terminal-state-87607b85278f">There’s a disease festering in your code — and it could reach a terminal state.</a> was originally published in <a href="https://medium.com/israeli-tech-radar">Israeli Tech Radar</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Emotional with EmotionJS]]></title>
            <link>https://medium.com/israeli-tech-radar/getting-emotional-with-emotionjs-c897992df68d?source=rss-f090ede3e53c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c897992df68d</guid>
            <category><![CDATA[theming]]></category>
            <category><![CDATA[css-in-js]]></category>
            <category><![CDATA[emotionjs]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Roy Kass]]></dc:creator>
            <pubDate>Sun, 20 Jun 2021 08:46:55 GMT</pubDate>
            <atom:updated>2021-06-20T08:46:55.976Z</atom:updated>
            <content:encoded><![CDATA[<p>For the past few years I work for Tikal — a consulting company providing premium consulting services to Hi Tech companies. My area of expertise is building large scale, production ready Frontend applications.</p><p>Lately I have been doing consulting for a client that uses EmotionJS as their styling technology. They needed to set a <a href="https://en.wikipedia.org/wiki/Design_system">design system</a>, so I chose to use the theming mechanism that Emotion offers.<br>From this point on, unforeseen challenges and adventures awaited me, in this unexplored land of Emotion.</p><p><strong>What is Emotion?</strong></p><p>So first, as I do with every technology I start working with, I did a little research about Emotion:</p><p><a href="https://emotion.sh/">Emotion</a> is a CSS-in-JS alternative to <a href="https://styled-components.com/">styled components</a>. It claims to have the features of styled components, but takes a more “CSS” like approach as its main guideline. This is attractive to people that don’t like the component decoration approach of styled components and prefer the “good old” CSS way of writing.</p><p>My Client chose Emotion exactly for this reason.</p><p><strong>What is theming?</strong></p><p>I already did theming before, so the idea was clear to me, but the fashion that it’s done is dependent on the technology it uses. Let’s go over what theming is:</p><p>Theming is the ability to have a “theme”, which basically is a collection of constants. Usually, it holds things like hex colors, padding sizes, typography (font sizes, weights, font family names), etc…</p><p>Those constants are used throughout the system rather than writing the same thing over and over again. It creates a single point of change throughout the system, easily experimenting and changing them on the go.</p><p>The main advantage of using a theme as part of a css-in-js library, is that you can swap themes. From light mode to dark mode, and even color blind mode, or themes that have a larger font for people with vision impairments.</p><p><strong>What is the basic syntax of Emotion?</strong></p><p>So now, knowing the direction I’m heading and the technology I’m using, I needed to get my hands dirty. So I learned how to write the two main parts that usually a styling technology needs- the styling itself and its integration with the code. Let’s go through the basics:</p><p>Emotion uses JSX Pragma.</p><p>There are several ways to use it, but this is the primary one (and the one I used):</p><p>First I wrote the style:</p><pre>// style.js<br>/** @jsx jsx */<br>import { css, jsx } from &#39;@emotion/react&#39;</pre><pre><em>const </em>style = css`<br>  width: 100%;<br>  height: 100%;<br>  div {<br>    background-color: deepskyblue;<br>  }<br>`;</pre><p>Then I used it via the css property in the code:</p><pre>// MyComponent.jsx<br>/** @jsx jsx */<em><br>import </em>{ jsx } <em>from </em>&#39;@emotion/react&#39;;<br>import style from &#39;./style&#39;;</pre><pre><em>const </em>MyComponent = props =&gt; (<br>  &lt;div <em>css</em>={style}&gt;<br>    &lt;div&gt; I&#39;m deep sky blue&lt;/div&gt;<br>  &lt;/div&gt;<br>);</pre><p>Now, with these basics in my toolbox, I was ready to take on the design system, without the theming for now. Unfortunately, I stumbled across the raw part of Emotion, which is its utilization of pragma…</p><p><strong>So when did it get emotional? (Pun intended)</strong></p><p>Emotion is mostly production ready and it has all the abilities of styled components, including their <a href="https://emotion.sh/docs/styled">version of styled components</a>.</p><p>Now, that sounds easy to manage, doesn’t it? <strong>NOT</strong>.</p><p>There are, unfortunately, a few quirks:</p><p>Their pragma handling is very raw. I found myself writing this like in every file that used the Emotion css prop:</p><pre>/** @jsx jsx */<br>import { jsx } from &#39;@emotion/react&#39;;</pre><p>That in combination with React 17 and Create React App 4 caused a runtime problem:</p><blockquote>“SyntaxError: pragma and pragmaFrag cannot be set when runtime is automatic.”</blockquote><p>Which, after some research, forced me to use this:</p><pre><em>/** </em><strong><em>@jsxImportSource </em></strong><em>@emotion/react */<br>import </em>React <em>from </em>&#39;react&#39;;</pre><p>This is explained <a href="https://emotion.sh/docs/css-prop">here</a>:</p><blockquote>“If you are using a zero-config tool with automatic detection of which runtime (classic vs. automatic) should be used and you are already using a React version that has <a href="https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html">the new JSX runtimes</a> (hence runtime: &#39;automatic&#39; being configured automatically for you) such as Create React App 4 then /** @jsx jsx */ pragma might not work and you should use /** @jsxImportSource @emotion/react */ instead.”</blockquote><p>They also suggest a babel preset alternative, which didn’t solve the problem:</p><pre>{<br>  &quot;presets&quot;: [<br>    [<br>      &quot;@babel/preset-react&quot;,<br>      { &quot;runtime&quot;: &quot;automatic&quot;, &quot;importSource&quot;: &quot;@emotion/react&quot; }<br>    ]<br>  ],<br>  &quot;plugins&quot;: [&quot;@emotion/babel-plugin&quot;]<br>}</pre><p>I must admit I struggled with it quite a lot, <strong>wasting a lot of time</strong>.</p><p>Another problem was passing props. Unlike the syntax in <strong>styled components</strong> that goes like this:</p><pre><em>const </em>Button = styled.button`  <br>  background: ${props =&gt; props.primary ? &quot;blue&quot; : &quot;white&quot;};<br>`;</pre><p>There are no changes needed in the component itself.</p><p>Emotion offers a much poorer implementation:</p><pre><em>const </em>style = props =&gt; css`<br>  background: ${props =&gt; props.primary ? &quot;blue&quot; : &quot;white&quot;};<br>`;</pre><p>And then pass the props like this:</p><pre><em>const </em>MyComponent = props =&gt; (<br>  &lt;div <em>css</em>={style(props)} /&gt;<br>);</pre><p>So I had to make do with both restrictions, passing the props with a function and using the notorious <strong><em>jsxImportSource </em></strong>comment to complete the task. Now, all that remained is to figure out how to do the theming part.</p><p><strong>How did the theming go?</strong></p><p>Surprisingly, unlike the problems I just described, the theming went perfectly.</p><p>I wrote the theme:</p><pre><em>const </em>theme = {<br>  colors: {<br>    primary: blue,<br>    success: green,<br>  }<br>}</pre><p>The I wrapped my application with a theme provider:</p><pre><em>/** </em><strong><em>@jsxImportSource </em></strong><em>@emotion/react */<br>import </em>React <em>from </em>&#39;react&#39;;<br><em>import </em>{ ThemeProvider } from &#39;@emotion/react&#39;;<br><em>import theme from &#39;./theme&#39;;</em></pre><pre><em>const </em>ThemedApp = props =&gt; (<br>  &lt;ThemeProvider <em>theme</em>={theme} &gt;<br>    &lt;App/&gt;<br>  &lt;/ThemeProvider&gt;<br>);</pre><p>and then I could use it <strong>with any component down the tree</strong> like this:</p><pre><em>import ...</em></pre><pre><em>const </em>buttonStyles = theme =&gt; css`<br>  background-color: ${theme.primary};<br>`;</pre><pre><em>const </em>Button = props =&gt; {<br>  &lt;button <em>css</em>={buttonStyles}&gt;Press Me!&lt;/button&gt;<br>};</pre><p>Notice there’s no hook or HOC that needs to be written here manually (<a href="https://emotion.sh/docs/theming#usetheme">although Emotion offers them as well</a>).</p><p>Now I knew all I needed to get this show running and I wrote the design system with theming to completion.</p><p><strong>What’s the final conclusion?</strong></p><p>My final take on Emotion is that it still has a few gaps to complete before it truly can compete with Styled Components on the same level.</p><p>Nevertheless, if you feel more aligned with the css traditional way of writing (rather than the styled components way), you are willing to struggle a bit with the pragma and you don’t mind the props handling — then Emotion is production ready for you and is a viable alternative.</p><p>It also offers the usual perks like <a href="https://emotion.sh/docs/nested">nesting</a>, <a href="https://emotion.sh/docs/composition">composition</a>, and I also used <a href="https://emotion.sh/docs/globals">Global styles</a>.</p><p>I’m quite certain that in less than a year from now, Emotion could stand as the alternative it wants to be.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c897992df68d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/israeli-tech-radar/getting-emotional-with-emotionjs-c897992df68d">Getting Emotional with EmotionJS</a> was originally published in <a href="https://medium.com/israeli-tech-radar">Israeli Tech Radar</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>