<?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 Arthur Groupp on Medium]]></title>
        <description><![CDATA[Stories by Arthur Groupp on Medium]]></description>
        <link>https://medium.com/@groupp?source=rss-36323d407b05------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oAUpk8a_cXHnpNhUdnS6fA.png</url>
            <title>Stories by Arthur Groupp on Medium</title>
            <link>https://medium.com/@groupp?source=rss-36323d407b05------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 06:54:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@groupp/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[Mastering Angular’s httpResource: Why Services Beat Components]]></title>
            <link>https://medium.com/@groupp/mastering-angulars-httpresource-why-services-beat-components-7143619d0440?source=rss-36323d407b05------2</link>
            <guid isPermaLink="false">https://medium.com/p/7143619d0440</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Arthur Groupp]]></dc:creator>
            <pubDate>Thu, 04 Sep 2025 07:42:04 GMT</pubDate>
            <atom:updated>2025-09-04T07:42:04.816Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DXJjGlogQ-xxTe-xZ0ilqw.png" /></figure><p>Data fetching has always been a tricky balancing act in Angular:<br>Where should the logic live — inside the component or abstracted elsewhere?</p><p>With the introduction of `httpResource`, this question is more relevant than ever. `httpResource` provides a <strong>reactive, signal-driven approach to working with HTTP calls</strong> — but if misused, it can quickly entangle business logic with UI code.</p><p>In this article, we’ll explore what `httpResource` does, the temptation of in-component usage, and why <strong>service-based abstraction</strong> is the key to maintainable, scalable applications.</p><h3>Why `httpResource` Matters</h3><p>At its core, `httpResource` is a reactive wrapper around Angular’s `HttpClient`.<br>Instead of manually subscribing to Observables, `httpResource` integrates seamlessly with the signals ecosystem — meaning its results can be consumed by `computed`, `effect`, `linkedSignal`, or directly in templates.</p><p>Some key properties:</p><ul><li><strong>Eager execution</strong>: Unlike `HttpClient`, which only fires on subscription, `httpResource` eagerly triggers requests when its reactive dependencies change.</li><li><strong>Automatic cancellation</strong>: If dependencies change mid-request, the in-flight request is canceled and a new one is issued.</li><li><strong>Full `HttpClient` support</strong>: Interceptors and all other features still apply.</li></ul><p>Example of a simple reactive resource:</p><pre>userId = input&lt;string&gt;();<br>user = httpResource(() =&gt; `/api/user/${userId()}`);</pre><p>Whenever `userId` changes, a fresh request is dispatched automatically.</p><h3>The Temptation: Quick In-Component Usage</h3><p>The most straightforward way to use `httpResource` is directly in a component:</p><pre>@Component({ /* … */ })<br>export class MyUserComponent {<br> userId = input&lt;string&gt;();<br> userResource = httpResource(() =&gt; `/api/user/${this.userId()}`);<br>}</pre><p>It works — but this convenience comes at a cost.</p><p>By mixing data-fetching logic into the component:</p><ul><li>You violate <strong>single responsibility</strong> — components should focus on rendering and interaction, not on orchestrating HTTP calls.</li><li>Business logic becomes scattered and harder to reuse.</li><li>Testing gets messy: mocking component state and HTTP behavior together is more complex.</li></ul><p>For tiny apps or prototypes, this pattern might be acceptable. However, in real-world applications, it creates tight coupling and long-term maintenance headaches.</p><h3>The Better Way: Abstract `httpResource` into Services</h3><p>A cleaner approach is to define `httpResource` inside dedicated services, not components.</p><p>This service-based pattern offers several advantages:</p><ul><li><strong>Separation of concerns</strong>: Components stay UI-focused while services handle data logic.</li><li><strong>Reusability</strong>: Multiple components can consume the same resource logic.</li><li><strong>Simpler testing</strong>: Service logic can be tested independently of UI behavior.</li><li><strong>Consistency</strong>: Teams can share and maintain standardized resource definitions.</li></ul><h4>Example: Service-Based Resource</h4><pre>// user.service.ts<br>@Injectable()<br>export class UserService {<br> // A shared resource for all consumers<br> readonly usersResource = httpResource(() =&gt; `/api/users`);<br><br> // Factory method for reactive user fetching<br> createUserResource($userId: Signal&lt;string&gt;) {<br>  return httpResource(() =&gt; (<br>   $userId() ? `/api/user/${$userId()}` : undefined<br>  ));<br> }<br>}<br><br>// user-details.component.ts<br>@Component({ /* … */ })<br>export class UserDetailsComponent {<br> readonly userId = input&lt;string&gt;();<br> readonly #userService = inject(UserService);<br> readonly userResource = this.#userService.createUserResource(this.userId);<br>}</pre><h3>When Might In-Component Be Okay?</h3><p>To keep this balanced:</p><ul><li><strong>Demos, prototypes, or playgrounds</strong> — quick feedback matters more than clean architecture.</li><li><strong>Truly one-off fetches</strong> — where introducing a service would be unnecessary overhead.</li></ul><p>But beyond these cases, service abstraction almost always pays off.</p><h3>Conclusion: Future-Proof Your Angular Apps</h3><p>Angular’s `httpResource` is a big step forward for reactive data fetching. But its power can become a liability if used naively inside components.</p><p>By moving your resource definitions into services, you get:</p><ul><li>Cleaner components</li><li>Reusable data logic</li><li>Easier testing and scaling</li></ul><p>👉 Next time you reach for `httpResource`, ask: <em>“Should this live in a component — or does it belong in a service?”</em><br>Chances are, the service wins.</p><p>This simple shift will prepare your codebase for growth, teamwork, and the evolving Angular ecosystem.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7143619d0440" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Effective Debouncing in Angular: Keep Signals Pure]]></title>
            <link>https://medium.com/@groupp/effective-debouncing-in-angular-keep-signals-pure-703eb105a495?source=rss-36323d407b05------2</link>
            <guid isPermaLink="false">https://medium.com/p/703eb105a495</guid>
            <category><![CDATA[signal]]></category>
            <category><![CDATA[reactive-programming]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Arthur Groupp]]></dc:creator>
            <pubDate>Tue, 10 Jun 2025 14:23:56 GMT</pubDate>
            <atom:updated>2025-06-10T14:23:56.507Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4gRFq03xtZ6nvWtI1z3jJw.png" /></figure><h3><strong>Introduction</strong></h3><p>Debouncing is a foundational technique in front-end development, especially when working with high-frequency events like user input. It helps control the rate of function calls, ensuring that performance-intensive operations — such as server requests — don’t trigger excessively as users interact with the UI. A classic example is a search bar: as the user types, the application waits until they’ve paused before sending a request to fetch matching results. Another familiar case is an autocomplete panel, where each keystroke could theoretically initiate a query — but shouldn’t.</p><p>In Angular applications, especially those using the new reactive primitives introduced with Signals, developers often ask: <em>“How do I debounce a signal?”</em> At first glance, this might seem like a natural extension of reactive programming. However, applying debounce logic <strong>directly</strong> to Angular signals is fundamentally flawed.</p><p>The key reason is that <strong>Angular signals are not streams but value containers</strong>. While RxJS streams represent a sequence of values over time, signals represent the latest value at any given point. Treating signals like streams and attempting to debounce them leads to convoluted patterns, subtle bugs, and a misunderstanding of their core design.</p><h3>Why Debouncing a Signals Directly Is an Antipattern</h3><p>To understand why debouncing a signal is an antipattern, we need to be clear about what Angular signals are — and what they aren’t.</p><p>A <strong>signal</strong> in Angular is a reactive value. It reflects the current state of something at a given point in time. When the value changes, any consumers get the notification and react accordingly. But the signal itself doesn’t represent the <em>timeline</em> of changes — just the <em>current</em> one.</p><p>This signal definition makes signals conceptually very different from <strong>streams</strong>. Like an RxJS Observable, a stream represents a sequence of values emitted over time—each “next” call pushes a new event downstream. This distinction is critical: <strong>debounce is a time-based operator designed for streams, not values</strong>.</p><p>Let’s look at a misguided example:</p><pre>const $query = signal(&#39;&#39;);<br>const $debouncedQuery = debounce($query, 300);</pre><p>The idea here might be to create a delayed computed version of the $query , but this violates the nature of a signal. The $debouncedQuery would now be a hybrid: not a clean, synchronous signal, but something pretending to behave like a stream. Even if you implemented a custom workaround (e.g., using setTimeout inside a computed), you’d lose predictability:</p><ul><li>You can’t <em>cancel</em> pending debounce timers when the component is destroyed.</li><li>This introduces async lag into a system designed for synchronous propagation.</li><li>This confuses future maintainers who expect signals to be immediate and synchronous.</li></ul><p>Furthermore, applying debounce inside a computed() or effect() makes the timing logic entangled with rendering logic, which is a recipe for complexity and bugs.</p><h3>The Solution</h3><p>Debounce needs to sit <em>before</em> the signal, not <em>inside</em> or <em>on</em> it. Signals result from some input; they should reflect the already-processed (i.e., debounced) value. Trying to bolt debounce onto a signal treats it like an observable stream, which it simply isn’t.</p><p>Rather than trying to debounce a signal, let’s debounce the <strong>source</strong> of the values — usually a DOM event or user interaction — <em>before</em> updating the signal. This preserves the core philosophy behind signals: they reflect the current value of the state without embedding time-based logic.</p><h3>Enough theory. Let’s code.</h3><p>Let’s walk through how we can implement ideas from above in the example of the input that delivers the search term for further API calls.</p><p>First things first, let’s implement the initial setup that will allow us to type and see what we are typing.</p><pre>@Component({<br>  selector: &#39;app-root&#39;,<br>  template: `<br>    &lt;input type=&quot;search&quot; name=&quot;q&quot; /&gt;<br><br>    &lt;p&gt;Search Term: {{ $query() }}&lt;/p&gt;<br>  `,<br>})<br>export class App {<br>  readonly $query = signal(&#39;&#39;);<br>}</pre><p>We certainly will see nothing now in the results paragraph, but it’s a good start we need.</p><p>The next step will be to create the directive that will decorate the &lt;input&gt; HTML element.</p><pre>@Directive({<br>  selector: &#39;[debounceTime]&#39;,<br>})<br>export class Debounce {<br>  readonly value = model&lt;string&gt;();<br>}</pre><p>And apply it to the input element of the App component. Don’t forget to import it.</p><pre>&lt;input type=&quot;search&quot; name=&quot;q&quot; debounceTime [(value)]=&quot;$query&quot; /&gt;</pre><p>As you can see, we have already bonded the query to the value model of the directive.</p><p>Let’s implement the handler for the input event of the directive host and the value binding.</p><pre>@Directive({<br>  selector: &#39;[debounceTime]&#39;,<br>  host: {<br>    &#39;[value]&#39;: &#39;value()&#39;,<br>    &#39;(input)&#39;: &#39;handleInput($event.target.value)&#39;,<br>  },<br>})<br>export class Debounce {<br>  readonly value = model&lt;string&gt;();<br><br>  handleInput(value: string): void {<br>    this.value.set(value);<br>  }<br>}</pre><p>Starting now, our directive functions like a proxy setting and receives value from the host, allowing us to see the search term as we type.</p><p>It&#39;s time for the real stuff. Let’s implement the debouncing mechanism in the directive.</p><pre>@Directive({<br>  selector: &#39;[debounceTime]&#39;,<br>  host: {<br>    &#39;[value]&#39;: &#39;value()&#39;,<br>    &#39;(input)&#39;: &#39;handleInput($event.target.value)&#39;,<br>  },<br>})<br>export class Debounce {<br>  #debounceTimer?: ReturnType&lt;typeof setTimeout&gt;;<br><br>  readonly debounceTime = input(0, { transform: numberAttribute });<br>  readonly value = model&lt;string&gt;();<br><br>  handleInput(value: string): void {<br>    clearTimeout(this.#debounceTimer);<br><br>    if (!value || !this.debounceTime()) {<br>      this.value.set(value);<br>    } else {<br>      this.#debounceTimer = setTimeout(<br>        () =&gt; this.value.set(value),<br>        this.debounceTime()<br>      );<br>    }<br>  }<br>}</pre><p>The code above is pretty straightforward and self-explanatory. The value update is wrapped in the setTimeout function that is being canceled while the user is typing. The debounce time is provided through the directive input. (By the way, does anybody remember efforts to achieve the same with the input and RxJS pipe?)</p><p>Now, we need to add the debounce time to the input attribute in milliseconds, and we are done.</p><pre>&lt;input type=&quot;search&quot; name=&quot;q&quot; debounceTime=&quot;300&quot; [(value)]=&quot;$query&quot; /&gt;</pre><p>If the user will type now, the search term will be debounced by 300 milliseconds. You can see that in the search term paragraph.</p><h3>Conclusion</h3><p>Debouncing remains essential for improving performance and user experience, particularly when handling high-frequency user inputs in Angular applications. However, it’s crucial to remember that <strong>Angular signals represent state snapshots, not streams of events</strong>, and thus are inherently incompatible with direct debounce operations.</p><p>As demonstrated, the optimal strategy involves applying debounce logic at the source level — typically DOM events or user interactions. This preserves the purity and simplicity of signals, ensuring they remain synchronous, predictable, and free from embedded timing logic.</p><p>The complete code of the example can be found <a href="https://stackblitz.com/edit/stackblitz-starters-ygbyit2n?file=src%2Fmain.ts">here</a>.</p><p>Special thanks to <a href="http://twitter.com/eneajahollari">@eneajahollari</a> for the inspiration to write this article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=703eb105a495" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Signals vs. Observables: Can One Truly Replace the Other?]]></title>
            <link>https://medium.com/bitsrc/signals-vs-observables-can-one-truly-replace-the-other-3c76f799ed15?source=rss-36323d407b05------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c76f799ed15</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[rxjs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Arthur Groupp]]></dc:creator>
            <pubDate>Tue, 29 Aug 2023 03:32:23 GMT</pubDate>
            <atom:updated>2023-08-29T03:32:23.752Z</atom:updated>
            <content:encoded><![CDATA[<h3>Angular Signals vs. Observables: Can One Truly Replace the Other?</h3><h4>Dissecting Angular’s Reactivity: Evaluating the Shift from Observables to Signals.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CuPnGb9AQakdP3poHOpMDw.png" /></figure><p>Angular 16 introduced ‘signals’ which served as a significant addition to the developer’s toolbox, leading to shifts in established practices.</p><p>However, this also sparked confusion among many developers. Some hastily began to convert all observables in their applications to signals, while others did the reverse.</p><p>This article will aim to present an insight on the main differences between signals and observables, and when you should use each concept.</p><h3>Understanding the Basics</h3><p>Before diving into the intricacies, let’s establish some foundational definitions:</p><ol><li><strong>Stream:</strong> A stream is a sequence of asynchronous events or values.</li><li><strong>Signal:</strong> As described in the core team’s RFC, a signal is a wrapper around a value that is capable of notifying interested consumers when that value changes.</li></ol><p>From these definitions, we deduce a critical distinction: while a signal primarily encapsulates a value and can notify subscribers (akin to a stream) about its changes, a stream can represent a sequence of values or even events without an inherent value.</p><p>Consequently, while every signal has the potential to produce a stream, not all streams are supposed to originate from signals.</p><h3>Practical Implications</h3><p>When it comes to state management, signals excel. They allow us to define an initial value, update it as needed, and have the application seamlessly mirror these adjustments in the template.</p><p>However, challenges arise when there’s no initial value, or the value is irrelevant. Consider button clicks as an example. Here, there’s no “initial click,” and the event’s value is usually inconsequential. We’re primarily interested in the event itself. While traditional JavaScript recommends callbacks for such scenarios, RxJS introduced event streams, enhancing flexibility through operator pipelines. Given this context, signals might not be the best fit. Using them to update values that won’t influence outcomes could be seen as misapplying the tool.</p><h3>HTTP Requests: A Unique Stream Scenario</h3><p>HTTP requests are a peculiar kind of stream. They don’t begin with an initial value and emit only once. Promises handle this beautifully. At present, Angular employs RxJS for HTTP operations. While future implementations may differ, there’s little rationale, as of now, for migrating these to signals. Despite its singular emission, an HTTP request remains a stream, not merely a value wrapper.</p><h3>Build composable Angular Appswith reusable components, just like Lego</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Jr8XVof_gDD9sg2M.png" /></figure><p><a href="https://bit.cloud/"><strong>Bit</strong></a><strong> </strong>is an open-source toolchain for the development of composable software.</p><p>With Bit, you can develop any piece of software — a modern web app, a UI component, a backend service or a CLI script — as an independent, reusable and composable unit of software. Share any component across your applications to make it easier to collaborate and faster to build.</p><p><strong>Join the 100,000+ developers building composable software together.</strong></p><p>Get started with these tutorials:</p><h4>→ Micro-Frontends: <a href="https://youtu.be/zBuBlExo3xA">Video</a> // <a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">Guide</a></h4><h4>→ Code Sharing: <a href="https://youtu.be/9vS86xgG3ak">Video</a> // <a href="https://bit.cloud/blog/how-to-reuse-react-components-across-your-projects-l4pz83f4">Guide</a></h4><h4>→ Modernization: <a href="https://www.youtube.com/watch?v=c4X1HkFfq1k">Video</a> // <a href="https://blog.bitsrc.io/modernizing-frontend-applications-a-guide-b0bac99be932">Guide</a></h4><h4>→ Monorepo: <a href="https://www.youtube.com/watch?v=5wxyDLXRho4&amp;t=2041s">Video</a> // <a href="https://bit.dev/blog/painless-monorepo-dependency-management-with-bit-l4f9fzyw/">Guide</a></h4><h4>→ Microservices: <a href="https://youtu.be/5wxyDLXRho4">Video</a> // <a href="https://bit.dev/blog/component-driven-microservices-with-nodejs-and-bit-l64shurc/">Guide</a></h4><h4>→ Design System: <a href="https://youtu.be/YG4kpUXRlG4">Video</a> // <a href="https://blog.bitsrc.io/how-we-build-our-design-system-15713a1f1833">Guide</a></h4><h3>Conclusion</h3><p>The architecture of contemporary Angular applications is undoubtedly evolving, adding layers of complexity. This places a greater onus on developers and architects, compelling them to select patterns whenever they incorporate reactivity judiciously.</p><p>Given the insights provided, when confronted with the choice between signals and observables, consider the nature of the reactive primitive you’re aiming to represent. Discern whether you’re dealing with a state or an event, and let that guide your decision-making process.</p><h3>Read more</h3><ul><li><a href="https://blog.bitsrc.io/top-8-tools-for-angular-development-in-2023-a99d9f3a2e4e">Top 8 Tools for Angular Development in 2023</a></li><li><a href="https://blog.bitsrc.io/sharing-components-at-the-enterprise-12f9e5f1bb67">Sharing Components at The Enterprise</a></li><li><a href="https://blog.bitsrc.io/component-driven-development-and-composable-applications-a-guide-7a0934e60936">Composable Applications and Component-Driven Development: a Guide</a></li><li><a href="https://blog.bitsrc.io/getting-started-with-a-new-angular-project-in-2023-c6ae93facbd6">Getting Started with a New Angular Project in 2023</a></li><li><a href="https://blog.bitsrc.io/componentize-your-react-and-express-apps-with-bit-step-by-step-guide-114939f98479">Componentize Your React and Express Apps with Bit: Step by Step Guide</a></li><li><a href="https://blog.bitsrc.io/the-reusable-revolution-best-practices-for-component-development-da714c9cdaa5">The Reusable Revolution: Best Practices for Component Development</a></li><li><a href="https://javascript.plainenglish.io/micro-frontends-in-react-a-practical-guide-21b7b9773758">Micro Frontends in React: A Practical Guide</a></li><li><a href="https://blog.bitsrc.io/leveraging-microfrontend-architecture-using-bit-components-3cd4d0b1d34e">Leveraging Microfrontend Architecture Using Bit Components</a></li><li><a href="https://blog.bitsrc.io/maximizing-code-reusability-with-bit-and-node-js-aece9eb94496">Maximizing Code Reusability with Bit and Node.js</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c76f799ed15" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitsrc/signals-vs-observables-can-one-truly-replace-the-other-3c76f799ed15">Signals vs. Observables: Can One Truly Replace the Other?</a> was originally published in <a href="https://medium.com/bitsrc">Bits and Pieces</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular: Introduction of Signals for High-Performance Applications]]></title>
            <link>https://medium.com/bitsrc/angular-introduction-of-signals-for-high-performance-applications-4e7aeddcbb62?source=rss-36323d407b05------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e7aeddcbb62</guid>
            <category><![CDATA[reactivity]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Arthur Groupp]]></dc:creator>
            <pubDate>Sat, 08 Apr 2023 17:57:21 GMT</pubDate>
            <atom:updated>2023-04-27T06:51:17.999Z</atom:updated>
            <content:encoded><![CDATA[<h4>With the introduction of signals in Angular 16, developers can now enjoy the benefits of the original Angular design without compromising performance.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V-AfF79wK2Zo5GR7_cEgWQ.png" /></figure><p>The inception of Angular was based on the idea of seamlessly connecting component classes to their respective templates. Through the use of this idea, web application developers were able to create dynamic and responsive user interfaces. Angular created a two-way communication channel that allowed automatic updates whenever changes were made to the component class by binding class properties to elements within the template. With this method, the development process was more straightforward, and the user experience was more interactive and interesting.</p><p>This seamless connection between component classes and their templates was made possible through Angular’s sophisticated change detection system. Angular&#39;s change detection system ensures a consistent and up-to-date user interface by keeping track of changes to component class properties and updating the templates accordingly. This mechanism is essential for maintaining the application&#39;s responsiveness and reactivity, giving users a seamless experience, and making it simple for developers to create dynamic web applications.</p><p>We will examine the presentational component that provides the clock as an illustration of all the ideas discussed in the article.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6a1aef1b3a4ba65305e7dfb02825b03/href">https://medium.com/media/e6a1aef1b3a4ba65305e7dfb02825b03/href</a></iframe><p>You can view the time on a ticking clock using this component.</p><h3>Angular Change Detection</h3><p>Although Angular&#39;s change detection system proved a ground-breaking strategy for seamlessly tying component classes and templates together, it also brought about performance issues, especially in large-scale enterprise applications. As the complexity and size of an application grow, the number of components and bindings increases, leading to a higher demand for resources to execute change detection cycles. As a result, users may experience a less-than-ideal user experience, slower updates, and decreased responsiveness.</p><p>To address these performance issues, Angular introduced several change detection strategies and optimization techniques. By employing the “OnPush” change detection strategy with immutable data structures, developers can significantly reduce the number of unnecessary change detection cycles and improve the overall performance of their applications.</p><p>However, when employing the “OnPush” change detection strategy in our clock component, it will cease to function as expected. This is because the “OnPush” strategy only triggers change detection when there are changes in input properties or when events are emitted from the component. This limitation leads us to explore the use of reactive components.</p><h3>Reactive Components</h3><p>Reactive components employ observables to handle asynchronous data streams, allowing the application to respond to changes efficiently. By utilizing observables in conjunction with the “OnPush” change detection strategy, developers can create highly responsive and efficient components that work seamlessly. This combination enables real-time updates while minimizing the performance impact of frequent change detection cycles, resulting in a more robust and performant application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5daa0c742b760b7d86c723be45aaea36/href">https://medium.com/media/5daa0c742b760b7d86c723be45aaea36/href</a></iframe><p>Over the past few years, this pattern has been used. Let&#39;s think about the issues with it.</p><ol><li>Under the hood, AsyncPipe subscribes to the observable. In other words, if we need to use the same observable more than once in the template, it will subscribe more than once, which will have negative effects.</li><li>The entire component is flagged for &quot;check&quot; by AsyncPipe each time the observable emits a value. Even if you only use it in one element, the template as a whole will be checked again. It will cause useless change detection cycles if you have multiple observables bonded to the template.</li><li>Reactive components violate the original Angular design, which calls for binding component class properties to the template and having the template automatically updated whenever a property changes.</li></ol><h3>Signals</h3><p>As good developers, we were able to find solutions to almost all of the issues mentioned above. But as a result, we added more boilerplate code.</p><p>Starting with version 16, the Angular Core team introduces the new tool, which is intended to address every issue mentioned above.</p><p>The signal is a reactive construct natively built into Angular. Its responsibility is to hold the value and notify consumers when it changes.</p><p>Let’s migrate our clock component to signals.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/199f6f6a6c1828a9ce9e5f091f9a668d/href">https://medium.com/media/199f6f6a6c1828a9ce9e5f091f9a668d/href</a></iframe><p>Note that this new example looks almost the same as the first one. And its change detection strategy is &quot;OnPush.&quot;</p><p>How does it work? What’s the trick? Angular introduces the function &quot;effect.&quot; A callback with a signal is accepted as an argument by this function. The callback is executed by the effect function each time the signal&#39;s value fluctuates. From version 16, templates for components will be wrapped into effect functions. This enables us to go back to the original Angular design and simply bind signal properties to the template without affecting performance.</p><blockquote><em>💡</em> Angular development becomes easier when you can apply a component-driven development approach to them. <a href="https://bit.cloud/"><strong>Bit</strong></a><strong> </strong>makes this easier by providing an <a href="https://bit.dev/blog/introducing-angular-component-development-environment-lfhd699k/"><strong>integrated dev environment</strong></a> (compiler, tester, linter, documentation, CI, dev server, and packaging/dependency management/bundler all-in-one) for building apps with Angular. It enables you to quickly set up a dev environment that follows best practices implemented by the Angular team and projects generated by the Angular CLI.</blockquote><p><strong>Learn more here:</strong></p><p><a href="https://bit.dev/docs/angular-introduction">Introduction to Angular | Bit</a></p><h3>Conclusion</h3><p>Angular has come a long way since its inception, where the idea of seamlessly connecting component classes and templates laid the foundation for dynamic and responsive web applications. While Angular’s change detection system revolutionized the way developers built applications, it also introduced performance challenges in large-scale, complex applications. The introduction of reactive components helped mitigate these issues but also brought their own set of drawbacks.</p><p>The Angular Core team has continued to innovate and address these concerns, and with the introduction of signals in version 16, developers can now enjoy the benefits of the original Angular design without compromising performance. By utilizing the “effect” function and signals, developers can create efficient, responsive components with an “OnPush” change detection strategy, while minimizing boilerplate code and maintaining the simplicity of binding component class properties to templates. This evolution of Angular highlights the framework’s commitment to addressing the ever-changing needs of the web development landscape and providing developers with the tools to create powerful, high-performance applications.</p><h3>Build Angular Apps with reusable components, just like Lego</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*IDXbxWT8AObYYgOq.png" /></figure><p><a href="https://bit.cloud/"><strong>Bit</strong></a><strong>’s open-source tool </strong>help 250,000+ devs to build apps with components.</p><p>Turn any UI, feature, or page into a <strong>reusable component</strong> — and share it across your applications. It’s easier to collaborate and build faster.</p><p><a href="https://bit.dev/docs/angular-introduction#-learn-angular-with-bit-">Introduction to Angular | Bit</a></p><p><strong>→ </strong><a href="https://bit.cloud/teambit/angular/content/angular-overview"><strong>Learn more</strong></a></p><p>Split apps into components to make app development easier, and enjoy the best experience for the workflows you want:</p><h3>→ <a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">Micro-Frontends</a></h3><h3>→ <a href="https://blog.bitsrc.io/how-we-build-our-design-system-15713a1f1833">Design System</a></h3><h3>→ <a href="https://bit.cloud/blog/how-to-reuse-react-components-across-your-projects-l4pz83f4">Code-Sharing and reuse</a></h3><h3>→ <a href="https://www.youtube.com/watch?v=5wxyDLXRho4&amp;t=2041s">Monorepo</a></h3><h3>Learn more:</h3><ul><li><a href="https://blog.bitsrc.io/top-8-tools-for-angular-development-in-2023-a99d9f3a2e4e">Top 8 Tools for Angular Development in 2023</a></li><li><a href="https://bit.dev/blog/introducing-angular-component-development-environment-lfhd699k">Introducing Angular Component Development Environment</a></li><li><a href="https://blog.bitsrc.io/10-useful-angular-features-youve-probably-never-used-e9e33f5c35a7">10 Useful Angular Features You’ve Probably Never Used</a></li><li><a href="https://blog.bitsrc.io/11-top-angular-developer-tools-for-2020-3d2621f1e157">11 Top Angular Developer Tools for 2020</a></li><li><a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">How We Build Micro Frontends</a></li><li><a href="https://blog.bitsrc.io/how-to-share-angular-components-between-project-and-apps-5eb0600d99d2">How to Share Angular Components Between Projects and Apps</a></li><li><a href="https://blog.bitsrc.io/how-we-build-our-design-system-15713a1f1833">How we Build a Component Design System</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e7aeddcbb62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitsrc/angular-introduction-of-signals-for-high-performance-applications-4e7aeddcbb62">Angular: Introduction of Signals for High-Performance Applications</a> was originally published in <a href="https://medium.com/bitsrc">Bits and Pieces</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Rise of AI-generated Art: Debating its Place in the Art World]]></title>
            <link>https://medium.com/@groupp/the-rise-of-ai-generated-art-debating-its-place-in-the-art-world-5c245da38e2e?source=rss-36323d407b05------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c245da38e2e</guid>
            <category><![CDATA[ai-generated-art]]></category>
            <category><![CDATA[modern-art]]></category>
            <category><![CDATA[contemporary-art]]></category>
            <category><![CDATA[art]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Arthur Groupp]]></dc:creator>
            <pubDate>Sun, 05 Feb 2023 16:19:54 GMT</pubDate>
            <atom:updated>2023-02-05T16:20:22.208Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RERJAnc5AhSmzAaoya9FEQ.png" /></figure><h3>Introduction</h3><p>Art is an ever-evolving form of expression that has captivated audiences for centuries. With the advent of technology, the art world has seen a new development: AI-generated art. But what exactly is AI-generated art and how does it fit into the world of art? In this article, we will delve into the exciting world of AI-generated art to better understand what it is and its place in the art world.</p><p>Artificial Intelligence, or AI, has come a long way in recent years. With its ability to process vast amounts of information, it’s no surprise that AI has found its way into the world of art. AI-generated art is the result of algorithms created by artificial intelligence to produce images, paintings, and other forms of art. These algorithms use pre-existing images and often merge them to create a new and unique piece of art.</p><p>The purpose of this article is to explore the exciting world of AI-generated art. I&#39;ll cover everything from its creation to its reception in the art world. I’ll also compare AI-generated art to traditional art forms and explore the ethical considerations that come with this new form of artistic expression. By the end of this article, you’ll have a better understanding of what AI-generated art is and what role it may play in the future of the art world.</p><h3>The Magic of AI-generated Art</h3><p>The magic of AI-generated art lies in its ability to create works of art that are both unique and visually stunning. Unlike traditional art forms, which rely on human creativity and imagination, AI-generated art is created using algorithms and machine learning. These algorithms analyze existing art and use this data to generate new works of art that are often inspired by the past, yet offer something entirely new and innovative.</p><p>One of the key benefits of AI-generated art is its speed and efficiency. Unlike human artists who may spend months or even years creating a single work of art, AI-generated art can be created in a matter of minutes. This not only saves time but also opens up new possibilities for experimentation and exploration. Artists can quickly generate multiple variations of a single work of art, each with its own unique qualities and characteristics.</p><p>Another factor that makes AI-generated art so unique and captivating is its lack of human bias and preconceived notions. Unlike human artists, AI algorithms are not influenced by personal experiences, emotions, or cultural backgrounds. This allows AI-generated art to offer a fresh and unbiased perspective on art, one that is free from preconceived notions and expectations.</p><p>The magic of AI-generated art is its ability to bring together the best of both worlds — the creativity and imagination of human artists and the speed and efficiency of technology. Whether you are an artist or simply a lover of art, AI-generated art is a form of expression that you won’t want to miss. With its unique and captivating qualities, it is sure to leave a lasting impact on the art world for years to come.</p><h3>AI-generated Art Takes the Art World by Storm</h3><p>AI-generated art has taken the art world by storm, with artists and collectors alike taking notice of this new form of expression. The rise of AI-generated art has been rapid, with many galleries and museums showcasing works created by artificial intelligence. This new form of art has also found its way into the mainstream, with AI-generated paintings and illustrations appearing in advertisements, television shows, and even on billboards.</p><p>One of the key reasons for the rapid growth of AI-generated art is the accessibility of technology. With the widespread availability of powerful computers and sophisticated algorithms, more and more artists and creatives are turning to AI as a tool to help them generate unique and creative works of art. This has also opened up the art world to a whole new audience, as anyone with an interest in creating art can now use AI to generate their own works of art.</p><p>Another reason for the growth of AI-generated art is its novelty factor. The art world is always on the lookout for new and innovative forms of expression, and AI-generated art offers just that. This new form of art is not only visually striking, but it also has the power to evoke emotions and thoughts in the viewer, just like any other form of art.</p><p>So, why is AI-generated art taking the art world by storm? It is because it offers something new and unique, it is accessible to everyone, and it has the power to evoke emotions and thoughts in the viewer. Whether you are an art enthusiast, a collector, or simply someone with an interest in creativity, AI-generated art is a form of expression that you won’t want to miss.</p><h3>AI-generated Art as a Modern Art Movement</h3><p>As AI-generated art continues to evolve and gain popularity, it is increasingly being recognized as a modern art movement. With its ability to offer something new and innovative, it is quickly becoming one of the most exciting and talked-about forms of artistic expression.</p><p>One of the reasons that AI-generated art is becoming so popular is its relevance to contemporary society. As our world becomes increasingly digital and technology-focused, AI-generated art offers a new and innovative way to reflect on and express these changes. By using algorithms and machine learning to create works of art, AI-generated art is a reflection of the digital age and a commentary on the role of technology in our lives.</p><p>Another factor that makes AI-generated art such an important and impactful form of expression is its accessibility. Unlike traditional art forms, which can be exclusive and elitist, AI-generated art is available to anyone with access to the internet. This democratization of art has the potential to bring new and diverse perspectives to the world of art, making it more inclusive and representative of a wider range of people and cultures.</p><p>As a modern art movement, AI-generated art also challenges traditional notions of creativity and art-making. By using technology as a tool for expression, AI-generated art is pushing the boundaries of what we consider to be art and challenging us to re-examine our definitions and expectations. Whether you are an artist or simply a lover of art, AI-generated art is a form of expression that is sure to captivate and inspire you.</p><p>AI-generated art is an important and impactful form of artistic expression that is changing the world of art as we know it. With its unique qualities, relevance to contemporary society, and accessibility, it is sure to have a lasting impact and continue to grow and evolve as a modern art movement.</p><h3>The Ethics of AI-generated Art</h3><p>As with any new technology, there are some ethical questions surrounding AI-generated art. For example, who should receive the credit for the creation of an AI-generated artwork — the programmer who built the software or the machine that produced the image? Additionally, if the artwork is created using data or images that were not originally intended for public use, what are the implications for copyright and intellectual property rights?</p><p>Another ethical issue that has been raised is the lack of creativity involved in the production of AI-generated art. Unlike a human artist, an AI program doesn’t have its own imagination or emotions and instead relies on pre-existing images and data to produce its works. Some argue that this lack of creativity makes AI-generated art less valuable and meaningful than traditional art.</p><p>On the other hand, others argue that the ability of AI-generated art to evoke emotions and stimulate thought is proof of its creative and artistic value. They also point out that the process of training an AI program to create art is itself a form of creativity, and that the technology offers a new and exciting medium for artists to express themselves.</p><p>The ethics of AI-generated art is a complex and multifaceted issue that is still being debated within the art community. Whether it should be considered a form of true art is still a matter of personal opinion, and will likely continue to be the subject of debate in the years to come.</p><h3>Conclusion</h3><p>AI-generated art has been a controversial topic in the art world, with many people questioning whether it can truly be considered art. However, it is my belief that AI-generated art should indeed be considered real art. These works, created by algorithms and artificial intelligence, offer a unique perspective on what art can be and how technology is shaping the future of art.</p><p>The beauty of art is that it is subjective and open to interpretation, and AI-generated art is no exception. Whether it is appreciated for their technical prowess or their ability to evoke emotion, these works have a place in the art world and deserve recognition as legitimate forms of art.</p><p>The beauty of art is that it is subjective and open to interpretation, and AI-generated art is no exception. Whether it is appreciated for their technical prowess or their ability to evoke emotion, these works have a place in the art world and deserve recognition as legitimate forms of art.</p><p>In conclusion, AI-generated art is a testament to the ever-evolving nature of art and how technology continues to shape our understanding of it. Whether it is viewed as a form of expression or simply a technological feat, AI-generated art has the potential to challenge our perceptions of what art is and what it can be.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c245da38e2e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Perfect imperfection]]></title>
            <link>https://medium.com/@groupp/perfect-imperfection-31d32a188410?source=rss-36323d407b05------2</link>
            <guid isPermaLink="false">https://medium.com/p/31d32a188410</guid>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Arthur Groupp]]></dc:creator>
            <pubDate>Thu, 12 Jan 2023 17:24:24 GMT</pubDate>
            <atom:updated>2023-01-12T17:24:24.124Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bZbguopsmLvnDWeRnjsO5A.png" /></figure><p>Wabi-sabi is a Japanese aesthetic that values the beauty of imperfection, impermanence, and incompleteness. It is a way of looking at the world that is deeply rooted in the culture and history of Japan, and it has been a major influence on the country’s art, architecture, and design for centuries.</p><p>The word “wabi” originally referred to the simplicity and humility of a hermit’s lifestyle, while “sabi” referred to the patina of age and the beauty of the natural world. Together, wabi-sabi is a reminder that beauty is not always perfect or permanent, and that there is value in the imperfect, the impermanent, and the incomplete.</p><p>In art, wabi-sabi can be seen in the simplicity and elegance of traditional Japanese pottery, such as the tea bowls used in the tea ceremony. These bowls are often irregular in shape and have small imperfections, such as uneven glazes or irregular surfaces. They are not perfect, but they are beautiful in their imperfection.</p><p>Wabi-sabi is also evident in traditional Japanese gardens, which often feature natural elements such as rocks, moss, and sand. These gardens are designed to look wild and natural, and they change with the seasons so that they are never the same from one year to the next. This sense of impermanence and change is an important aspect of wabi-sabi.</p><p>Wabi-sabi has also been an important influence on modern Japanese architecture and design. Architects and designers often use natural materials such as wood and stone, and they often incorporate elements of nature, such as gardens and water, into their designs. This creates a sense of harmony between the building and its surroundings, and it also reflects the wabi-sabi aesthetic.</p><p>In addition to its influence on art, architecture, and design, the principles of wabi-sabi can also be applied to the field of programming and development engineering.</p><p>One of the key principles of wabi-sabi is the idea of “just enough.” In programming, this can mean writing code that is simple, elegant, and easy to understand, rather than trying to over-engineer a solution. This can lead to more maintainable and scalable code.</p><p>Another principle of wabi-sabi is the idea of embracing imperfection. In software development, this means accepting that there will always be bugs and errors in the code and that it is impossible to achieve perfection. Instead of trying to eliminate all errors, developers can focus on making the software robust and resilient, and on creating a process for quickly identifying and fixing errors when they do occur.</p><p>Wabi-sabi also emphasizes the importance of simplicity and minimalism. In programming, this can mean writing code that is easy to read and understand, uses minimal lines of code to accomplish a task and is well structured at the same time. This can lead to more efficient and maintainable software.</p><p>The concept of impermanence is also relevant in the field of programming and development engineering. As technology and user need change, software needs to be adaptable and flexible enough to accommodate these changes. Wabi-sabi reminds developers to focus on creating software that can evolve and adapt over time, rather than trying to create a fixed and unchanging solution.</p><p>In conclusion, Wabi-sabi is a Japanese aesthetic that values the beauty of imperfection, impermanence, and incompleteness. It has been a major influence on Japanese art, architecture, and design for centuries, and it has recently gained popularity in the West. It teaches us to appreciate the beauty of the natural world and to find beauty in things that are not perfect.</p><p>The principles of wabi-sabi can provide valuable insights and a unique perspective for programmers and development engineers. They can help to promote simplicity, elegance, and robustness in software development, and to create a mindset that embraces impermanence and adaptability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31d32a188410" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Handle Multiple Inheritance and TypeScript Mixins]]></title>
            <link>https://medium.com/bitsrc/multiple-inheritance-or-typescript-mixins-10076c4f136a?source=rss-36323d407b05------2</link>
            <guid isPermaLink="false">https://medium.com/p/10076c4f136a</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Arthur Groupp]]></dc:creator>
            <pubDate>Sun, 04 Sep 2022 10:06:59 GMT</pubDate>
            <atom:updated>2025-03-04T17:51:28.880Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6pVkw6NxNPCCc_jN" /><figcaption>Photo by <a href="https://unsplash.com/@d_mccullough?utm_source=medium&amp;utm_medium=referral">Daniel McCullough</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Multiple inheritance</strong> is a feature where a class can extend more than one base class.</p><h3>The problem</h3><p>What if we want to create different UI components like “button”, “input”, “action list item” and “menu item”? All these components have different behavior and look and feel. However, they all can be disabled, can have a base color, and the last two common base class. We are good developers and want to write clean and DRY code. So, let’s see what we can do with this situation.</p><figure><a href="https://bit.cloud/"><img alt="Build in AI speed — Compose enterprise-grade applications, features, and components" src="https://cdn-images-1.medium.com/max/1024/1*yX0vq3scSudyT61IuWFuEg.png" /></a><figcaption>Build in AI speed — Compose enterprise-grade applications, features, and components</figcaption></figure><h3>Extending</h3><p>Let’s say, we have three classes that provide three methods and we want to construct the fourth class that will expose all these three methods.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/089241373fdc0963e9ceb805ba17022d/href">https://medium.com/media/089241373fdc0963e9ceb805ba17022d/href</a></iframe><p>The most logical decision is to do something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a557542a930b7944e517eb2fc00487b5/href">https://medium.com/media/a557542a930b7944e517eb2fc00487b5/href</a></iframe><p>However, it won’t work. Typescript allows for an extension of only one base class. So, we need to extend them one by one in a chain.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e5476b84740deb0592a42de00717068/href">https://medium.com/media/9e5476b84740deb0592a42de00717068/href</a></iframe><p>Everything works and we can live with that, but what if in some of the resulting classes we don’t need method b? We still will have it because class C extends class B and without it won’t have a method a from the class A. Of course, we can create class combinations like class AC that will extend A and not extend B and so on, but this code very quickly will become unreadable and unmaintainable.</p><h3>Composition</h3><p>Instead of extending, we can compose our classes inside the resulting one.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4c2849ec07cc762e7ea336ea9736b43/href">https://medium.com/media/d4c2849ec07cc762e7ea336ea9736b43/href</a></iframe><p>This solution is pretty good and highly recommended if you are constructing components in Angular. But it has its limitations as well. What if some of these classes have properties or getters, we want to address directly in our class D? Or we don’t want to call methods this long way?</p><h3>Mixins</h3><p>Typescript gives us a wonderful pattern allowing us to create the function that will extend a base class. Let’s implement the extension of classes A and C by D. And, let’s our A class has protected property _propA and getter for it.</p><p>First of all, we need to make some preparations. We need to define the type Constructor and interfaces that classes A and C implement.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d584aa9a087d2c27a5f8f9c939f341b/href">https://medium.com/media/6d584aa9a087d2c27a5f8f9c939f341b/href</a></iframe><p>Now, we can create a mixin function for class A.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/39c2b8a2018c558aed6231a3ef581077/href">https://medium.com/media/39c2b8a2018c558aed6231a3ef581077/href</a></iframe><p>Let’s understand what’s going on here. The function mixinA expects an anonymous class as an argument and returns a class expression pattern that extends the class we provided as an argument. Inside this expression pattern, we define all properties and methods we want class A to have.</p><p>Now let’s create mixin for class C.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f37ab97a3c00dcb58ec18e5dea1eec0/href">https://medium.com/media/0f37ab97a3c00dcb58ec18e5dea1eec0/href</a></iframe><p>And now let’s finally construct our resulting class D.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec688eeda7d6b45a9580d424ac57fb9c/href">https://medium.com/media/ec688eeda7d6b45a9580d424ac57fb9c/href</a></iframe><p>You can see that class D has all methods and properties inherited from classes A and C.</p><p>Awesome! Now, what if we want our class D to have its base class, in addition to classes A and C? The only thing we will need to do is just define it and supply it to mixinA as an argument.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d4be1b53cfc604ca0b78eec704e9513/href">https://medium.com/media/3d4be1b53cfc604ca0b78eec704e9513/href</a></iframe><p>Using Constructor type generic, we can restrict which type we can supply as base to mixin function.</p><h3>Conclusion</h3><p>Despite the JavaScript restriction of extending only one class, we have a way to solve the problem cleanly and nicely. We can use compositions or mixins depending on the tasks set before us.</p><h3>Go composable: Build apps faster like Lego</h3><figure><a href="https://bit.cloud/"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x2l8LRH1nbC1FQZUdt50RQ.jpeg" /></a></figure><p><a href="https://bit.cloud/"><strong>Bit</strong></a> is an open-source tool for building apps in a modular and collaborative way. Go composable to ship faster, more consistently, and easily scale.</p><p><strong>→ </strong><a href="https://bit.dev/">Learn more</a></p><p>Build apps, pages, user-experiences and UIs as standalone components. Use them to compose new apps and experiences faster. Bring any framework and tool into your workflow. Share, reuse, and collaborate to build together.</p><p>Help your team with:</p><p><strong>→ </strong><a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc"><strong>Micro-Frontends</strong></a></p><p><strong>→ </strong><a href="https://blog.bitsrc.io/how-we-build-our-design-system-15713a1f1833"><strong>Design Systems</strong></a></p><p><strong>→ </strong><a href="https://bit.cloud/blog/how-to-reuse-react-components-across-your-projects-l4pz83f4"><strong>Code-Sharing and reuse</strong></a></p><p><strong>→ </strong><a href="https://www.youtube.com/watch?v=5wxyDLXRho4&amp;t=2041s"><strong>Monorepos</strong></a></p><h3>Learn more</h3><ul><li><a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">How We Build Micro Frontends</a></li><li><a href="https://blog.bitsrc.io/how-we-build-our-design-system-15713a1f1833">How we Build a Component Design System</a></li><li><a href="https://bit.cloud/blog/how-to-reuse-react-components-across-your-projects-l3bhezsg">How to reuse React components across your projects</a></li><li><a href="https://blog.bitsrc.io/5-ways-to-build-a-react-monorepo-a294b6c5b0ac">5 Ways to Build a React Monorepo</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10076c4f136a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitsrc/multiple-inheritance-or-typescript-mixins-10076c4f136a">How to Handle Multiple Inheritance and TypeScript Mixins</a> was originally published in <a href="https://medium.com/bitsrc">Bits and Pieces</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Extend Components, Directives and Services in Angular 14]]></title>
            <link>https://medium.com/bitsrc/extending-components-directives-and-services-in-angular-14-46279765acd0?source=rss-36323d407b05------2</link>
            <guid isPermaLink="false">https://medium.com/p/46279765acd0</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Arthur Groupp]]></dc:creator>
            <pubDate>Wed, 01 Jun 2022 09:01:20 GMT</pubDate>
            <atom:updated>2022-09-06T11:38:38.039Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvX8Q3z0AZp0JFVACBuQrw.jpeg" /></figure><p>First, avoid it as much as possible. Extending components by itself is bad practice because it’s confusing code and adds more issues than actually helps. However, sometimes it can be helpful to combine common logic of similar components or directives into abstract class that they all will extend.</p><p>Let’s say, we have two components like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/40b7df963d341c350ac98ff4d99ab647/href">https://medium.com/media/40b7df963d341c350ac98ff4d99ab647/href</a></iframe><p>Of course, these components can be combined into one, but let’s assume that this is not the case and they have much more logic and templates specific to each.</p><p>Let’s modify our components and put shared logic into abstract base class that they will extend.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c84205d184a41036b0bad258701f3b9/href">https://medium.com/media/4c84205d184a41036b0bad258701f3b9/href</a></iframe><p>Much DRYer. The problem with this approach is dependencies. Since our base class has dependencies, it can’t inject it by itself because it doesn’t exist. Therefore, we must inject all those dependencies by ourselves in child classes and supply it to super().</p><h3>Inject function</h3><p>Starting with version 14 of Angular we can use function inject() to obtain instances of injection tokens in other functions, components, services, almost everywhere. This opens us great possibility to avoid repeating of these injections in derived classes. From now on, we can add static method to our base class that will initialize its dependencies.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6524969186e7c61489cd84744f9c00cf/href">https://medium.com/media/6524969186e7c61489cd84744f9c00cf/href</a></iframe><h3>Conclusion</h3><p>I widely use abstractions and this feature excited me much. I was looking for the ability to avoid manual injections for a long time and now here it is.</p><p><em>Photo by Andrew Seaman on Unsplash</em></p><h3>Bit: Build Better UI Component Libraries</h3><p>Say hey to <a href="https://bit.cloud/"><strong>Bit</strong></a>. It’s the #1 tool for component-driven app development.</p><p>With Bit, you can create any part of your app as a “component” that’s composable and reusable. You and your team can share a toolbox of components to build more apps faster and consistently together.</p><ul><li>Create and compose “<strong>app building blocks</strong>”: UI elements, full features, pages, applications, serverless, or micro-services. With any JS stack.</li><li>Easily <strong>share, and reuse</strong> components as a team.</li><li>Quickly <strong>update</strong> <strong>components</strong> across projects.</li><li>Make hard things simple: <a href="https://bit.cloud/blog/painless-monorepo-dependency-management-with-bit-l4f9fzyw">Monorepos</a>, <a href="https://blog.bitsrc.io/how-we-build-our-design-system-15713a1f1833">design systems</a> &amp; <a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">micro-frontends</a>.</li></ul><p><a href="https://bit.cloud/"><strong>Try Bit open-source and free→</strong></a></p><figure><a href="https://bit.cloud/"><img alt="" src="https://cdn-images-1.medium.com/max/376/1*p3UFa6xnmmbrkTzfRm_EmQ.png" /></a></figure><h3>Learn more</h3><ul><li><a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">How We Build Micro Frontends</a></li><li><a href="https://blog.bitsrc.io/how-we-build-our-design-system-15713a1f1833">How we Build a Component Design System</a></li><li><a href="https://bit.cloud/blog/how-to-reuse-react-components-across-your-projects-l3bhezsg">How to reuse React components across your projects</a></li><li><a href="https://blog.bitsrc.io/5-ways-to-build-a-react-monorepo-a294b6c5b0ac">5 Ways to Build a React Monorepo</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46279765acd0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitsrc/extending-components-directives-and-services-in-angular-14-46279765acd0">How to Extend Components, Directives and Services in Angular 14</a> was originally published in <a href="https://medium.com/bitsrc">Bits and Pieces</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>