<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>Angular - Inero Software - Software Consulting</title>
	<atom:link href="https://inero-software.com/tag/angular/feed/" rel="self" type="application/rss+xml" />
	<link>https://inero-software.com/tag/angular/</link>
	<description>We unleash innovations using cutting-edge technologies, modern design and AI</description>
	<lastBuildDate>Fri, 08 Apr 2022 09:29:29 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://inero-software.com/wp-content/uploads/2018/11/inero-logo-favicon.png</url>
	<title>Angular - Inero Software - Software Consulting</title>
	<link>https://inero-software.com/tag/angular/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">153509928</site>	<item>
		<title>RxJs for beginners (5 most useful operators)</title>
		<link>https://inero-software.com/rxjs-for-beginners-5-most-useful-operators/</link>
		
		<dc:creator><![CDATA[Waldemar Korłub]]></dc:creator>
		<pubDate>Thu, 26 Nov 2020 12:45:44 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Company]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[DOM event]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[Http request]]></category>
		<category><![CDATA[Observable]]></category>
		<category><![CDATA[Operator]]></category>
		<guid isPermaLink="false">https://sandbox-www.devel.inero.com.pl/?p=3159</guid>

					<description><![CDATA[<p>This time we’re going to take a look at RxJs operators, what they do, and how you should (or shouldn’t) use it. In case you decide that in fact you want to use it then you can read the rest of the article where I go over most common use&#8230;</p>
<p>Artykuł <a href="https://inero-software.com/rxjs-for-beginners-5-most-useful-operators/">RxJs for beginners (5 most useful operators)</a> pochodzi z serwisu <a href="https://inero-software.com">Inero Software - Software Consulting</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div style="padding-top: 1rem;">This time we’re going to take a look at RxJs operators, what they do, and how you should (or shouldn’t) use it. In case you decide that in fact you want to use it then you can read the rest of the article where I go over most common use cases and usage examples.</div>
<p>WARNING: I assume that you know basics of asynchronous programming, if not then please read this before going any further: <a href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Concepts">Asynchronous Concepts</a></p>
<h3><span style="color: #511b73;"><b>So, what’s RxJs?</b></span></h3>
<p>According to the documentation:</p>
<blockquote><p>RxJS is a library for composing asynchronous and event-based programs by using observable sequences. It provides one core type, the Observable, satellite types (Observer, Schedulers, Subjects) and operators inspired by Array#extras (map, filter, reduce, every, etc) to allow handling asynchronous events as collections.</p></blockquote>
<p>In simple words, RxJs is a library which helps you in working with asynchronous tasks, events and streams and it does that by sharing some useful classes like aforementioned <em>Observable</em> and a ton of cool operators (due to my desire of keeping this post relatively short I am going to present only 5 operators that I find the most useful in my everyday work). Actually, RxJs has been so helpful to the Angular community that the Angular team decided to include it into Angular itself with the 6th version.</p>
<p>We are going to focus on <em>Observables</em> this time. <em>Observable</em> is a class that allows you to listen for events. To retrieve data from an <em>observable</em> you need to subscribe to it, when you do that it listens for events happening, so when they happen, you get the data. You can get more details on <em>observables</em> here: https://rxjs.dev/guide/observable.</p>
<p>Now let’s discuss 3 most common situations where developers are using <em>Observables</em></p>
<h4><span style="color: #511b73;"><b>Http Requests</b></span></h4>
<p>All HtttpClient methods are returning Observables and that is of course because it takes time for a server to process and return the data (or just return in case you’re sending a <em>get</em> request). That means that http request operation is asynchronous.</p>
<h4><span style="color: #511b73;"><b>DOM events</b></span></h4>
<p>Observables enable you to easily listen for DOM events like <em>click</em> or <em>keyup</em>. To listen to them you should use the <em>fromEvent</em> function that creates an <em>observable</em> accordingly. Here’s how this looks like:</p>
<p>fromEvent(document, &#8216;keyup&#8217;);</p>
<p>(Remember that if you want to receive the actual data you should subscribe to it by adding .subscribe() before semicolon)</p>
<h4><span style="color: #511b73;"><b>Stores</b></span></h4>
<p>Another very common use case for using <em>Observables</em> is using them with some kind of store, like NgRx or NgXs. Stores like that usually share observables in order to keep watch over the state of the application.</p>
<p>Now since you know the very basics like why and how, let’s get to the useful interesting stuff that can be one with RxJs operators.</p>
<h3><span style="color: #511b73;"><b>RxJs o</b></span><span style="color: #511b73;"><b>perators</b></span></h3>
<p>In our examples we are going to use simplest observable possible:</p>
<pre>const obs$ = from([1, 2, 3]); (dollar sign at the end of the variable is a naming convention used to singlaize that the variable is indeed an observable)
</pre>
<h4><span style="color: #511b73;"><b>How to use operators?</b></span></h4>
<p>Easiest way to use operators is by putting them inside a pipe. Pipe runs a function for every stream element passing by the operator, and operators are the functions that can be used within it.</p>
<h5><span style="color: #511b73;"><b>first</b></span></h5>
<p><em>First</em> operator is the first operator that we’re going to talk about (got the pun?). Most operators have self-describing titles and this case is no different. <em>First</em> operator basically allows you to listen for the first returned value of the <em>observable</em> and then stop (note that it is completely useless combined with Http requests that return the value once anyways)</p>
<pre>obs$.pipe(first()).subscribe(numbr =&gt; console.log(number));
</pre>
<p>Code above prints only 1 because it’s the first event emitted, 2 and 3 are ignored.</p>
<h5><span style="color: #511b73;"><b>tap</b></span></h5>
<p>Another useful operator worth mentioning is <em>tap</em>. Tap allows you to perform some kind of side effect for every event emission. For example you can log something or assign data to a variable (note: if you are using .subscribe it is basically the same thing).</p>
<pre>obs$.pipe(tap(numbr =&gt; console.log(number))).subscribe();
</pre>
<p>Code above prints 1, 2 and 3 because <em>tap</em> is triggered for every emitted value.</p>
<h5><span style="color: #511b73;"><b>map</b></span></h5>
<p><em>Map</em> is working the same way as in arrays. So it basically allows you to change structure of returned data. For example, let’s try to multiply every value returned by 2</p>
<pre>obs$.pipe(map(numbr =&gt; numbr * 2)).subscribe(value =&gt; console.log(value));
</pre>
<p>The code prints 2, 4 and 6 just as expected.</p>
<h5><span style="color: #511b73;"><b>startWith</b></span></h5>
<p><em>StartWIth</em> allows you to decide what first value is going to be. It is useful when you want to trigger the observable before the first event emission.</p>
<pre>obs$.pipe(startWith(999)).subscribe(value =&gt; console.log(value));
</pre>
<p>Printed values are: 999, 1, 2, 3.</p>
<h5><span style="color: #511b73;"><b>switchMap</b></span></h5>
<p><em>SwitchMap</em> is used mainly in typeahead cases but not limited to them. What it does &#8211; it cancels previous request when a new event arrives. In real life case you would for example listen for changes on the input and filter a table while typing (previous result is not relevant).<br />
To present switchMap fully &#8211; this time we are going to use a different example. <em>Observable</em> is going to be created out of DOM event keyup.</p>
<pre>const another$ = timer(1000);
fromEvent(document, 'keyup').pipe(
switchMap(() =&gt; another$)
).subscribe(() =&gt; console.log('log'));
</pre>
<p>What happens here is: After you click a button on keyboard, wait 1000 ms and then log a message. Now what happens ,if you click button 10 times quicker? Only one message is going to be logged, and that is because switchMap cancels previous timers leaving only the most recent one.</p>
<p>We went over 5 most useful operators in my opinion, described what RxJs is and discussed common use cases. I hope that this article will help you in your next project and interest you in exploring RxJs more 🙂</p>
<p><a href="https://inero-software.com/contact-us/"><strong><span style="color: #800080;">Inero Software</span></strong></a> provides knowledge and expertise on how to successfully use cutting edge technologies and data to shape corporate digital products of the future.</p>
<p><span data-contrast="auto">In the <a href="https://inero-software.com/category/blog/company/"><strong><span style="color: #800080;">blog post</span></strong></a> section, you can find other articles about our projects and more!</span><span data-ccp-props="{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p>Artykuł <a href="https://inero-software.com/rxjs-for-beginners-5-most-useful-operators/">RxJs for beginners (5 most useful operators)</a> pochodzi z serwisu <a href="https://inero-software.com">Inero Software - Software Consulting</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3159</post-id>	</item>
		<item>
		<title>Java: Scheduling the execution of background tasks using Spring</title>
		<link>https://inero-software.com/java-scheduling-the-execution-of-background-tasks-using-spring/</link>
		
		<dc:creator><![CDATA[Adrian Chojnacki]]></dc:creator>
		<pubDate>Wed, 04 Nov 2020 08:47:18 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Company]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[asynchronous]]></category>
		<category><![CDATA[backend]]></category>
		<category><![CDATA[big data]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Quartz]]></category>
		<guid isPermaLink="false">https://sandbox-www.devel.inero.com.pl/?p=3123</guid>

					<description><![CDATA[<p>Artykuł <a href="https://inero-software.com/java-scheduling-the-execution-of-background-tasks-using-spring/">Java: Scheduling the execution of background tasks using Spring</a> pochodzi z serwisu <a href="https://inero-software.com">Inero Software - Software Consulting</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3></h3>
<div class="row"><div class="col-sm-4"></div><div class="col-sm-8">
<h3><span style="color: #800080;"><strong>Planning tasks in Java</strong></span></h3>
<p><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" /><a href="https://inero-software.com/angular-how-to-manage-back-end-long-running-asynchronous-tasks/">In the last post by my teammate we presented how to manage back-end long-running asynchronous tasks from the client side.</a> This approach is used especially in handling the appropriate flow of processes and the timely implementation of specific IT system services that require significant amount of computations. From the backend implementation perspective, one of the libraries that enable task scheduling and easy integration with Java Spring applications is Quartz. In the following sections of the article, the general problem of running background tasks and a use case presenting an example solution will be described.</p>
<p><img decoding="async" data-attachment-id="2770" data-permalink="https://inero-software.com/data-the-playground-of-machine-learning/inero-glify-10-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Inero Software" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-2770 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h3><span style="color: #800080;"><strong>Description of the problem</strong></span></h3>
<p><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" />In some cases, the specification of an IT system requires long-running tasks to be performed in background. Compared to synchronous jobs where we wait for output, background jobs allow us to move on to the next job before our primary task is finished. This can be achieved by executing independent tasks in separate threads, which inform the main thread of the application when particular background job is completed. In this case, one thread can be a code block or a method that is a separate unit of work.</p>
<p>The advantages of asynchronous job scheduling tasks include:</p>
<ul>
<li>application performance,</li>
<li>responsiveness and scalability,</li>
<li>the ability to update the progress or parameters of the task,</li>
<li>productive planning of service delivery,</li>
<li>the ability to perform the following tasks without freezing the application state.</li>
</ul>
<p>However, when running background, it is important to remember to skillfully choose between asynchronous and synchronous programming. If You are dealing with simple, short-lived calculations, it is not a good idea to use background tasks. For instance, too many asynchronous calls between main thread and background can make your code less readable, may cause slow application performance or even lead to thread lock and interrupt application lifecycle.</p>
<p>Check out how we deal with such problems in our team.</p>
<p><img decoding="async" data-attachment-id="2770" data-permalink="https://inero-software.com/data-the-playground-of-machine-learning/inero-glify-10-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Inero Software" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-2770 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h3><span style="color: #800080;"><strong>Use case, solution</strong></span></h3>
<p><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" />In this post, as an example of using asynchronous programming, we will use a big data download service. Let us assume that a potential user of our website would like to transfer a certain number of files using logic provided by our backend application. As it is presented in the diagram below, the user interface allows to execute task that starts to transfer the file via request made to application server. Since we expect that this task will be a long running one, our goal is to schedule this job to be performed in background thread. Let&#8217;s have a look at details:</p>
<p>&nbsp;</p>
<h3><span style="color: #800080;"><strong><img fetchpriority="high" decoding="async" data-attachment-id="3139" data-permalink="https://inero-software.com/java-scheduling-the-execution-of-background-tasks-using-spring/tasks/" data-orig-file="https://inero-software.com/wp-content/uploads/2020/10/tasks.png" data-orig-size="1294,370" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="tasks" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2020/10/tasks-300x86.png" data-large-file="https://inero-software.com/wp-content/uploads/2020/10/tasks-1030x295.png" tabindex="0" role="button" class="aligncenter wp-image-3139 size-full" src="https://inero-software.com/wp-content/uploads/2020/10/tasks.png" alt="A drawing about how the interface works" width="1294" height="370" srcset="https://inero-software.com/wp-content/uploads/2020/10/tasks.png 1294w, https://inero-software.com/wp-content/uploads/2020/10/tasks-300x86.png 300w, https://inero-software.com/wp-content/uploads/2020/10/tasks-768x220.png 768w, https://inero-software.com/wp-content/uploads/2020/10/tasks-1030x295.png 1030w, https://inero-software.com/wp-content/uploads/2020/10/tasks-1049x300.png 1049w" sizes="(max-width: 1294px) 100vw, 1294px" /></strong></span></h3>
<p>In applications based on <a href="https://spring.io/">Spring</a>, the aforementioned Quartz library is the perfect choice. It allows you to schedule tasks depending on our needs.</p>
<p>Let&#8217;s make the following assumptions:</p>
<ul>
<li>the user can order to download several files at a time,</li>
<li>in this case, the tasks will be performed sequentially,</li>
<li>the user can  (interrupt) tasks,</li>
<li>user is provided with information about tasks, such as <em>id</em> or user data, in the database.</li>
</ul>
<p>Note that with the use of Quartz, you can execute threads simultaneously, but for the purpose of this post will used the task queue. The key interfaces used in this API are <em>Scheduler</em>, <em>Job, JobDetail, JobDataMap, Trigger</em>.</p>
<p>Initially, you need to create a <em>Scheduler</em> instance as the main interaction component. This can be done by injection into a class or by using the lines of code below.</p>
<pre>SchedulerFactory schedulerFactory = new StdSchedulerFactory();
Scheduler scheduler = schedulerFactory.getScheduler();</pre>
<p>The next step is to define an example class, in this case <em>FileDownloadJob</em>, extended by the <em>QuartzJobBean</em> class, which implements the <em>Job</em> interface. The main method <em>executeInternal()</em>,  will be called by one of the <em>Scheduler</em> threads after the <em>Trigger</em> is fired. Inside it, the target action of a given task should be performed.</p>
<pre>public class FileDownloadJob extends QuartzJobBean {

   @Override
   protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionExceptions{
       // target code of performed operations
   }
}
</pre>
<p>The job scheduling process consists of assigning a unique key &#8220;<em>JobKey&#8221;</em>, preparing a <em>JobDataMap</em> and building a<em> JobDetail</em> instance. Assuming the &#8220;<em>task&#8221;</em> object is one of the records in the task database repository, the operations in question can be performed with the following lines of code.</p>
<pre>JobKey jobKey = JobKey.jobKey((task.getId());
</pre>
<pre>JobDataMap jobData = new JobDataMap();
jobData.putAll(new HashMap&lt;&gt;() {{
 	  put("email", user.getEmail());
  	  put("name", user.getName());
          put("progress", task.getProgress());
}});
</pre>
<pre>JobDetail jobDetail = newJob().ofType(FileDownloadJob.class)
       				.withIdentity(jobKey)
      				.setJobData(jobData)
      				.build();
</pre>
<p>If we have all the details, we can fire the trigger and plan our task.</p>
<pre>Trigger trigger = newTrigger()
       .startNow()
       .build();

scheduler.scheduleJob(jobDetail, trigger);
</pre>
<p>Returning to the assumptions of the solution, consider the possibility of deleting tasks. In the Quartz library it is possible to additionally implement the <em>InterruptableJob</em> interface in our job class.</p>
<pre>public class FileDownloadJob extends QuartzJobBean implements InterruptableJob</pre>
<p>It implements the <em>interrupt()</em> method where we can stop the job.</p>
<pre>@Override
public void interrupt() {
   _interrupted = true;
}
</pre>
<p>Assuming that the operations performed inside the job are carried out in a loop, we can check the given <em>_interrupted</em> field, and for example if it is equal to <em>True</em>, terminate the job.</p>
<pre>if (_interrupted) {
   break;
}
</pre>
<p>Of course, this is just an example of a job interruption. It is fully dependent on the operations performed within the method of execution. From the <em>Scheduler</em> side, the method shown below allows us to call the <em>interrupt()</em> method inside our <em>FileDownloadJob</em> class.</p>
<pre>scheduler.interrupt(jobKey);
</pre>
<p>Another functionality is the sequential execution of tasks. This can be implemented in various ways, such as <em>JobListener</em> or smart use of <em>JobDataMap</em>. In our use case, we choose the second option, due to the possibility of further expansion, i.e. updating progress, stopping and resuming tasks.<br />
Let&#8217;s add another field in our map and fill it with the <em>id</em> of the next job, assuming that all information about the tasks is stored in the database.</p>
<pre>jobDataMap.put("nextJob", nextTask.getId());
</pre>
<p>Thanks to this, when we finish the operation of the first job, we can check if there is a unique key in the &#8220;<em>nextJob&#8221;</em> field of <em>JobDataMap</em>. If so, we move on to the next task. If we would like to add the functionality of changing the order of task execution, we could define another &#8220;<em>previousTask&#8221;</em> field storing the <em>id</em> of the previous task. Based on this, we could define appropriate methods to modify the queue position. In addition, in our map we can store the previously mentioned information about the current data download process and update it via REST endpoints in the client interface.</p>
<p><img decoding="async" data-attachment-id="2770" data-permalink="https://inero-software.com/data-the-playground-of-machine-learning/inero-glify-10-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Inero Software" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-2770 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h3><span style="color: #800080;"><strong>Java Scheduling &#8211; Summary</strong></span></h3>
<p>Asynchronous programming is an essential element in delivering some IT system services. However, it should be remembered that the use of background tasks should be carefully selected for the problem in order to avoid unnecessary conflicts or system overload. If you are using Java, the Quartz library is a good choice that allows you to easily integrate the planning process with our application. Try this!</p>
<p></p></div><div class="col-sm-4"></div></div>
<h3></h3>
<p>Artykuł <a href="https://inero-software.com/java-scheduling-the-execution-of-background-tasks-using-spring/">Java: Scheduling the execution of background tasks using Spring</a> pochodzi z serwisu <a href="https://inero-software.com">Inero Software - Software Consulting</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3123</post-id>	</item>
		<item>
		<title>Angular: How to manage back-end long-running asynchronous tasks</title>
		<link>https://inero-software.com/angular-how-to-manage-back-end-long-running-asynchronous-tasks/</link>
		
		<dc:creator><![CDATA[Waldemar Korłub]]></dc:creator>
		<pubDate>Tue, 20 Oct 2020 13:48:28 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Company]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[asynchronous]]></category>
		<category><![CDATA[backend]]></category>
		<category><![CDATA[DeliverM8]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[websockets]]></category>
		<guid isPermaLink="false">https://sandbox-www.devel.inero.com.pl/?p=3080</guid>

					<description><![CDATA[<p>Today we’re going to talk about managing back-end long-running asynchronous tasks in Angular. This term may seem long and scary to you, but don’t freak out. After reading this article you’re going to be familiar with this concept and even be able to handle this use case in your own&#8230;</p>
<p>Artykuł <a href="https://inero-software.com/angular-how-to-manage-back-end-long-running-asynchronous-tasks/">Angular: How to manage back-end long-running asynchronous tasks</a> pochodzi z serwisu <a href="https://inero-software.com">Inero Software - Software Consulting</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><br />
Today we’re going to talk about managing back-end long-running asynchronous tasks in Angular. This term may seem long and scary to you, but don’t freak out. After reading this article you’re going to be familiar with this concept and even be able to handle this use case in your own projects.</p>
<h3><span style="color: #511b73;"><b>Why Angular?</b></span></h3>
<p>At Inero Software we are using Angular at the front-end side of most of our projects and that is not without a reason.</p>
<p><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<ul>
<li>It is suitable for big software systems because of its component-based architecture which provides a higher quality of code, better maintainability, and code reusability.</li>
<li>Native Typescript support, Typescript means Types and that means safer code.</li>
<li>Angular, unlike other frameworks, is fully stacked with predefined solutions to problems you may approach, you don’t have to think about which library to use for every single implementation case whether it be routing, reactive programming, or making Http requests.</li>
</ul>
<p><img loading="lazy" decoding="async" data-attachment-id="1596" data-permalink="https://inero-software.com/?attachment_id=1596" data-orig-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-software-glify-10" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-1596 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h3><span style="color: #511b73;"><b>What’s a back-end long-running asynchronous task?</b></span></h3>
<p><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" />The easiest way to understand what’s a back-end long-running asynchronous task is to explain it with an example of our product which possesses this kind of task.</p>
<p>At <a href="https://inero-software.com/inero-software-team-work/">Inero Software</a> we are developing a product called <a href="http://deliverm8.com">DeliverM8</a> which is a delivery optimization platform. It has many functionalities but let’s focus on the important one for today&#8217;s article. Imagine that you run a company that is delivering products all around the country. You need a system that would display to you how many products and which products to put onto a truck and also <i>how</i> should they be ordered so that everything fits nicely.</p>
<p>Input requires the following data:</p>
<ul>
<li>How many products should be delivered?</li>
<li>What are their sizes?</li>
<li>Where do they go? (so we know which products should be on the beginning or end of the truck etc.)</li>
</ul>
<p>The output is a 3d visualization which looks like this:</p>
<p><img loading="lazy" decoding="async" data-attachment-id="3093" data-permalink="https://inero-software.com/angular-how-to-manage-back-end-long-running-asynchronous-tasks/deliverm8_packing_example/" data-orig-file="https://inero-software.com/wp-content/uploads/2020/10/DeliverM8_Packing_Example.png" data-orig-size="1280,720" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="DeliverM8_Packing_Example" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2020/10/DeliverM8_Packing_Example-300x169.png" data-large-file="https://inero-software.com/wp-content/uploads/2020/10/DeliverM8_Packing_Example-1030x579.png" tabindex="0" role="button" class="aligncenter wp-image-3093 size-full" src="https://inero-software.com/wp-content/uploads/2020/10/DeliverM8_Packing_Example.png" alt="A visualisation of elements" width="1280" height="720" srcset="https://inero-software.com/wp-content/uploads/2020/10/DeliverM8_Packing_Example.png 1280w, https://inero-software.com/wp-content/uploads/2020/10/DeliverM8_Packing_Example-300x169.png 300w, https://inero-software.com/wp-content/uploads/2020/10/DeliverM8_Packing_Example-768x432.png 768w, https://inero-software.com/wp-content/uploads/2020/10/DeliverM8_Packing_Example-1030x579.png 1030w, https://inero-software.com/wp-content/uploads/2020/10/DeliverM8_Packing_Example-533x300.png 533w" sizes="(max-width: 1280px) 100vw, 1280px" /></p>
<p>As you may imagine &#8211; it does take time for a backend service to create output like this, the AI that stands behind <a href="https://inero-software.com/machine-learning-professionals/">DeliverM8</a> logic runs millions of operations per second in order to find the best optimal available element arrangement. This is <b>the back-end long-running asynchronous task</b>. Depending on the input this may take up to <b>10 minutes </b>and of course freezing of the frontend application until the data is retrieved is the last thing that we need, so what should we do?</p>
<p><img loading="lazy" decoding="async" data-attachment-id="1596" data-permalink="https://inero-software.com/?attachment_id=1596" data-orig-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-software-glify-10" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-1596 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h3><span style="color: #511b73;"><b>Approaches</b></span></h3>
<p>A DISCLAIMER: All examples are made with Angular, but the concepts mentioned below can easily be applied to any other frameworks/languages.</p>
<h4><span style="color: #511b73;"><b>Synchronous</b></span></h4>
<p>Probably the worst option out there but should be mentioned nevertheless. If in fact, the user shouldn’t be using the application, while he is waiting for the response, then you can just put some kind of modal loading screen while the user awaits the data and the problem is solved.</p>
<h5><span style="color: #511b73;">How:</span></h5>
<p>You send a single POST request that tells the backend to start the calculations and return the data within the response of the beforementioned request.</p>
<h5><span style="color: #511b73;"><b>Example:</b></span></h5>
<pre>public loadTrucks(loadTruckData): Observable&lt;Route[]&gt; {
return this.http.post&lt;Route[]&gt;('/api/load-trucks', loadTruckData);
}
</pre>
<p><img loading="lazy" decoding="async" data-attachment-id="1596" data-permalink="https://inero-software.com/?attachment_id=1596" data-orig-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-software-glify-10" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-1596 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h4><span style="color: #511b73;"><b>Polling</b></span></h4>
<p>Now polling is a slightly better option if the user wants to use the application while the data is loading and you don’t have that much time to invest in the solution and/or your backend is not providing you with WebSockets then polling is the way to go.</p>
<p>Polling means checking the status of (a backend endpoint in this case ), especially as part of a repeated cycle. Translating it to front-end language means making a get request every few seconds to see if the asynchronous task is finished. For backend that would mean creating a new GET endpoint that would return the calculated data. (if in fact it has been calculated before)</p>
<p>Not the most elegant solution out there but still pretty usable!</p>
<h5><span style="color: #511b73;"><b>How:</b></span></h5>
<p>We make one POST request that informs the backend to start the calculations and one more GET request to get the output data.</p>
<p>One of the ways of polling is combining RxJs’s <i>timer</i> with <i>switchMap</i>. Also remember to unsubscribe, because all sorts of intervals can easily produce memory leaks, in this example, we are using <i>takeUntil</i> operator that unsubscribes from the observable when it’s component is destroyed.</p>
<h5><span style="color: #511b73;"><b>Example:</b></span></h5>
<pre>timer(0, 5000).pipe( switchMap(() =&gt; this.truckService.getLoadedTrucks()), takeUntil(this.stopPolling) )
</pre>
<p><img loading="lazy" decoding="async" data-attachment-id="1596" data-permalink="https://inero-software.com/?attachment_id=1596" data-orig-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-software-glify-10" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-1596 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h4><span style="color: #511b73;"><b>Websockets</b></span></h4>
<p>Websocket is a communication protocol (just like HTTP) “for a persistent, bi-directional, full duplex TCP connection from a user’s web browser to a server”. Basically what it means is that with WebSockets you can send out the data from the server and receive it in your frontend application without making any unnecessary requests (like you would using polling).</p>
<p>With the Websocket approach, you would send an HTTP POST request to start calculating the truckload. And at the same time, you would establish a WebSocket connection between the Frontend application and the server so that when the backend tasks finish the output is sent through that WebSocket connection.</p>
<h5><span style="color: #511b73;"><b>How:</b></span></h5>
<p>Send HTTP POST request that informs the backend to start the calculations and listen on Websocket connection with a backend that returns data when the calculations finish</p>
<h5><span style="color: #511b73;">Example:</span></h5>
<p>At first, you connect to a WebSocket:</p>
<pre>public connect() {
const socket = new <b><i>WebSocket</i></b>(this.webSocketUri);
this.stompClient = Stomp.over(socket);
this.stompClient.connect({},
() =&gt; this.subscribe()
}

</pre>
<p>And later on, you subscribe to its values:</p>
<pre>this.stompClient.subscribe('/user/queue/truck-load-updates-queue', (msg: Stomp.Frame) =&gt; {
const msgBody = <b><i>JSON</i></b>.parse(msg.body);
...
});
</pre>
<p>The subscription above is triggered after the calculation is done.<br />
<img loading="lazy" decoding="async" data-attachment-id="1596" data-permalink="https://inero-software.com/?attachment_id=1596" data-orig-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-software-glify-10" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-1596 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h3><span style="color: #511b73;"><b>Conclusion</b></span></h3>
<p>That’s it!</p>
<p>I’ve described to you the problem of back-end long-running asynchronous tasks and various ways of handling them in the frontend application.</p>
<p>Websockets are the best way to go if you are struggling with this problem, but if the user doesn’t mind getting his application blocked (or maybe it is intended to block the app for the time being) for the time when the backend is performing its tasks then you can simply go with KISS principle and just make one synchronous request.</p>
<p>Polling is also an option if the developers don’t feel like implementing WebSockets and additional network movement is of no concern.</p>
<p>Thanks for reading! And I hope you liked the article 🙂</p>
<p>Artykuł <a href="https://inero-software.com/angular-how-to-manage-back-end-long-running-asynchronous-tasks/">Angular: How to manage back-end long-running asynchronous tasks</a> pochodzi z serwisu <a href="https://inero-software.com">Inero Software - Software Consulting</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3080</post-id>	</item>
		<item>
		<title>Redistribution supply chain network</title>
		<link>https://inero-software.com/redistribution-supply-chain-network/</link>
		
		<dc:creator><![CDATA[Adrian Chojnacki]]></dc:creator>
		<pubDate>Tue, 13 Oct 2020 14:44:44 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Company]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[Artificial Intelligence]]></category>
		<category><![CDATA[Cargo flow]]></category>
		<category><![CDATA[DeliverM8]]></category>
		<category><![CDATA[Heuristic Methods]]></category>
		<category><![CDATA[Java Spring]]></category>
		<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[Redistribution Network]]></category>
		<category><![CDATA[Supply Chain]]></category>
		<guid isPermaLink="false">https://sandbox-www.devel.inero.com.pl/?p=2998</guid>

					<description><![CDATA[<p>Redistribution supply chain network  (RSCN) &#8211; modelling and optimization One of our teams field of specialization is the use of artificial intelligence for modeling and optimizing complex transport models. From the practical point of view, the optimal planning of transport resources and supervision of their implementation is one of the&#8230;</p>
<p>Artykuł <a href="https://inero-software.com/redistribution-supply-chain-network/">Redistribution supply chain network</a> pochodzi z serwisu <a href="https://inero-software.com">Inero Software - Software Consulting</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3><span style="color: #800080;"><strong>Redistribution supply chain network  (RSCN) &#8211; modelling and optimization</strong></span></h3>
<h4></h4>
<p><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<p><span data-contrast="auto">One of our teams field of specialization is the use of artificial intelligence for modeling and optimizing complex transport models. From the practical point of view, the optimal planning of transport resources and supervision of their implementation is one of the key tasks in the area of ​​supply chain management.  </span><span data-contrast="auto">In this type of solutions, <a href="https://inero-software.com/machine-learning-professionals/">using artificial intelligence</a> and advanced computing IT systems can bring  observable</span><span data-contrast="auto"> benefits</span><span data-contrast="auto">. One of the solutions this post refers to is the </span><span data-contrast="auto">optimization </span><span data-contrast="auto">of redistribution network of the supply chain (RCSN).</span></p>
<p><img decoding="async" data-attachment-id="2770" data-permalink="https://inero-software.com/data-the-playground-of-machine-learning/inero-glify-10-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Inero Software" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-2770 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h3><span style="color: #800080;"><strong><span class="TextRun SCXW152906754 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW152906754 BCX0">Pros, cons and uses</span></span></strong></span></h3>
<p><span class="TextRun SCXW96807580 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW96807580 BCX0"><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" />RCSN is an alternative to the centralized distribution networks (CDN) that consist of one central warehouse for the storage and distribution of goods. CDN is effective if we carry out large, repetitive orders to destinations that are close to each other. If our supply chain get&#8217;s more complicated we can add some a number of local warehouses to place the goods closer to final destination. While the CDN generally simplifies transport management, it does not allow to optimally distribute costs of supply for complicated logistic models. Though the RCSN is more complex and more expensive to manage compared to the classic versions of warehousing, with the support of a specified IT solutions it guarantees a stable level of services, maintaining the performance of order management and distribution.</span></span><span class="EOP SCXW96807580 BCX0" data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559731&quot;:708,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p>&nbsp;</p>
<p><img decoding="async" data-attachment-id="2770" data-permalink="https://inero-software.com/data-the-playground-of-machine-learning/inero-glify-10-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Inero Software" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-2770 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h3><span style="color: #800080;"><strong>Use case</strong></span></h3>
<p><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<p><span class="TextRun SCXW187513915 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW187513915 BCX0">In this article, we will show <a href="https://inero-software.com/inero-software-team-work/">how Inero Software team deals with the above-mentioned problems</a> in an example use case. Let&#8217;s assume that we have a company with many branches and we need to exchange the necessary materials between them for proper functioning. To optimize costs and efficiency, we don&#8217;t always need to complete another large order from the supplier, but </span></span><span class="TextRun SCXW187513915 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW187513915 BCX0">we</span></span><span class="TextRun SCXW187513915 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW187513915 BCX0"> exchange materials between nearby branches. It is a much better and faster solution, and one of the most important aspects is that it minimizes the workload.</span></span><span class="EOP SCXW187513915 BCX0" data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559731&quot;:360,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p><span data-contrast="auto">Let us assume, that in our showcase , we have 4 drivers and 40 company branches between, where each branch belongs to 1 of 4 groups( indicated by pin color in figure below). In the given use case, it was assumed that the goods may be stored and exchanged only between locations from the same group (a pin of the same color on the map), but the transport flow must be maximized between all locations. In order to optimize the total supply chain, it was assumed that the closest locations in a given group are the warehouses in the vincity of the particular driver&#8217;s home-base. This means that before the commodities are exchanged between individual points, the driver must pick up the goods from the defined warehouse and store them at the end of the daily route.</span><span data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559731&quot;:360,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p><span data-contrast="auto">In addition, when generating routes by the system, optimization algorithms takes under consideration following constraints: </span></p>
<ul>
<li data-leveltext="" data-font="Symbol" data-listid="2" aria-setsize="-1" data-aria-posinset="1" data-aria-level="1"><span data-contrast="auto">each driver starts and finishes his/hers route at the warehouse. This means that the driver cannot leave any goods in the car for the night</span><span data-ccp-props="{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> before/after the route;</span></li>
<li data-leveltext="" data-font="Symbol" data-listid="2" aria-setsize="-1" data-aria-posinset="1" data-aria-level="1"><span data-contrast="auto">goods are intended to be transferred among one group and cannot not be stored in the local warehouse (destination) of other groups. However, commodities dedicated for different groups, can be transported by the same vehicle;</span></li>
<li data-leveltext="" data-font="Symbol" data-listid="2" aria-setsize="-1" data-aria-posinset="1" data-aria-level="1">every destination (location) can be considered as a local warehouse;</li>
<li data-leveltext="" data-font="Symbol" data-listid="2" aria-setsize="-1" data-aria-posinset="1" data-aria-level="1">the driver cannot exceed the driving time and daily mileage limit;</li>
</ul>
<p><span data-contrast="auto">Moreover, some other specific limitations can be defined in the system, e.g. that the driver can only move in a restricted area, maximum 9 hours a day, can be defined. In this context </span><strong>the goal of the optimization is to maximize cargo flow between different branches of the company. </strong></p>
<p><span data-contrast="auto">The picture below shows an example of the result <a href="http://deliverm8.com">optimization of redistributing goods using our solutions. </a></span><span data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p><img loading="lazy" decoding="async" data-attachment-id="4557" data-permalink="https://inero-software.com/redistribution-supply-chain-network/step1-kompres-3/" data-orig-file="https://inero-software.com/wp-content/uploads/2020/10/step1-kompres.jpg" data-orig-size="1898,932" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="step1 kompres" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2020/10/step1-kompres-300x147.jpg" data-large-file="https://inero-software.com/wp-content/uploads/2020/10/step1-kompres-1030x506.jpg" tabindex="0" role="button" class="aligncenter wp-image-4557 size-full" src="https://inero-software.com/wp-content/uploads/2020/10/step1-kompres.jpg" alt="Visualisation of the system" width="1898" height="932" srcset="https://inero-software.com/wp-content/uploads/2020/10/step1-kompres.jpg 1898w, https://inero-software.com/wp-content/uploads/2020/10/step1-kompres-300x147.jpg 300w, https://inero-software.com/wp-content/uploads/2020/10/step1-kompres-1030x506.jpg 1030w, https://inero-software.com/wp-content/uploads/2020/10/step1-kompres-768x377.jpg 768w, https://inero-software.com/wp-content/uploads/2020/10/step1-kompres-1536x754.jpg 1536w, https://inero-software.com/wp-content/uploads/2020/10/step1-kompres-611x300.jpg 611w" sizes="(max-width: 1898px) 100vw, 1898px" /></p>
<p><span data-contrast="auto">As you can see in the picture above, the system has generated a driving plan for each driver for each day of the week. Thanks to this, we can ensure the exchange of the necessary goods in a given area, even several times a week.</span><span data-contrast="auto"> </span><span data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p><span data-contrast="auto">As part of defining individual locations of the </span><span data-contrast="auto">local warehouses</span><span data-contrast="auto">, each of them was given a unique id in the range 10-49.  The illustration below shows the generated driver&#8217;s work plan divided into individual days.</span><span data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p><img loading="lazy" decoding="async" data-attachment-id="3009" data-permalink="https://inero-software.com/redistribution-supply-chain-network/plan/" data-orig-file="https://inero-software.com/wp-content/uploads/2020/10/plan.png" data-orig-size="1918,938" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Redistribution Supply Chain Network" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2020/10/plan-300x147.png" data-large-file="https://inero-software.com/wp-content/uploads/2020/10/plan-1030x504.png" tabindex="0" role="button" class="aligncenter wp-image-3009 size-full" src="https://inero-software.com/wp-content/uploads/2020/10/plan.png" alt="result of the optimization of redistributing goods" width="1918" height="938" srcset="https://inero-software.com/wp-content/uploads/2020/10/plan.png 1918w, https://inero-software.com/wp-content/uploads/2020/10/plan-300x147.png 300w, https://inero-software.com/wp-content/uploads/2020/10/plan-768x376.png 768w, https://inero-software.com/wp-content/uploads/2020/10/plan-1030x504.png 1030w, https://inero-software.com/wp-content/uploads/2020/10/plan-613x300.png 613w" sizes="(max-width: 1918px) 100vw, 1918px" /></p>
<p><span data-contrast="auto">It can be seen that the simulation requirements were met. If we visit a certain group on a given day, we initially pick up the goods and finally store them in the same unit belonging to the same group. </span><span data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p><span data-contrast="auto">If the problem would require the exchange of goods between larger areas, e.g. from the western part of Poland to the northern part, etc., the implemented software could be extended with drivers&#8217; meeting points and the exchange. Then, the cargo can be delivered depending on the demand to specific branches of the company. This process is based on the previously generated solution. The system&#8217;s algorithms determine which locations have been selected for drivers&#8217; routes. On this basis, the route-based, the system finds the closest point on the map where drivers can potentially meet. If there are such places, they are added at certain times, (e.g. 12pm to 1pm, Monday) to the driver&#8217;s schedule. In the next stages, the system intelligently selects the remaining locations, maintaining continuity and increasing the area of exchange.</span></p>
<p><img loading="lazy" decoding="async" data-attachment-id="4561" data-permalink="https://inero-software.com/redistribution-supply-chain-network/meet_2-kompres/" data-orig-file="https://inero-software.com/wp-content/uploads/2020/10/meet_2-kompres.jpg" data-orig-size="1299,777" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="meet_2 kompres" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2020/10/meet_2-kompres-300x179.jpg" data-large-file="https://inero-software.com/wp-content/uploads/2020/10/meet_2-kompres-1030x616.jpg" tabindex="0" role="button" class="aligncenter wp-image-4561" src="https://inero-software.com/wp-content/uploads/2020/10/meet_2-kompres.jpg" alt="Route on the map" width="1229" height="735" srcset="https://inero-software.com/wp-content/uploads/2020/10/meet_2-kompres.jpg 1299w, https://inero-software.com/wp-content/uploads/2020/10/meet_2-kompres-300x179.jpg 300w, https://inero-software.com/wp-content/uploads/2020/10/meet_2-kompres-1030x616.jpg 1030w, https://inero-software.com/wp-content/uploads/2020/10/meet_2-kompres-768x459.jpg 768w, https://inero-software.com/wp-content/uploads/2020/10/meet_2-kompres-502x300.jpg 502w" sizes="(max-width: 1229px) 100vw, 1229px" /></p>
<p><img loading="lazy" decoding="async" data-attachment-id="3007" data-permalink="https://inero-software.com/redistribution-supply-chain-network/meet_1/" data-orig-file="https://inero-software.com/wp-content/uploads/2020/10/meet_1.png" data-orig-size="1231,803" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="meet_1" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2020/10/meet_1-300x196.png" data-large-file="https://inero-software.com/wp-content/uploads/2020/10/meet_1-1030x672.png" tabindex="0" role="button" class="aligncenter wp-image-3007 size-full" src="https://inero-software.com/wp-content/uploads/2020/10/meet_1.png" alt="routes on the map" width="1231" height="803" srcset="https://inero-software.com/wp-content/uploads/2020/10/meet_1.png 1231w, https://inero-software.com/wp-content/uploads/2020/10/meet_1-300x196.png 300w, https://inero-software.com/wp-content/uploads/2020/10/meet_1-768x501.png 768w, https://inero-software.com/wp-content/uploads/2020/10/meet_1-1030x672.png 1030w, https://inero-software.com/wp-content/uploads/2020/10/meet_1-460x300.png 460w" sizes="(max-width: 1231px) 100vw, 1231px" /></p>
<p><span data-contrast="auto">The figure below shows the location of meeting points on the Monday route for drivers&#8217; routes (</span><i><span data-contrast="auto">Szczecin &#8211; Gdańsk</span></i><span data-contrast="auto">) and (</span><i><span data-contrast="auto">Wrocław &#8211; Legionowo</span></i><span data-contrast="auto">).  </span><span data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p><span data-contrast="auto">Cargo swap points have been given a unique id to include them along the route.</span><span data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<ul>
<li data-leveltext="" data-font="Symbol" data-listid="1" aria-setsize="-1" data-aria-posinset="1" data-aria-level="1"><span data-contrast="auto">(</span><i><span data-contrast="auto">Szczecin – Gdańsk</span></i><span data-contrast="auto">)</span><span data-contrast="auto"> &#8211; 100,</span><span data-ccp-props="{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></li>
<li data-leveltext="" data-font="Symbol" data-listid="1" aria-setsize="-1" data-aria-posinset="2" data-aria-level="1"><span data-contrast="auto">(</span><i><span data-contrast="auto">Legionowo – Wrocław</span></i><span data-contrast="auto">)</span><span data-contrast="auto"> &#8211; 101.</span></li>
</ul>
<p><img loading="lazy" decoding="async" data-attachment-id="3010" data-permalink="https://inero-software.com/redistribution-supply-chain-network/plan_2/" data-orig-file="https://inero-software.com/wp-content/uploads/2020/10/plan_2.png" data-orig-size="1893,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="plan_2" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2020/10/plan_2-300x26.png" data-large-file="https://inero-software.com/wp-content/uploads/2020/10/plan_2-1030x89.png" tabindex="0" role="button" class="aligncenter wp-image-3010 size-full" src="https://inero-software.com/wp-content/uploads/2020/10/plan_2.png" alt="routes on the map" width="1893" height="163" srcset="https://inero-software.com/wp-content/uploads/2020/10/plan_2.png 1893w, https://inero-software.com/wp-content/uploads/2020/10/plan_2-300x26.png 300w, https://inero-software.com/wp-content/uploads/2020/10/plan_2-768x66.png 768w, https://inero-software.com/wp-content/uploads/2020/10/plan_2-1030x89.png 1030w, https://inero-software.com/wp-content/uploads/2020/10/plan_2-1400x121.png 1400w" sizes="(max-width: 1893px) 100vw, 1893px" /></p>
<p><span class="TextRun SCXW247470407 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW247470407 BCX0">As you can see, meetings are held at designated times. Thanks to this operation, we exchange goods between larger areas, and in the next days we can distribute it to other locations.</span></span><span class="EOP SCXW247470407 BCX0" data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p><img decoding="async" data-attachment-id="2770" data-permalink="https://inero-software.com/data-the-playground-of-machine-learning/inero-glify-10-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Inero Software" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-2770 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h3><strong><span style="color: #800080;">Solution</span></strong></h3>
<p><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<p><span class="TextRun SCXW104707151 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW104707151 BCX0">In our solutions, we use <a href="https://inero-software.com/machine-learning-professionals/">methods and techniques of artificial intelligence to model the problem of redistribution of goods</a> and then optimize the commodities flow in distributed network. In situations where a large amount of calculations is required, various heuristic methods come to the rescue. They allow to </span></span><span class="TextRun SCXW104707151 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW104707151 BCX0">minimize</span></span><span class="TextRun SCXW104707151 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW104707151 BCX0"> calculation costs and speeding up finding the optimal solution. Heuristic searches are suitable for complex problems. The </span></span><span class="TextRun SCXW104707151 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW104707151 BCX0">artificial intelligence estimates quality of available solutions</span></span><span class="TextRun SCXW104707151 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW104707151 BCX0">, and every iteration </span></span><span class="TextRun SCXW104707151 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW104707151 BCX0">improves </span></span><span class="TextRun SCXW104707151 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW104707151 BCX0">output result.</span></span><span class="TextRun SCXW104707151 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW104707151 BCX0"> </span></span><span class="TextRun SCXW104707151 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW104707151 BCX0">I</span></span><span class="TextRun SCXW104707151 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW104707151 BCX0">n the case of a logistic redistribution network, every step of the</span></span><span class="TextRun SCXW104707151 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW104707151 BCX0"> optimization</span></span><span class="TextRun SCXW104707151 BCX0" lang="EN-GB" xml:lang="EN-GB" data-contrast="auto"><span class="NormalTextRun SCXW104707151 BCX0">, extends the resulting node (i.e. in our case the route) with the node with the lowest value of the predefined evaluation function.</span></span><span class="EOP SCXW104707151 BCX0" data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p><span data-contrast="auto">In our solutions, for example, we use the greedy algorithm. The model at each step makes the optimal choice at the moment, based on the given evaluation function. In the case of transport problems, it will certainly be the number of kilometres imposed converted into costs compared to the current fuel price. The algorithm, by adding new customers along the route, makes the optimal </span><span data-contrast="auto">decision</span><span data-contrast="auto">, i.e. the cheapest one at the moment.</span><span data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p><span data-contrast="auto">The simplest form of the evaluation function can be defined as:</span><span data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<pre>cost = new_distance - current_distance</pre>
<p>where:</p>
<p><em>new_distance</em><span data-contrast="auto"> – total distance to the new point from the driver’s location,</span><span data-ccp-props="{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p><span data-contrast="auto"><em>current_distance</em> –</span><span data-contrast="auto"> current distance, from the driver&#8217;s location to the actually last point.</span><span data-ccp-props="{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p><img decoding="async" data-attachment-id="2770" data-permalink="https://inero-software.com/data-the-playground-of-machine-learning/inero-glify-10-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Inero Software" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-2770 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h3><strong><span style="color: #800080;">Summary</span></strong></h3>
<p><span style="text-indent: 0em;" data-contrast="auto">The use of IT systems supporting the supply chain redistribution network definitely allows for an optimized flow of goods. In addition, it can provide many additional analytical tools, such as:</span><span style="text-indent: 0em;" data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<ul>
<li data-leveltext="" data-font="Symbol" data-listid="15" aria-setsize="-1" data-aria-posinset="1" data-aria-level="1"><span data-contrast="auto">order and invoice reports,</span></li>
<li data-leveltext="" data-font="Symbol" data-listid="15" aria-setsize="-1" data-aria-posinset="1" data-aria-level="1"><span data-contrast="auto">archiving statistics,</span></li>
<li data-leveltext="" data-font="Symbol" data-listid="15" aria-setsize="-1" data-aria-posinset="1" data-aria-level="1"><span data-contrast="auto">delivery time information system,</span><span data-ccp-props="{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></li>
</ul>
<p><span data-contrast="auto">and many others tailored to customer needs&#8230;</span><span data-ccp-props="{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}"> </span></p>
<p><img decoding="async" data-attachment-id="2770" data-permalink="https://inero-software.com/data-the-playground-of-machine-learning/inero-glify-10-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Inero Software" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-2770 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/05/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<p>Artykuł <a href="https://inero-software.com/redistribution-supply-chain-network/">Redistribution supply chain network</a> pochodzi z serwisu <a href="https://inero-software.com">Inero Software - Software Consulting</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2998</post-id>	</item>
		<item>
		<title>What&#8217;s after Angular?</title>
		<link>https://inero-software.com/whats-after-angular/</link>
		
		<dc:creator><![CDATA[Waldemar Korłub]]></dc:creator>
		<pubDate>Thu, 16 Jul 2020 07:40:35 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Company]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[flutter]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[react]]></category>
		<category><![CDATA[reactivity]]></category>
		<category><![CDATA[svelte]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[webassembly]]></category>
		<category><![CDATA[webcomponents]]></category>
		<guid isPermaLink="false">https://sandbox-www.devel.inero.com.pl/?p=2905</guid>

					<description><![CDATA[<p>&#160; The frontend world is currently ruled by 3 colossuses known as Angular, React.js, and Vue.js, but are there any other alternatives? And if so, are they worth using? Let’s take a quick look at what else is out there as we see it in our team. The Standard Besides&#8230;</p>
<p>Artykuł <a href="https://inero-software.com/whats-after-angular/">What&#8217;s after Angular?</a> pochodzi z serwisu <a href="https://inero-software.com">Inero Software - Software Consulting</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>&nbsp;</p>
<p>The frontend world is currently ruled by 3 colossuses known as Angular, React.js, and Vue.js, but are there any other alternatives?</p>
<p>And if so, are they worth using? Let’s take a quick look at what else is out there as we see it in <a href="https://inero-software.com/inero-software-team-work/">our team</a>.</p>
<h3><span style="color: #511b73;"><b>The Standard</b></span></h3>
<p><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" />Besides Angular (my main go-to when it comes to the frontend development) there is its main rival &#8211; React. <a href="https://www.g2i.co/blog/react-separation-of-concerns">Since React is a library not a framework like Angular, by definition it gives you more freedom when it comes to the composition of your application and development style that you want to approach</a>. React is known for its JSX syntax which allows you to mix javascript with HTML and CSS code.</p>
<p>Vue.js is different from React in this matter. It is structured like web-component so it’s separated into js, CSS, and HTML. Another thing that differs Vue.js from Angular and React.js is its origin. Vue is the only “independent” framework. What do I mean by that? There is no big company behind it like in other cases where Angular comes from Google and React has been created by Facebook. Vue.js is a better choice than Angular and React when you are looking for a small app or a quick MVP development. That is because setting up a project and its configuration in Vue takes much less time than in frameworks mentioned earlier.</p>
<p>Okay, but where’s the new stuff you say? There you go:</p>
<p><img loading="lazy" decoding="async" data-attachment-id="1596" data-permalink="https://inero-software.com/?attachment_id=1596" data-orig-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-software-glify-10" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-1596 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h3><span style="color: #511b73;"><b>Web Components</b></span></h3>
<p><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" />Web components as it states on its website are: “&#8230;a set of web platform APIs that allow you to create new custom, reusable, encapsulated HTML tags to use in web pages and web apps. Custom components and widgets build on the Web Component standards, will work across modern browsers, and can be used with any JavaScript library or framework that works with HTML.”.</p>
<p>So essentially what it means is that you can create universal components with Web Components API which you can use with literally any framework (or no framework at all) that supports HTML and these components should work correctly on all modern browsers.</p>
<p>Probably the most popular library for creating web components right now is Polymer.<br />
Polymer is a JavaScript library based on Web Components API created by Google employees.<br />
Most important reasons for why Polymer is favored by Web Components developers are:<br />
• Data binding – Connects data from a custom element to its local DOM element. Both one-way and two-way.<br />
• Polymer CLI – Includes a build pipeline, a boilerplate generator for creating elements and apps, a linter, a development server, and a test runner.<br />
• Conditional and repeat templates – Gives you the ability to use loops and if statements in HTML<br />
And there’s much much more.</p>
<p><img loading="lazy" decoding="async" data-attachment-id="1596" data-permalink="https://inero-software.com/?attachment_id=1596" data-orig-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-software-glify-10" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-1596 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h3><span style="color: #511b73;"><b>WebAssembly</b></span></h3>
<p><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" />A different approach was proposed by creators of WebAssembly which basically allows you to use low-level languages like for example C, C++, and Rust to create web applications by compiling them to WebAssembly binary instruction format – assembly-like language that runs with near-native performance.</p>
<p>You probably wonder how is it possible to develop a web app with this kind of languages. Well, Wasm (WebAssembly) provides you with JS API, which contains all the functionalities that you would need in web development.</p>
<p>So is WebAssembly going to replace JavaScript in the web development world?</p>
<p>Not really. It is more of an addition to the current web technology stack. Wasm should be used in certain situations, and that situations are asset-heavy performance-needing applications. Usually with a lot of computations and 3d dynamic scenes. Here are a few examples of Wasm applications that should give you an idea of what I am talking about: Google Earth, Figma, AutoCad web.</p>
<p><img loading="lazy" decoding="async" data-attachment-id="1596" data-permalink="https://inero-software.com/?attachment_id=1596" data-orig-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-software-glify-10" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" data-large-file="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png" tabindex="0" role="button" class="aligncenter wp-image-1596 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png" alt="Separating icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10-80x80.png 80w, https://inero-software.com/wp-content/uploads/2018/11/inero-glify-10.png 208w" sizes="(max-width: 80px) 100vw, 80px" /></p>
<h3><span style="color: #511b73;"><b>Flutter</b></span></h3>
<p><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" />Another tool on the list is Flutter. Flutter originally was supposed to create mobile applications (and it still does), but in Flutter 1.9 web support has been added.<br />
Flutter uses Dart language and only this one language is used to develop applications for every intention is its frontend, backend, or mobile devices. So in theory your code for a mobile app or web app should not be that much different from each other.</p>
<p>One interesting thing about Flutter is a fact that it has built-in Material Design and Cupertino (iOS styled components) so it comes with a variety of very useful widgets and other advantages that those UI libraries offer (like motion APIs), you can check those out here.</p>
<p>This was just a really brief introduction to different frontend options out there, I’m going to make more detailed insight into those in next blog posts.</p>
<p>Now, at last, but not least:</p>
<h3><span style="color: #511b73;"><b>Svelte</b></span></h3>
<p><img decoding="async" data-attachment-id="2873" data-permalink="https://inero-software.com/digital-twins-a-dynamic-software-model-of-reality/inero-glify-08-2/" data-orig-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-orig-size="208,208" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="inero-glyph" data-image-description="" data-image-caption="" data-medium-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" data-large-file="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png" tabindex="0" role="button" class="alignleft wp-image-2873 size-thumbnail" src="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png" alt="Paragraph icon" width="80" height="80" srcset="https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-80x80.png 80w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08-50x50.png 50w, https://inero-software.com/wp-content/uploads/2019/10/inero-glify-08.png 208w" sizes="(max-width: 80px) 100vw, 80px" />Svelte has been introduced in 2016 by its creator Rich Harris. Stating that it’s going to use a truly reactive approach, but before we get into it let’s quickly describe what Svelte actually is.<br />
Svelte is a JavaScript component framework similar to React or Vue but with a few major differences.</p>
<p>Probably the most important difference is the fact that Svelte does not have a virtual DOM. React and Vue both are using Virtual DOM and because of that, the browser itself has to convert their declarative structures into DOM operations. I won’t go into details of how does virtual DOM works, but basically, what it does it checks the state of the whole application before and after the change and looks for differences in those both states and then applies what’s different to real DOM (this operation is called diffing), sounds like a lot of unnecessary comparisons, right?</p>
<p>Here comes the reactivity.</p>
<p>Svelte unlike React runs at build time which means that svelte code is compiled to imperative code which updates DOM when and where it needs to. This is obviously a big performance boost.</p>
<p>You probably started to wonder why is virtual DOM used by those big frameworks like React or Vue then. I think I can use a quote from the Svelte creator’s blog:</p>
<p>“Virtual DOM is valuable because it allows you to build apps without thinking about state transitions, with performance that is generally good enough. That means less buggy code, and more time spent on creative tasks instead of tedious ones. But it turns out that we can achieve a similar programming model without using virtual DOM — and that&#8217;s where Svelte comes in”</p>
<p>Another thing that Svelte introduces is its own reactive statements which look like this:</p>
<pre>$: console.log(`the count is ${count}`);</pre>
<p>Essentially what it&#8217;s going to do is &#8211; it is going to log the string whenever count property changes and the only thing that you need to do to use it is to put $: in front of a statement which you want to become reactive. To give you a better idea of how is it working I&#8217;m going to create a component in which you can type your first name and last name assign them to fullName property and display it.</p>
<pre class="language-javascript">&lt;script&gt;
 let firstName = '';
 let lastName = ''
 $: fullName = firstName + lastName
&lt;/script&gt;

&lt;input bind:value={firstName}/&gt;
&lt;input bind:value={lastName}/&gt;
{fullName}</pre>
<p>I will not go into details of everything that&#8217;s happening here but what you should know that bind:value is a two-way binding so the properties are being updated while typing in the input. The important part here is the dollar syntax. Thanks to it fullName property is changed at the same moment as user is typing anything in any of those two inputs.</p>
<p>Of course, nothing is stopping you from writing a larger code with dollar syntax. If I wanted to update fullName only if firstName starts with letter &#8220;A&#8221; I could write something like this:</p>
<pre>let fullName = '';
$: {
  if(firstName[0] === 'A') {
      fullName = firstName + lastName;
   }
}</pre>
<p>Now, to display the difference in code written in React (which Svelte is most of the cases compared to) and Svelte. We’re going to create a simple app that is going to display how many seconds passed since it’s creation. (Inspired by Stateful Component on <a href="https://reactjs.org/">React website</a>).</p>
<p>Here’s the code which you would write in those two frameworks:</p>
<p>React:</p>
<pre>class Timer extends React.Component {
    constructor(props) {
      super(props);
      this.state = { seconds: 0 };
    }

    tick() {
      this.setState(state =&gt; ({
       seconds: state.seconds + 1
    }));
    }

    componentDidMount() {
        this.interval = setInterval(() =&gt; this.tick(), 1000);
    }

    render() {
      return (
       &lt;div&gt;
        Seconds: {this.state.seconds}
      &lt;/div&gt;
    );
  }
}

ReactDOM.render(
&lt;Timer /&gt;,
document.getElementById('timer-example')
);</pre>
<p>Svelte:</p>
<pre>&lt;script&gt;
 let seconds = 0;
 setInterval(() =&gt; seconds += 1, 1000);
&lt;/script&gt;

&lt;div&gt;
Seconds: {seconds}
&lt;/div&gt;</pre>
<p>You can see the difference right?<br />
Both of those applications do exactly the same job, but it is immediately noticeable how much code was needed in the React app and also how readable it is with its state, setState, and rendering functions. At the same time, Svelte requires about 8 lines of pretty, easily understandable code to get the task done.</p>
<p>If you are interested in what else Svelte has to offer and to understand better why this framework could be worth trying I deeply encourage you to watch Rich Harris speech.</p>
<p>&nbsp;</p>
<p><iframe title="Rich Harris - Rethinking reactivity" width="1191" height="670" src="https://www.youtube.com/embed/AdNJ3fydeao?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<p>Artykuł <a href="https://inero-software.com/whats-after-angular/">What&#8217;s after Angular?</a> pochodzi z serwisu <a href="https://inero-software.com">Inero Software - Software Consulting</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2905</post-id>	</item>
	</channel>
</rss>
