<?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 Manfred Steyer on Medium]]></title>
        <description><![CDATA[Stories by Manfred Steyer on Medium]]></description>
        <link>https://medium.com/@ManfredSteyer?source=rss-acb3f1945710------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4n-T8nc-Q45VXOf7.jpeg</url>
            <title>Stories by Manfred Steyer on Medium</title>
            <link>https://medium.com/@ManfredSteyer?source=rss-acb3f1945710------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 10:39:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ManfredSteyer/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[Sustainable Angular Architectures with Strategic Design and Monorepos — Part 1: Methodology]]></title>
            <link>https://medium.com/@ManfredSteyer/sustainable-angular-architectures-with-strategic-design-and-monorepos-part-1-methodology-d49033a91357?source=rss-acb3f1945710------2</link>
            <guid isPermaLink="false">https://medium.com/p/d49033a91357</guid>
            <category><![CDATA[domain-driven-design]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[ddd]]></category>
            <category><![CDATA[monorepo]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Manfred Steyer]]></dc:creator>
            <pubDate>Mon, 04 Mar 2019 00:00:00 GMT</pubDate>
            <atom:updated>2019-12-30T10:23:43.612Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sustainable Angular Architectures with Strategic Design and Monorepos — Part 1: Methodology</h3><p>Monorepos allow huge enterprise applications to be subdivided into small and maintainable libraries. This is, however, only one side of the coin: We need to first define criteria for slicing our application into individual parts and we must establish rules for communication between them.</p><p>In this article I present a methodology I’m using for subdividing big software systems into individual parts: It’s called Strategic Design and it is part of the <a href="https://www.amazon.de/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215/ref=sr_1_3?ie=UTF8&amp;qid=1551688461&amp;sr=8-3&amp;keywords=ddd">domain driven design</a> (DDD) approach. In the <a href="https://www.softwarearchitekt.at/post/2019/03/04/sustainable-angular-architectures-with-strategic-design-and-monorepos-part-1-methodology.aspx">next article</a>, show how to implement its ideas with an <a href="https://nx.dev/">Nx</a>-based monorepo.</p><blockquote>Hint: More about this topic can be found in our <a href="https://www.softwarearchitekt.at/blog">blog</a>. Also, this topic is part of our Advanced <a href="https://www.softwarearchitekt.at/schulungen/advanced-angular-enterprise-anwendungen-und-architektur/">Angular Workshop</a>.</blockquote><h3>What’s Domain Driven Design About?</h3><p>DDD describes an approach that bridges the gap between requirements for complex software systems on the one hand and a appropriate application design on the other. It can be subdivided into the disciplines Tactical Design and Strategic Design. The former proposes concrete concepts and patterns for an object-oriented design respective architecture. It has an opinionated view on using OOP. As an alternative, there are approaches like <a href="https://pragprog.com/book/swdddf/domain-modeling-made-functional">Functional Domain Modeling</a> that transfer the ideas behind it into the world of functional programming.</p><p>By contrast, strategic design deals with the breakdown of a large system into individual (sub-)domains and their design. No matter if you like DDD’s opinionated view or not, some ideas from Strategic Design have proven to be useful for subdividing a system into smaller, self-contained parts. It is exactly these ideas that this article takes up and presents in the context of Angular. Whether the remaining aspects of DDD are also taken into consideration, however, is irrelevant for the article.</p><h3>Finding Domains With Strategic Design</h3><p>One goal of Strategic Design is to identify self-contained domains. Such are recognizable by a specific vocabulary. Both domain experts and developers must rigorously use this vocabulary in order to prevents misunderstandings. As this language is also used within the code the application mirrors its domain and hence is more self-describing. DDD refers to this as the <a href="https://martinfowler.com/bliki/UbiquitousLanguage.html">ubiquitous language</a>.</p><p>Another characteristic of domains is that often one or a few groups of domain experts primarily interact with it.</p><p>To recognize domains, it is worth taking a look at the processes in the system. For example, an e-Procurement system that handles the procurement of office supplies could support the following two processes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/0*Hz22hEIu-LGi_XfS.png" /></figure><p>It is noticeable that the process steps Approve Order, Request Budget and Approve Budget primarily revolve around organizational hierarchies and the available budget. In addition, managers are primarily involved here. By contrast, the process step is primarily about employees and products.</p><p>Of course, it can be argued that products are omnipresent in an e-Procurement system. However, a closer look reveals that the word productdenotes different things in some of the process steps shown here. For example, while a product is very detailed when it is selected in the catalog, the approval process only needs to remember a few key data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C1gB7NN7kVJyxknM.png" /></figure><p>In the sense of the ubiquitous language that prevails within each domain, a distinction must be made between these two forms of a product. This leads to the creation of different models that are as concrete as possible and therefore meaningful.</p><p>At the same time, this approach prevents the creation of a single model that attempts to describe the entire world. Such models are often confusing and ambiguous. In addition, they have too many interdependencies that make decoupling and subdividing impossible.</p><p>At a logical level, the individual views of the product may still be related. If this is expressed by the same id on both sides, this works without technical dependencies.</p><p>Thus, each model is valid only within a certain scope. DDD also calls this the <a href="https://martinfowler.com/bliki/BoundedContext.html">bounded context</a>. Ideally, each domain has its own bound context. As the next section shows, however, this goal can not always be achieved when integrating third-party systems.</p><p>If we proceed with this kind of analysis we might come up with the following domains:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/0*sOKilSxAUqIS7F-N.png" /></figure><p>If you like the shown process oriented approach of identifying different domains alongside the vocabulary (entities) and groups of domain experts, you might love <a href="https://www.eventstorming.com/">Event Storming</a>. This is a workshop format where several domain experts analyze business domains together.</p><h3>Context-Mapping</h3><p>Although the individual domains are as self-contained as possible, they still have to interact from time to time. In the example considered here, the ordering domain for sending orders could access both the catalog domain and a connected ERP system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/0*h8eFQDYKwD8QoPVs.png" /></figure><p>The way these domains interact with each other is determined by a context map. In principle, Ordering and Booking could share the common model elements. In this case, however, care must be taken to ensure that one modification does not entail inconsistencies on the other.</p><p>One domain could easily use the other. In this case, however, the question arises as to who in this interaction is entitled to how much power. Can the consumer impose certain changes on the provider and insist on backward compatibility? Or does the consumer have to be satisfied with what it gets from the provider?</p><p>In the case under consideration, Catalog offers an API to prevent changes in the domain from forcibly affecting consumers. Since ordering has little impact on the ERP system, it uses an anti-corruption layer (ACR) for access. If something changes in the ERP system, it only has to update it. In addition, Strategic Design defines further strategies for the relationship between consumers and providers.</p><p>An existing system like the shown ERP system does normally not follow the idea of the bounded context. Rather, it contains several logical and intermingled sub-domains.</p><p>Another possible strategy I want to stress out here is Separate Ways, which means that a specific aspect like calculating the VAT is separately implemented in several domains:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/0*KXfZXj0Nut8ahTQD.png" /></figure><p>At first sight this seems to be awkward, especially because it leads to code redundancies and hence breaks the DRY principle (don’t repeat yourself). Nevertheless, in some situations it comes in handy because it prevents a dependency to a shared library. While preventing redundant code is an important goal preventing dependencies is as well vital. The reason is that each dependency also defines a contract and contracts are hard to change. Hence, it’s a good idea to evaluate whether an additional dependency is worth it.</p><p>As above mentioned, each domain should have its own bounded context. The example shown here contains an exception: If we have to respect an existing system like the ERP system it might contain</p><h3>Conclusion And Outlook</h3><p>Strategic Design is about identifying self-contained (sub-)domains. In each domain we find an ubiquitous language and concepts that only make sense within the domain’s bounded context. A context map shows how those domains interact with each other.</p><p>In the <a href="https://www.softwarearchitekt.at/post/2019/03/04/sustainable-angular-architectures-with-strategic-design-and-monorepos-part-2-implementation.aspx">next article</a> we’ll see we can implement those domains with an Angular using an <a href="https://nx.dev/">Nx</a>-based monorepo.</p><h3>More about this</h3><blockquote>More about this topic can be found in our <a href="https://www.softwarearchitekt.at/blog">blog</a>. Also, this topic is part of our Advanced <a href="https://www.softwarearchitekt.at/schulungen/advanced-angular-enterprise-anwendungen-und-architektur/">Angular Workshop</a>.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d49033a91357" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular Performance Tuning (Article Series)]]></title>
            <link>https://medium.com/@ManfredSteyer/angular-performance-tuning-article-series-6e3c33707b25?source=rss-acb3f1945710------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e3c33707b25</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Manfred Steyer]]></dc:creator>
            <pubDate>Wed, 10 May 2017 00:00:00 GMT</pubDate>
            <atom:updated>2017-08-31T21:21:01.289Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JlnA-Po7xSnbldZyH60Mgw.jpeg" /></figure><p><em>Originally published at </em><a href="https://www.softwarearchitekt.at/post/2017/05/10/angular-performance-tuning-roundup.aspx"><em>www.softwarearchitekt.at</em></a><em>.</em></p><p>One of the most fascinating aspects of Angular is its architecture that addresses the topic performance. While it’s really fast by default and can compete with the best in its area, there are many adjusting screws that allow for further optimization. I’m doing research on this on a regular basis and blogging about my findings. This article is considered to be a growing collection of my work.</p><p>Feel free to provide feedback as well as to ask questions.</p><ul><li><a href="https://www.softwarearchitekt.at/post/2017/08/31/clever-white-space-handling-for-better-performance-in-angular-5.aspx">Clever White Space Handling For Better Performance In Angular 5+</a></li><li><a href="https://www.softwarearchitekt.at/post/2017/07/26/shrinking-angular-bundles-with-the-angular-build-optimizer.aspx">Shrinking Angular Bundles With The Angular Build Optimizer</a></li><li><a href="https://www.softwarearchitekt.at/post/2017/07/27/the-angular-bundle-optimizer-under-the-hoods.aspx">The Angular Bundle Optimizer Under The Hoods</a></li><li><a href="https://www.softwarearchitekt.at/post/2017/06/03/shrinking-angular-bundles-with-closure.aspx">Shrinking Angular Bundles With Closure</a></li><li><a href="https://medium.com/@ManfredSteyer/performance-tuning-data-binding-in-angular-with-onpush-immutables-and-observables-9fb2734dc66e">Performance tuning Data Binding in Angular with OnPush, Immutables and Observables</a></li><li><a href="https://www.softwarearchitekt.at/post/2017/05/10/using-angular-and-aot-with-webpack.aspx">Using Angular and AOT with Webpack</a></li><li><a href="https://www.softwarearchitekt.at/post/2016/11/15/using-ngupgrade-with-aot-to-optimize-performane.aspx">Using NgUpgrade With Angular’s AOT Compiler To Optimize Performance</a></li><li><a href="https://www.softwarearchitekt.at/post/2017/04/06/lazy-loading-with-angular-material-from-ng-conf-2017-in-salt-lake-city.aspx">Lazy Loading With Angular — Material From Ng-Conf 2017 In Salt Lake City</a></li><li><a href="https://www.softwarearchitekt.at/post/2016/10/02/optimizing-performance-with-preloading-and-the-new-angular-router.aspx">Optimizing Performance With Preloading And The New Angular Router</a></li><li><a href="https://www.softwarearchitekt.at/post/2017/03/07/server-side-rendering-with-angular-4.aspx">Server Side Rendering With Angular</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e3c33707b25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance tuning Data Binding in Angular with OnPush, Immutables and Observables]]></title>
            <link>https://medium.com/@ManfredSteyer/performance-tuning-data-binding-in-angular-with-onpush-immutables-and-observables-9fb2734dc66e?source=rss-acb3f1945710------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fb2734dc66e</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Manfred Steyer]]></dc:creator>
            <pubDate>Tue, 09 May 2017 22:51:13 GMT</pubDate>
            <atom:updated>2019-12-30T10:25:35.808Z</atom:updated>
            <content:encoded><![CDATA[<p>Immutables and observables help the Angular change-tracking mechanism to identify components which have been modified. This enables an SPA to exclude unchanged components from change tracking which in turn drastically enhances performance.</p><p>Angular’s already good performance is drastically improved when immutables and observables are introduced. Thanks to its optimisation capacity, corresponding to benchmarks, Angular promises breath-taking performance even in the case of over 50,000 data bindings. Whilst a development team can cohesively use the underlying ideas, it even benefits from a selective implementation in performance-critical components.</p><p>The present article looks at this in detail, using an example to illustrate how and why Angular applications can be optimised by immutables and observables. The author lays out the <a href="https://github.com/manfredsteyer/angular2-performance">complete example here</a>.</p><blockquote>More about this topic can be found in our <a href="https://www.softwarearchitekt.at/blog">blog</a>. Also, this topic is part of our Advanced <a href="https://www.softwarearchitekt.at/schulungen/advanced-angular-enterprise-anwendungen-und-architektur/">Angular Workshop</a>.</blockquote><h3>Immutables</h3><p>The clue is in the name: immutables are data structures that cannot be modified. If objects described by them change, the entre immutable must be replaced with a new one. To discover changes, frameworks need therefore only check whether the whole immutable was modified rather than being updated on individual features. Or, to put it more technically: the framework only needs to check if the object reference has changed.</p><p>The delay method in the following example illustrates just that. Its task is to notice a 15-minute delay of the first flight of an array. So as to narrow the example’s scope, no libraries are used here which would constrain the immutables’ semantics. The example uses conventional JavaScript objects instead and refrains from changing them.</p><p>Delay defines variables out the outset which refer to the whole array and the flight concerned, calling them oldFlights and oldFlight. It also creates a date object called oldFlightDate which represents the date of the flight.</p><p>Finally, it creates three objects which reflect the new conditions. The newFlightDate object refers to the modified date. This is turn takes over the newFlight object as well as the other values of oldFlight. In addition, newFlights refers to a new array which is made up of the new flight and the rest of the unchanged flights.</p><p>To reach these flights delay uses the slice array method. Since slice returns an array with the chosen input, the EcmaScript 2015 spread operator made up of three points comes into play. It inserts the items of the array here delivered by slice directly into the subordinate array, in turn preventing an array in the array. This also illustrates that routines can take over unchanged subtrees from old immutables without modifying them.</p><p>It then stows the new array in the this.flights exit variable, thereby modfying its object reference. The debugging tasks at the end demonstrate that an application can now very easily discover changes in an array or in individual flights: one sole comparison is enough for that to happen.</p><pre>delay() {<br> <br>    const ONE_MINUTE = 1000 * 60;<br> <br>    let oldFlights = this.flights;<br>    let oldFlight = oldFlights[0];<br>    let oldFlightDate = new Date(oldFlight.date);<br> <br>    let newFlightDate = new Date(oldFlightDate.getTime() + ONE_MINUTE * 15);<br>    let newFlight =  {<br>            id: oldFlight.id,<br>            from: oldFlight.from,<br>            to: oldFlight.to,<br>            date: newFlightDate.toISOString()<br>    };<br>    let newFlights = [<br>        newFlight,<br>        ...oldFlights.slice(1)<br>    ];<br> <br>    this.flights = newFlights;<br> <br>    console.debug(&quot;Array: &quot; + (oldFlights == newFlights)); // false<br>    console.debug(&quot;#0: &quot; + (oldFlights[0] == newFlights[0])); // false<br>    console.debug(&quot;#1: &quot; + (oldFlights[1] == newFlights[1])); // true<br> <br>}</pre><h3>Data binding in Angular</h3><p>One Angular application is a component tree. The following figure shows this using a very simple example: the FlightSearch component loads an array with flights, iterates it and passes on each flight for presentation to a card component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/0*6ofXBPM0L7bK5HpQ.png" /></figure><p>Since by definition only events may change the condition of components in Angular applications, the SPA framework updates the relevant property bindings after the events have been processed.</p><h3>Immutables and Angular</h3><p>Angular traverses the entire component tree by default when updating property bindings. Thanks to immutables, Angular can nevertheless recognise the many subtrees that are unaffected by the changes and exclude these to enhance performance. The following figure illustrates this. It is based on the principle that the method described above (Listing 1) has updated the flights array as well as a flight therein. Thanks to immutables, Angular can check unconstrained whether the data passed on via the property bindings were changed.</p><p>As mentioned above, only one sole comparison per object is necessary. In the case analysed, Angular recognises that only one of the flights that have been passed on has changed and only takes into account the subtree affected by that change. It ignores all other subtrees. Since in this process the SPA framework need only follow one sole path through the tree in the best case scenario, it represents huge potential in larger component trees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/0*-5tS2vTR5DHCHWUF.png" /></figure><p>So that a component can benefit from this process, it configures the OnPush change detection strategy for its change detector via the component decorator:</p><pre>import { Flight } from &#39;../entities/flight&#39;;<br>import { Input, Component, ChangeDetectionStrategy } from &#39;@angular/core&#39;;<br> <br> @Component({<br>     selector: &#39;flight-card&#39;,<br>     templateUrl: &#39;./flight-card.component.html&#39;,<br>     changeDetection: ChangeDetectionStrategy.OnPush<br> })<br> export class FlightCard {<br>     @Input() item: Flight;<br> }</pre><p>This in turn means that Angular takes it that immutables are behind all incoming property bindings. If Angular concludes through a comparison of the object references in the property binding that the latest events carried out have not changed these objects, it excludes the whole subtree from further consideration.</p><h3>Experiments with OnPush</h3><p>To research the functioning of OnPush, there is the possibility of temporarily replacing the this.flights = newFlights; line in the delay method with the following counterpart:</p><pre>this.flights[0].date = newFlightDate.toISOString();</pre><p>This modification changes the concerned flight object directly without changing the object reference behind the array or the one behind the flight. Therefore, when OnPush is employed, Angular does not recognise the modification and the GUI remains unchanged. When OnPush is not used, Angular also recognises the direct change, since in that case it traverses the whole component tree.</p><h3>Observables and Angular</h3><p>In addition to immutables, Angular also supports observables for performance optimisation. These objects can tell Angular if a new version of a related object exists. This in turn enables components to be excluded from the tracking of modifications until they receive such a notification.</p><p>The following figure illustrates this process by representing individual flights through observables. The use of the dollar sign ($) has been introduced as a suffix to highlight this fact. Both card components continue to use the OnPush strategy. Since the reference to the transferred observables does not change, Angular excludes it from the change tracking process. In any case, when receiving a new version of the flight the application can indicate to Angular that the data binding needs to be updated. In this instance, just as when immutables are used, Angular also checks all subordinate components for change, especially verifying that the data by definition flows from the top to the bottom, and thereby also that the data can be applied further above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/0*v8QKMf8aT35oA_hI.png" /></figure><p>The following figure illustrates a similar thought experiment in this regard. It represents the array with the flights through an observable. If the FlightSearch component additionally uses the OnPush strategy, Angular firstly also excludes them from the change tracking process. If the observable flags up a new version of the array, Angular balances out the FlightSearch status with the GUI. The same is also true here of all superordinate components which are not visible on this figure. What happens in the case of subordinate card components depends on their change detection strategy. If immutables with OnPush are used here, as described above, Angular only takes into account the subtrees with changes. Otherwise it iterates all subordinate subtrees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/0*AvJfR_1Z9lrWSBrJ.png" /></figure><h3>Data binding with observables</h3><p>To illustrate the last process described above, the example explained below administers the requested flights using a ReplaySubject:</p><pre>import { ReplaySubject } from &#39;rxjs/ReplaySubject&#39;;<br>[...] <br>public flights$ = new ReplaySubject&lt;Flight[]&gt;(1);</pre><p>In the example given above, the observable directly receives data to be sent via methods and forwards them to one or more Subscriber. Furthermore, the ReplaySubject caches the last sent objects so that a new Subscriber can receive them immediately. The size of the cache can be configured via the constructor. The example sends new versions of the flight array using the next method:</p><pre>this.flights$.next(newFlights);</pre><p>Using the async pipe the observable can be used in data-binding expressions. For that it behaves like a Subscriber and takes care of GUI updates when new data arrives:</p><pre>&lt;div *ngFor=&quot;let flight of flights$ | async&quot;&gt; <br>    &lt;flight-card [item]=&quot;flight&quot;&gt;&lt;/flight-card&gt; <br>&lt;/div&gt;</pre><h3>Conclusion and outlook</h3><p>Thanks to immutables and observables Angular can be easily made aware of changed values without the need to traverse the entire component tree. As a result, in the best-case scenario only one path from the root to one of the affected nodes can be noted, and Angular need only check log(n) components rather than n components. For example, for 50,000 components this means that only a low one-figure amount of components needs to be taken into account.</p><p>To benefit from these optimisations, there is no need for an application to be based exclusively on this data structure. The development team can, rather, go with a change detection strategy per component, thereby focusing on performance-critical sections. Using immutables does take some getting used to, especially since they are not directly supported by JavaScript. Amongst others, the programmer techniques presented here offer remedies, as do libraries such as <a href="https://facebook.github.io/immutable-js/">Immutable.js</a>, <a href="https://github.com/rtfeldman/seamless-immutable">seamless-immutable</a> and <a href="https://www.npmjs.com/package/immutability-helper">immutability-helper</a>.</p><p>Anyone looking to exclude situations with optimisation needs from the get go by continuously using immutables and observables should opt for Redux implementation. Redux puts the named data structures centre stage and offers a structure for their use, thus leading not only to better performance, but also to improved sustainability. An example of such implementation is the <a href="https://github.com/ngrx/store">@ngrx/store</a> library described here which originates from one of the members of the Angular team.</p><h3>More about this</h3><blockquote>More about this topic can be found in our <a href="https://www.softwarearchitekt.at/blog">blog</a>. Also, this topic is part of our Advanced <a href="https://www.softwarearchitekt.at/schulungen/advanced-angular-enterprise-anwendungen-und-architektur/">Angular Workshop</a>.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fb2734dc66e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>