<?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 Paweł Ostromecki on Medium]]></title>
        <description><![CDATA[Stories by Paweł Ostromecki on Medium]]></description>
        <link>https://medium.com/@pawel.ostromecky?source=rss-63033e9abc65------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DEJiWj8JTG9DQFABaHWR1w.png</url>
            <title>Stories by Paweł Ostromecki on Medium</title>
            <link>https://medium.com/@pawel.ostromecky?source=rss-63033e9abc65------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 03:36:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pawel.ostromecky/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[Code Became Cheap. Did Developer Knowledge Become Cheap Too?]]></title>
            <link>https://medium.com/@pawel.ostromecky/code-became-cheap-did-developer-knowledge-become-cheap-too-3e641aa9a63b?source=rss-63033e9abc65------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e641aa9a63b</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[future-of-work]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Paweł Ostromecki]]></dc:creator>
            <pubDate>Sat, 08 Aug 2026 14:43:57 GMT</pubDate>
            <atom:updated>2026-08-08T14:53:40.162Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kavg6Y1VzvfpQ9QgyiCJ5g.png" /><figcaption>A developer stands between a flood of generated code and a small set of deliberately chosen architectural blocks.</figcaption></figure><p><em>When implementation becomes abundant, selection becomes the work.</em></p><p>For roughly eight years, I had a simple model of becoming a better developer.</p><p>Read the documentation. Learn Angular properly. Understand RxJS, dependency injection, change detection, testing, state management, architecture. Look at how other people solve problems. Make enough mistakes to understand why one solution is better than another.</p><p>The model was not perfect, but it was easy to follow: the more I understood, the more I could do on my own, and the faster I could find a good solution, the better developer I became.</p><p>Then AI arrived and made a large part of what I had trained for surprisingly cheap.</p><p>It can write the implementation in minutes. It can find a library I have never used, read its documentation, compare several approaches and produce a working starting point before I finish browsing the first API page.</p><p>This is not another article about AI taking developers’ jobs. I do not know how that story ends. I am interested in a more immediate and more uncomfortable question.</p><p>If code became cheap, what happened to the value of everything I learned?</p><h3><strong>What Actually Became Cheap</strong></h3><p>I no longer need to remember an exact API. I do not need every RxJS operator ready in my head. I can ask an agent to inspect a package, search the documentation and begin an implementation.</p><p>Pretending this changes nothing would be dishonest. A part of my knowledge has lost market value: remembering syntax and reproducing familiar implementations is less scarce than it used to be.</p><p>But scarcity is not the same as usefulness.</p><p>AI may not have made my knowledge worthless. It may have removed my monopoly on applying it.</p><p>That distinction matters because generating an answer and deciding whether it belongs in a real system are different activities. The first is getting dramatically cheaper. The second still depends on context: the product, the codebase, the team, the cost of failure and what is likely to change next.</p><p>The evidence on productivity is less tidy than the demos suggest. In a 2025 randomized study, METR found that experienced open-source maintainers working in repositories they knew took 19% longer with early-2025 AI tools. The researchers carefully limited that conclusion to the tools, developers and tasks they studied. Later METR work with newer agents reported small productivity benefits instead. The direction can change with the model and the task. <a href="https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/"><strong>METR’s 2025 study</strong></a> is not proof that AI slows developers in general, just as a two-hour app demo is not proof that production software has become trivial.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EYOItBlKQSvX_ZtJ39JQmA.png" /><figcaption>Relative task time in METR’s study: 100 without generative AI and 119 with AI allowed.</figcaption></figure><p><em>In this setting, access to early-2025 AI tools increased completion time by 19%. The study covered 16 experienced open-source developers completing 246 issues in repositories they knew well.</em></p><p>Maybe “Does AI make us faster?” is already too broad a question.</p><p>Faster at what?</p><h3><strong>A Framework Is Not a Domain</strong></h3><p>There was a related trap in our industry long before generative AI.</p><p>When I entered software development, it was easy to confuse a domain with a technology. Frontend meant Angular or React. Backend meant Java, .NET or Node. We described ourselves as Angular developers, React developers and Java developers.</p><p>I am an Angular developer. For years, that specialization gave me a useful direction. It also made it tempting to learn tools before problems.</p><p>We need state? Add a library.</p><p>Validation? A library.</p><p>Caching? A library.</p><p>Communication between components? Surely there is another library.</p><p>Over time, I tried to reverse the order. What problem do we actually have? Is it a known class of problem? Are we dealing with an observer, a queue, a cache, a state machine, a concurrency policy or an ownership boundary? Only then: which Angular feature or library fits it?</p><p>This order is even more important now. AI is very good at answering, “How do I implement this in Angular?”</p><p>The harder question is, “Should we implement it this way at all?”</p><h3><strong>What Angular Taught Me Beyond Angular</strong></h3><p>If a model knows more Angular APIs than I do, does Angular expertise still matter?</p><p>I think it does, but not for the reason I once assumed.</p><p>RxJS taught me to think about time, streams and concurrency. Consider <strong>switchMap</strong>, <strong>concatMap</strong>, <strong>mergeMap</strong> and <strong>exhaustMap</strong>. An agent can list their behavior and write code with any of them. The choice is still a product decision expressed through code. Should a new request cancel the previous one? Wait behind it? Run at the same time? Be ignored while work is in progress?</p><p>There is no correct operator until we define the behavior we want.</p><p>Dependency injection taught me to see dependencies and inversion of control. Angular’s own documentation defines DI as supplying a class with dependencies instead of making it create them internally. The API is Angular-specific. The question of who creates, owns and can replace a dependency is not. <a href="https://angular.dev/guide/di">Angular’s DI guide</a>.</p><p>State-management libraries forced me to ask where state should live, who can change it and how far it should travel. Components taught me about responsibility boundaries. The router taught me that navigation is also state. Tests taught me to define what I expect before trusting an implementation.</p><p>Even signals are more than a function call. Angular describes them as a system that tracks where state is used so updates can be propagated efficiently. Knowing the API helps. Understanding dependencies, derived state and reactive context helps when the generated implementation becomes surprising. <a href="https://angular.dev/guide/signals">Angular’s Signals guide</a>.</p><p>Maybe the real value of eight years with a framework is not the API I can recall. It is the collection of problems I learned to recognize through it.</p><p>That collection makes AI more useful, not less.</p><h3><strong>The Wrong Question About Verification</strong></h3><p>As AI writes more code, two strong positions keep appearing.</p><p>At one end is outcome-first development. Describe the task, let the agent implement it, run the application, check the result and accept the change. Do not spend time reading every line if the behavior is correct.</p><p>At the other end is code-first craftsmanship. AI may type the implementation, but a developer should still understand the structure, inspect the important details and leave the codebase maintainable.</p><p>The material that inspired this article described three versions of this spectrum: judging the outcome, defining the contract and constraints, or caring closely about the generated code. I do not think one of them wins everywhere.</p><p>The better question is not, “Should I read AI-generated code?”</p><p>It is, “How will I build enough trust in this change?”</p><p>For a script that renames a few local files once, I may inspect the inputs, run it on copies and compare the output. Reading every line may add little.</p><p>For a prototype that will be discarded next week, a smoke test may be a rational level of evidence.</p><p>For authorization, payments, user data or a foundation that the team will extend for five years, “it seems to work” is nowhere near enough.</p><p>The code is cheap in all three cases. Failure is not.</p><h3><strong>Verification Is Part of Programming</strong></h3><p>Verification does not mean only reading code. It can include:</p><ul><li>a narrow change with explicit acceptance criteria</li><li>type checking, linting and static analysis</li><li>unit, integration and end-to-end tests</li><li>security checks and dependency review</li><li>a second human or agent challenging the solution</li><li>production observability</li><li>staged rollout and a reliable way to revert</li></ul><p>None of these is magical. Tests can confirm the wrong requirements. A reviewer can miss a subtle error. Types cannot prove that a business rule is correct. Observability can tell us about damage only after deployment.</p><p>Trust comes from combining evidence appropriate to the risk.</p><p>I find it useful to look at five properties of a change:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ybZO7aH6-dMyQauTG9Dfw.png" /><figcaption>Three verification levels showing stronger evidence as software risk rises from a disposable script to authorization, payments and user data.</figcaption></figure><p><em>Verification should scale with the cost and reversibility of failure.</em></p><p>Targeted is important. Experience does not always mean reading everything. Sometimes it means knowing where to look.</p><p>This is close to what current developer surveys show. In Stack Overflow’s 2025 survey, more respondents distrusted the accuracy of AI tools than trusted it, and the most common frustration was an answer that was almost right. Developers are already discovering that generation and acceptance are separate tasks. <a href="https://survey.stackoverflow.co/2025/ai">Stack Overflow Developer Survey 2025</a></p><p>DORA’s 2025 research describes AI as an amplifier of the engineering system around it. Faster generation helps most when teams also have fast, high-quality feedback loops. If a team already struggles to review, test and deploy small changes, producing more code can magnify the weakness. <a href="https://dora.dev/research/2025/dora-report/">DORA 2025</a>.</p><p>The bottleneck may be moving from production to evaluation.</p><p>But that does not make the evaluator passive. Designing the evidence is now part of the implementation.</p><h3><strong>Experience as the Ability to Choose</strong></h3><p>An experienced developer has usually seen abstractions that promised simplicity and made everything harder six months later.</p><ul><li>Global state introduced too early.</li><li>A library that became impossible to remove.</li><li>A framework applied to a problem that needed a small function.</li><li>A locally elegant design that did not fit the rest of the system.</li><li>This is difficult to encode as API knowledge. It is a library of consequences.</li></ul><p>AI can give me five architecturally respectable solutions. My experience may help me notice that one is too unfamiliar for the team, one creates a permanent dependency for a temporary problem, and one assumes a scale we will probably never reach.</p><p>That does not mean the senior developer should defend familiar solutions against anything new. AI can search a wider space than I can. It can expose me to a pattern I did not know and challenge an assumption I stopped noticing.</p><p>The value is not in always being right. It is in asking what the alternatives optimize for, which constraints matter here and what evidence could prove the choice wrong.</p><p>Experience is becoming less about owning the implementation and more about taking responsibility for the selection.</p><h3><strong>Should We Still Learn Programming From the Ground Up?</strong></h3><p>This question becomes harder for people entering the field.</p><p>If an agent can generate an application, should a junior still learn the fundamentals?</p><p>I think so, but the reason changes. The goal is not to reproduce every implementation from memory. It is to build a model of what the system is doing.</p><p>What happens when a request starts? Where does state live? What happens when the same event arrives twice? What does cancellation mean? Why does the view render again? What does a cache return after the source changes? Where does an error go?</p><p>Without that model, a working result is hard to distinguish from a result that works only in the happy path.</p><p>There is a real paradox here. AI can make programming easier to learn because it can explain unfamiliar code, generate examples and provide immediate feedback. It can also make it easy to skip the exact friction that builds a useful mental model.</p><p>We do not yet have strong long-term evidence about what constant agent use will do to junior development. So I do not want to turn this concern into a fact.</p><p>But I would not confuse completing more exercises with understanding more systems.</p><h3><strong>Adaptation or FOMO?</strong></h3><p>Developers have always had fear of missing out.</p><p>Learn React. Angular is dying. Try Vue. Adopt the new state library. Rewrite everything with the latest pattern.</p><p>AI multiplied the pressure: a new model, agent, editor, MCP server, skill, subagent, context technique or software factory every week. Someone deleted their IDE. Someone else no longer reads code. A third person built an application in two hours.</p><p>It is easy to conclude that the way I work is already obsolete.</p><p>I try to separate adaptation from FOMO with a simple test.</p><p>Adaptation starts with a problem and looks for a tool that improves the outcome.</p><p>FOMO starts with a tool and looks for a problem that justifies using it.</p><p>This is the same mistake we made with libraries, only at a higher speed. Yesterday we wanted a library for every problem. Today we may want an agent for every problem. The vocabulary changed. The thinking did not.</p><p>I do need to update my workflow. AI is not just another autocomplete, and some skills I spent years practicing will matter less. Ignoring that would be nostalgia.</p><p>But adaptation does not require copying the workflow of somebody building disposable side projects when I am changing a ten-year-old system. Context is not resistance to change. It is the reason engineering exists.</p><h3><strong>The Cost of a Good Decision</strong></h3><p>So what is valuable when code is cheap?</p><p>Recognizing the problem. Defining constraints. Choosing tools. Understanding trade-offs. Specifying what correct means. Building evidence. Debugging what the agent did not anticipate. Understanding the product. Simplifying. Knowing the cost of failure. Deciding that something does not need to be built.</p><p>And accepting responsibility for the result, even when I did not type it.</p><p>AI has lowered the cost of producing code. It has not necessarily lowered the cost of a good decision.</p><p>Looking back at eight years of learning Angular and software development, I no longer think the time was wasted. I may simply have described the outcome incorrectly.</p><p>I thought I was learning to write increasingly better code.</p><p>Much of the time, I was learning to recognize problems, predict consequences and remember solutions that once looked clever and later failed.</p><p>Today I am learning when to let AI write the code for me, when to read it, how to verify it and when the best decision is not to generate it at all.</p><p>Maybe that is still learning to program.</p><p>Programming just no longer means only writing code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e641aa9a63b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You (don’t) need another State Management Library — vol. 2]]></title>
            <link>https://medium.com/@pawel.ostromecky/you-dont-need-another-state-management-library-vol-2-3bd37b426449?source=rss-63033e9abc65------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bd37b426449</guid>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Paweł Ostromecki]]></dc:creator>
            <pubDate>Thu, 12 Mar 2026 10:01:04 GMT</pubDate>
            <atom:updated>2026-03-12T10:01:04.872Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ymtR70kLdmu-k-lnbGEiqg.png" /></figure><p>Hi there. If you’re reading this article, you probably saw the previous one where we built a simple weather application using <strong>Angular signals and RxJS</strong> without introducing a full-fledged state‑management library.</p><p>If not, you can check it <a href="https://medium.com/@pawel.ostromecky/you-dont-need-another-state-management-library-78d92c7badcc">here</a>.</p><p>In this article we’ll take advantage of a small utility that we’re going to explore a bit more, while still keeping things simple.</p><p>In the previous article we focused on the <strong>conceptual approach</strong> and showed that many patterns used in libraries like NgRx can be recreated with native Angular tools. The goal was not to criticize those libraries but to show that sometimes we can achieve similar benefits with <strong>less boilerplate and fewer dependencies</strong>.</p><p>In this article, I want to take the next step.</p><p>Instead of reinventing the wheel, we will reuse the <strong>Flux‑like pattern</strong> we introduced earlier and implement it using the <a href="https://ngxtension.dev/utilities/signal-async/connect/"><strong>connect</strong></a> utility from the<a href="https://ngxtension.dev/"> <strong>ngxtension</strong></a> library.</p><p>This approach keeps the architecture familiar for developers who worked with Redux or NgRx, while dramatically reducing the amount of code we need to write.</p><h3><strong>Some theory</strong></h3><p>Before we jump into code, let’s quickly recall the pattern we used in the previous article.</p><p>The architecture looked roughly like this:</p><ol><li><strong>Sources</strong> — observables that represent events or actions.</li><li><strong>Effects</strong> — side effects such as HTTP requests.</li><li><strong>Reducer</strong> — logic that updates the state.</li><li><strong>Selectors</strong> — reactive access to state.</li></ol><p>If you worked with Redux, NgRx or similar tools, this flow should look familiar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*THN5SgniT5a8PCf9F8QTdg.png" /><figcaption>Just Redux</figcaption></figure><p>Even though we didn’t use a dedicated library, the pattern was still there.</p><ul><li>Subject as <strong>actions</strong></li><li>RxJS operators for <strong>effects</strong></li><li>signal state with update() as <strong>reducer</strong></li><li>computed() as <strong>selectors</strong></li></ul><p>This gave us many benefits typically associated with Flux architecture:</p><ul><li><strong>Unidirectional data flow</strong></li><li><strong>Single source of truth</strong></li><li><strong>Predictable state updates</strong></li><li><strong>Easy testing</strong></li></ul><p>However, there were still some gaps we want to address today:</p><ul><li>Manual <strong>subscriptions</strong></li><li>Imperative state updates within <strong>rxjs</strong> streams</li></ul><p>The good news is that this pattern is so common that some utilities can <strong>simplify the implementation without forcing a heavy abstraction.</strong></p><p>One of them is the <strong>connect</strong> helper from <strong>ngxtension</strong>.</p><h3><strong>ngxtension and the connect method</strong></h3><p><a href="https://ngxtension.netlify.app/"><strong>ngxtension</strong></a> is a utility library for Angular that provides a set of small helpers designed to improve developer experience.</p><p>I like to think about it as a box full of chocolate — every piece simplifies some part of your daily workflow. It’s not a framework, it doesn’t impose anything, and that’s beautiful.</p><p>One of the most interesting utilities in the context of state management is <strong>connect</strong>.</p><p>The goal of <strong>connect</strong> is simple:</p><blockquote>Connects an observable stream to a signal and update its value automatically.</blockquote><p>Instead of manually subscribing and updating the signal, we can describe <strong>how the state should change</strong>, and the utility handles the subscription lifecycle for us.</p><p><em>But we already know this pattern from other libraries.</em></p><p>Let&#39;s revisit a super simplified version of our city search example.</p><pre>@Injectable()<br>export class CitySearchStore {<br><br>  private cityService = inject(CityService)<br><br>  private state = signal&lt;City | undefined&gt;(undefined)<br><br>  public city = computed&lt;City | undefined&gt;(() =&gt; this.state())<br><br>  search$ = new Subject&lt;string&gt;()<br>}</pre><p>So far, nothing surprising.</p><p>We have:</p><ul><li><strong>state</strong> stored in a signal</li><li><strong>selector</strong> (city)</li><li><strong>action stream</strong> (search$)</li></ul><p>Now let’s connect the action stream to the state.</p><pre>constructor() {<br>  connect(this.state, this.search$.pipe(<br>  switchMap(cityName =&gt;<br>    this.cityService.getCityByName(cityName)<br>  )))<br>}</pre><p>That’s it.</p><p>Whenever <strong>search$</strong> emits a value, the observable pipeline runs and the result automatically updates the <strong>state</strong> signal.</p><p>No manual subscription. No <strong>takeUntilDestroyed()</strong>. Why does it work? If we look at the <strong>connect</strong> definition, there is a key phrase:</p><blockquote>“connects a signal to an observable and returns a subscription.”</blockquote><p>And that’s it. <strong>connect</strong> manages subscriptions for us, and this will be a crucial part of our implementation. You might wonder how something this simple could replace patterns used in mature state‑management libraries. The answer is simple — we are not going to use it in this minimal form. Instead, we will shape it into something closer to a real architectural pattern.</p><p>Let’s verify the following example.</p><pre>@Injectable()<br>export class WeatherFacade {<br>  private readonly weatherService = inject(WeatherService);<br><br>  // state<br>  private readonly state = signal&lt;WeatherState&gt;({<br>    city: undefined,<br>    forecast: undefined,<br>    status: &#39;idle&#39;,<br>    error: &#39;&#39;<br>  });<br><br>  // selectors<br>  readonly city = computed(() =&gt; this.state().city);<br>  readonly error = computed(() =&gt; this.state().error);<br><br>  // event sources<br>  private readonly citySearchTriggered$ = new Subject&lt;string&gt;();<br>  private readonly errorReceived$ = new Subject&lt;string&gt;();<br><br>  constructor() {<br>    // effect result streams<br>    const cityLoaded$ = this.citySearchTriggered$.pipe(<br>      switchMap((cityName) =&gt;<br>        this.weatherService.getCityByName(cityName).pipe(<br>          catchError(() =&gt; {<br>            // Show notification<br>            this.errorReceived$.next(&#39;Failed to load city&#39;);<br>            return EMPTY;<br>          })<br>        )<br>      )<br>    );<br><br>    // connected signal updates<br>    connect(this.state)<br>      .with(this.citySearchTriggered$, (state) =&gt; ({<br>        ...state,<br>        status: &#39;loading&#39;,<br>        error: &#39;&#39;<br>      }))<br>      .with(cityLoaded$, (state, city) =&gt; ({<br>        ...state,<br>        status: &#39;idle&#39;,<br>        city<br>      }))<br>  }<br><br>  searchCity(cityName: string): void {<br>    if (cityName.trim()) {<br>      this.citySearchTriggered$.next(cityName);<br>    }<br>  }<br>}</pre><p>We introduced some changes compared to the previous example. Let’s break it down.</p><p><strong>Subjects as actions</strong></p><p>The <strong>citySearchTriggered$</strong> subject represents an <strong>action</strong>, or as I prefer — an <strong>event</strong>, because we are going to follow an event‑based naming convention.</p><p>Notice the naming pattern:</p><ul><li><strong>citySearchTriggered$</strong></li><li><strong>cityLoaded$</strong></li><li><strong>errorReceived$</strong></li></ul><p>These <strong>sources</strong> represent <strong>things that happened</strong>, not imperative commands. Event‑based naming keeps the architecture consistent and easier to reason about. Previously we just had <strong>search$</strong>, but it sounds more like a command. Mixing these naming styles is not wrong, but it might be confusing. For that reason we introduced the <strong>searchCity()</strong> method, which becomes the public API of the service and expresses the intent in a command‑like style.</p><p><strong>connect as reducer</strong></p><p><strong>connect</strong> acts as a <strong>reducer bridge</strong> between:</p><ul><li>an <strong>observable stream</strong></li><li>a <strong>signal state</strong></li></ul><p>Instead of writing:</p><pre>citySearchTriggered$.subscribe(value =&gt;<br>  state.update(s =&gt; ({ ...s, status: &#39;loading&#39; }))<br>)</pre><p>we simply describe the pipeline and let <strong>connect</strong> perform the update.</p><pre>connect(this.state)<br>  .with(this.citySearchTriggered$, (state) =&gt; ({<br>    ...state,<br>    status: &#39;loading&#39;,<br>    error: &#39;&#39;<br>  }))</pre><p>This keeps state transitions <strong>declarative</strong>.</p><p><strong>RxJS for side effects</strong></p><p>Side effects should remain inside RxJS pipelines.</p><p>For example:</p><pre>citySearchTriggered$.pipe(<br>  debounceTime(300),<br>  switchMap(city =&gt;<br>    this.api.getCity(city).pipe(<br>      catchError(() =&gt; { /** Handle error response */})<br>    )<br>  )<br>)</pre><p>This keeps all asynchronous logic inside observable streams, where RxJS shines. Signals remain responsible only for <strong>holding state</strong>, not performing side effects. There is one more thing about side effects that is important to understand in this workflow.</p><p>Consider the following scenario:</p><pre>this.citySearch$.pipe(<br>  switchMap(city =&gt; this.weatherApi.getWeather(city)),<br>  tap((result) =&gt; this.citySearchSuccess$.next(result)),<br>  catchError((err) =&gt; {<br>    this.citySearchFailure$.next(err);<br>    return EMPTY;<br>  })<br>).subscribe();</pre><p>Do you recognize it? I’ve seen this pattern many times across many projects.</p><p>It usually looked like:</p><blockquote>Action → Action Success / Action Failure</blockquote><p>We had an action or event recognized in the system and created dedicated success and failure actions. In practice, this meant that for every action we ended up with three.</p><p>This is a completely valid approach, but to make this code work we had to <strong>subscribe</strong>, because observables execute only when subscribed. Assigning the result to <strong>citySearchSuccess$</strong> is also not an option here because the result is already pushed manually using <strong>tap </strong>operator.</p><p>Let’s rethink it.</p><pre>cityFound$ = this.citySearchTriggered$.pipe(<br>  switchMap(city =&gt; this.weatherApi.getWeather(city)),<br>  catchError((err) =&gt; {<br>    this.error$.next(err);<br>    return EMPTY;<br>  })<br>);</pre><p>What happened here?</p><p>We extracted <strong>citySearchSuccess$</strong> outside the stream and made it a property. Additionally we renamed it to follow event-based naming. Then we assigned the result of the observable pipeline to it. We can do that because the result of a pipeline is still an <strong>Observable</strong>, which is exactly what we want.</p><pre>connect(this.state)<br>  .with(this.cityFound$, <br>      (state, result) =&gt; ({<br>        ...state,<br>        status: &#39;idle&#39;,<br>        city: result<br>      }))</pre><p>Exactly. We pass it through <strong>connect</strong>, which subscribes to the stream, extracts the emitted value, and lets us define the state transition.</p><p>One more observation from my perspective.</p><p>We used to create dedicated error or failure actions for almost every event in the system. In practice, this often led to hundreds of actions doing the same thing — for example just opening a toast notification. Since this is feature‑related state, we usually only need a single state handler for errors. Of course there may be special requirements, but in most cases a single handler is enough.</p><p>🥳 We already have lightweight, ready to use feature state management. We intentionally move it to <strong>Facade</strong> to keep it separate from UI state but we’ll cover it in another story.</p><h3><strong>Summary</strong></h3><p>In the previous article we implemented a Flux‑inspired architecture manually using <strong>signals </strong>and<strong> RxJS</strong>.</p><p>The key idea was that we don’t necessarily need a heavy state‑management library to get:</p><ul><li>predictable state</li><li>unidirectional data flow</li><li>maintainable architecture</li></ul><p>In this article we improved that approach using the <strong>connect</strong> utility from <strong>ngxtension</strong> library.</p><p>The architecture remains the same:</p><ul><li><strong>Subjects</strong> represent actions</li><li><strong>RxJS</strong> handles effects</li><li><strong>connect</strong> performs reducer updates</li><li><strong>signals</strong> store state</li><li><strong>computed</strong> exposes selectors</li></ul><p>The difference is that the implementation becomes <strong>much simpler and easier to maintain</strong>.</p><h3><strong>What’s next</strong></h3><p>In the next article I’ll explore a <strong>pure signal‑based approach</strong> to state management.</p><p>No Subjects.</p><p>No RxJS pipelines.</p><p>Just signals.</p><p>And we’ll see where this approach works great — and where RxJS is still the better tool.</p><p>If the post was useful to you, consider giving it a Clap👏 and follow me, you would help me a lot. Thank you ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bd37b426449" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Angular’s Host Property]]></title>
            <link>https://medium.com/@pawel.ostromecky/mastering-angulars-host-property-9a7ee9a3b5ed?source=rss-63033e9abc65------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a7ee9a3b5ed</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[signal]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Paweł Ostromecki]]></dc:creator>
            <pubDate>Thu, 13 Mar 2025 10:10:25 GMT</pubDate>
            <atom:updated>2025-03-13T10:14:15.961Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qys5-VddlGTPF47smc7PYA.png" /></figure><h3>Introduction</h3><p>Angular developers often rely on @HostListener and @HostBinding to interact with the DOM. These decorators enable us to handle events and bind properties or classes directly to host elements. However, with recent Angular releases, the revamped host property simplifies and unifies these capabilities, offering greater flexibility and compatibility with Angular signals.</p><p>In this blog post, we will:</p><ul><li>Review @HostListener and @HostBinding with examples.</li><li>Explore the revamped host property and its capabilities.</li><li>Highlight how the new API works seamlessly with signals.</li><li>Address inconsistencies in the old API and Angular’s improvements.</li><li>Share a migration script to help you transition quickly and easily.</li></ul><p>Let’s dive in!</p><h3>The Legacy Approach: @HostListener and @HostBinding</h3><p>In earlier Angular versions, @HostListener and @HostBinding were the go-to tools for interacting with the host element.</p><h3>Example: Using @HostListener for Event Handling</h3><pre>import { Component } from &#39;@angular/core&#39;;<br>@Component({<br>  selector: &#39;app-button&#39;,<br>  template: `&lt;button&gt;Click me&lt;/button&gt;`<br>})<br>export class ButtonComponent {<br>  @HostListener(&#39;click&#39;, [&#39;$event&#39;])<br>  handleClick(event: Event) {<br>    console.log(&#39;Button clicked!&#39;, event);<br>  }<br>}</pre><h3>Example: Using @HostBinding for Property Binding</h3><pre>import { Component } from &#39;@angular/core&#39;;<br>@Component({<br>  selector: &#39;app-card&#39;,<br>  template: `&lt;div&gt;Card content&lt;/div&gt;`<br>})<br>export class CardComponent {<br>  @HostBinding(&#39;class.active&#39;) isActive = false;<br>  <br>  toggleActive() {<br>    this.isActive = !this.isActive;<br>  }<br>}</pre><p>These are just simple examples, but @HostBinding can be used for applying classes, custom styles, or even animations:</p><pre>@HostBinding(&#39;class.active&#39;)<br>@HostBinding(&#39;disabled&#39;)<br>@HostBinding(&#39;attr.role&#39;)<br>@HostBinding(&#39;@slideIn&#39;)</pre><p>Similarly, @HostListener allows you to listen to events directly on the host element of a directive or component:</p><pre>@HostListener(&#39;document:keydown&#39;, [&#39;$event&#39;])<br>@HostListener(&#39;mouseenter&#39;)</pre><p>While effective, these decorators often led to fragmented logic, as you had to manage bindings and listeners separately.</p><h3>Inconsistencies in the Previous Angular Versions</h3><p>Despite the presence of the host property in Angular, developers were required to use @HostListener and @HostBinding due to limitations in the framework. The host property existed but was not flexible enough to handle both event listeners and property bindings effectively. This inconsistency resulted in fragmented API usage and made state management more cumbersome.</p><p>The issue was recognized by the Angular team and discussed extensively in <a href="https://github.com/angular/angular/issues/52561">this GitHub issue</a>, leading to the improvements in the latest Angular versions.</p><h3>The Revamped host Property</h3><p>To address these inconsistencies, Angular has introduced an enhanced host property, which provides a more unified and streamlined approach to handling event listeners and property bindings.</p><p>Example of the new approach:</p><pre>import { Component, signal } from &#39;@angular/core&#39;;<br>@Component({<br>  selector: &#39;app-card&#39;,<br>  template: `&lt;div&gt;Card content&lt;/div&gt;`,<br>  host: {<br>    &#39;[class.active]&#39;: &#39;isActive()&#39;,<br>    &#39;(click)&#39;: &#39;toggleActive()&#39;<br>  }<br>})<br>export class CardComponent {<br>  isActive = signal(false);<br>  <br>  toggleActive() {<br>    this.isActive.update(value =&gt; !value);<br>  }<br>}</pre><p>This new API allows for:</p><ul><li>More concise syntax.</li><li>It works with Angular signals.</li><li>Eliminating the need for @HostListener and @HostBinding decorator-based syntax, which might be confusing for a wider non-Angular audience.</li></ul><h3>Migrating to the New API</h3><p>To help developers transition, the <a href="https://ngxtension.netlify.app/utilities/migrations/host-binding-migration/">ngxtension</a> library provides a migration script that automates the conversion of @HostListener and @HostBinding to the new host property format. This script scans your codebase and applies the necessary changes, reducing the manual effort required for migration.</p><p>By leveraging this migration utility, you can ensure a smoother and more efficient transition to the new API without disrupting your existing functionality.</p><h3>Conclusion</h3><p>The revamped host property in Angular is a significant improvement over @HostListener and @HostBinding, offering a more streamlined and consistent approach to handling interactions with host elements. If you&#39;re still using the old decorators, now is the time to migrate and take advantage of the improved API.</p><p>For a seamless migration, check out the <a href="https://ngxtension.netlify.app/utilities/migrations/host-binding-migration/">ngxtension migration tool</a>.</p><p>Have you started using the new host property in your projects? Share your experiences and thoughts in the comments below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a7ee9a3b5ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You (don’t) need another State Management Library]]></title>
            <link>https://medium.com/@pawel.ostromecky/you-dont-need-another-state-management-library-78d92c7badcc?source=rss-63033e9abc65------2</link>
            <guid isPermaLink="false">https://medium.com/p/78d92c7badcc</guid>
            <category><![CDATA[reactive-programming]]></category>
            <category><![CDATA[rxjs]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[declarative-programming]]></category>
            <dc:creator><![CDATA[Paweł Ostromecki]]></dc:creator>
            <pubDate>Wed, 17 Jul 2024 08:06:14 GMT</pubDate>
            <atom:updated>2026-03-12T13:42:38.228Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lUjlKD4atLAnAl1dreZ5vw.jpeg" /><figcaption>Web App state layers — Joke! Just a waffles 😋 Author: DALL·E 3</figcaption></figure><p>Hi there. My name is Paweł. Today is July 17th, 2024, and this is my first article. I just wanted to mention that to come back here in the future and see my progress unless there’s no progress 😂. Recent changes in the angular ecosystem bring some thought and I’m excited to share those thoughts on state management in Angular and how recent changes might affect our approach.</p><h3><strong>The State of State Management</strong></h3><p>Web applications require managing their state — the data determining how the UI looks and behaves. Traditionally, developers reached for established libraries like NgRx or its component store variant and recently released signal store. There are some other players like NGXS or Akita. While these libraries offer robust solutions, they have a learning curve for RxJS operators, flux architecture, Redux concepts, and understanding concepts behind the library. They require a lot of boilerplate. Additionally, they are not default. Angular is a full-fledged platform for building production-ready Web applications, so why not leverage its advantages?</p><h3><strong>Some theory</strong></h3><p>Let’s think for a while about what the actual state is. We can categorize types of state by many factors, such as purpose and accessibility, but in this article, I’d like to focus on the distinction by persistence. So, we can distinguish the following types of state:</p><ol><li>Server State (which we are not interested in at the moment)</li><li>Persistent State</li><li>Transient State (sometimes called Ephemeral State)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7JGywxR__9hzTLQgU9mTyg.png" /><figcaption>State types by Persistence</figcaption></figure><p><strong>Persistent State:</strong> This type of state is stored beyond the user session, allowing the application to remember user preferences or data across sessions. It also might be responsible for storing URL-related data like query params and app contextual data accessible globally known as Global State in some globally accessible object (eg. NgRx etc.).</p><p><strong>Transient State:</strong> This type of state only exists during a user session and does not persist after the user navigates out of the page or closes the browser. Examples include:</p><ul><li>Form data entered by the user before submission.</li><li>The current selection in a dropdown menu.</li><li>The temporary visibility of a modal or tooltip.</li><li><strong>UI State:</strong> This state controls the visual aspects of the application, such as the visibility of components, the selected item in a list, or the current theme.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MUElCqiu-Q1HQPb-NzJ3sQ.png" /><figcaption>Web App state layers</figcaption></figure><p><strong>Global State vs. Local State:</strong> Global state is accessible throughout the application, while local state is specific to a particular component or view.</p><h3><strong>Beyond Global State</strong></h3><p>In the good old days, when I was a Junior Developer, my Senior told me that if you had NgRx in a project, you must do everything through the Store to keep consistency. I couldn’t disagree more, but at the time, I didn’t know it was nonsense.</p><p>But…</p><p>I liked the idea behind the Redux</p><ul><li><strong>Single source of truth</strong></li><li><strong>Unidirectional data flow</strong></li><li><strong>Immutable state at the component level</strong></li></ul><p>I still want those benefits (single source of truth, unidirectional data flow, immutable state) but with more flexibility and less boilerplate. However, a major drawback of these libraries is that the global state can become a complex data structure to maintain, especially when storing UI state for individual components. This is why tools like NgRx Component Store or Rx-Angular emerged, offering a more granular approach to state management. While these are great libraries, they introduce additional dependencies.</p><h3><strong>A little bit of practice</strong></h3><p>Let’s assume a simple example. We have a weather application with three functionalities:</p><ul><li>City search</li><li>Current weather</li><li>Weather forecast</li></ul><p>The flow is straightforward: we search for a city and then display the current weather and forecast. Additionally, we want to share city data between the current weather and forecast classes. The data model might look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*ARQXsBzX5LkuvrZrHZvG1A.png" /></figure><p>The possible implementation assumes we have a shared instance of City which is used by both CurrentWeather and WeatherForecast.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*awyfBC3SkS1HrvBpMoQoYw.png" /><figcaption>CitySearchService implementation</figcaption></figure><p>Let’s try to understand what’s happening here. We initialize a city value in the constructor, and then we listen for changes to the search$ observable, which is our <strong>source</strong>. When a change occurs, we fetch the city data. When the city$ observable emits a new value, we update the <strong>state</strong> object, which we can consider as <strong>reducer</strong>. The state object is private, so if we want to access its value, we create a <strong>selector</strong> — in this case, the city property. One thing worth noticing here is service is providedIn: &#39;root&#39; so we have one instance of the service and when we inject it into another class it receives the same instance of CitySearchServiceobject.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*9wwxOSQd8TPK1uB8OhQV3g.png" /><figcaption>Weather + Forecast implementation</figcaption></figure><p>For brevity, I included Weather and Forecast in one facade class. Of course, it could be split into separate classes to be more SOLID, but let’s focus on how we deal with the state.</p><p>We leverage the selector from the previous example. We listen to the city state, and on changes, we fetch weather and forecast data. We create selectors for both, which we can use in the component.</p><h3><strong>Summary</strong></h3><p>That’s it. We utilized signals and some basic RxJS operators to manage the Weather App state. The approach is strongly inspired by Redux solutions, so it might be familiar to developers who have used NgRx before. The advantage is that we don’t need extra dependencies to manage state, making the solution simpler and more streamlined. This method leverages Angular’s built-in features, providing a more integrated and efficient way to handle state management. By combining RxJS and signals, we achieve a maintainable and testable solution without the overhead of additional libraries. If you’re looking for a mature, production-ready approach, check out my new <a href="https://medium.com/@pawel.ostromecky/you-dont-need-another-state-management-library-vol-2-3bd37b426449"><strong>blog post</strong></a> where I walk through a practical utility that makes state management easier.</p><p><strong>Live Demo:</strong> <a href="https://weather-88364.web.app/">https://weather-88364.web.app/</a><br><strong>Repository:</strong> <a href="https://github.com/Ostromecky/weather">Ostromecky/weather: Weather Angular PWA application (github.com)</a><br><strong>Next Story: </strong><a href="https://medium.com/@pawel.ostromecky/you-dont-need-another-state-management-library-78d92c7badcc">https://medium.com/@pawel.ostromecky/you-dont-need-another-state-management-library-78d92c7badcc</a></p><h3><strong>Final Thoughts</strong></h3><ol><li>Signals are not a replacement for solutions like NgRx or RxJS. However, they can help you organize your code in a declarative way without the need to learn advanced RxJS operators, Flux architecture, or Redux concepts.</li><li>RxJS and Signals combined are powerful tools to create maintainable and testable solutions for state management in-app</li><li>The article doesn’t criticize existing solutions like NgRx, but it tries to show that there’s an alternative way before you rely on fancy libraries. Maybe you don’t need them at all.</li><li>Always try to fit tools to a problem you are facing no other way round and don’t overthink it — KISS</li></ol><h3><strong>Sources</strong></h3><ul><li><a href="https://push-based.io/article/research-on-reactive-ephemeral-state-management"><em>Reactive Ephemeral State Management Research. By Push-Based</em></a></li><li><a href="https://www.youtube.com/watch?v=R4Ff2bPiWh4"><em>My NEW default for state management in Angular (youtube.com)</em></a></li><li><a href="https://www.freecodecamp.org/news/angular-signals/">Signals in Angular — How to Write More Reactive Code (freecodecamp.org)</a></li><li><a href="https://ngrx.io/">https://ngrx.io/</a></li><li><a href="https://angularstart.com/modules/basics-of-state-management/2/">Lesson 2: Simple State Management in Angular | Angular Start</a></li><li><a href="https://www.rx-angular.io/docs/state">State | RxAngular (rx-angular.io)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78d92c7badcc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>