Data caching is a widespread technique in the programming. It allows to quickly retrieve data without making long-running operations. But there is a problem with caching of data retrieved as result of some long-running operation. If a cache value is missed, it will be requested. If it is requested by a long-running HTTP request or SQL command, the next request for the cache value can leads to multiple HTTP requests / SQL commands again and again. I was looking for a cache implementation which solves this issue in projects using Project Reactor. Project Reactor is built on top of the…
In Java, long-running tasks can be run in non-blocking manner by means of CompletableFuture.
CompletableFuture is used for asynchronous programming in Java. Normally, we can asynchronously run a task by the method
supplyAsync(Supplier<U> task) which returns a new
CompletableFuture. The task is running in a thread pool and the returned
CompletableFuture is completed when the task is done. For example:
get() waits if necessary for the future to complete, and then returns the computation result. Useful methods on
The request-reply pattern over messaging uses a message broker as a communication medium. There are a lot of advantages of this pattern over traditional RESTful communication between client and server. Just to mention a few:
As a full-stack developer, I have to switch between several programming languages in my day-to-day business: Java (backend), TypeScript (web dev) and Dart (mobile dev). In this blog post, I will try to demonstrate fourteen built-in language constructs in TypeScript and Dart which convinced me to believe that these languages are more sophisticated and flexible than Java. You can already see in the picture above how fluent you can build collections in Dart using conditionals and repetition. These features are called “collection for” and “collection if”. Neat? But there are more. As you could also see, the type information in…
Ionic Storage offers a LocalStorage-like API and can be configured for various storage engines. It also allows to persist many types of data, e.g. strings, numbers and blobs. The default order of storage engines which are tried to be used (from top to bottom):
It depends on the availability of concret storage engine if it will be used or not. IndexedDB, as data storage in browser, should be preferred over LocaleStorage because it offers asynchronous read / write operations and doesn’t block the main thread. …
In this blog post, I would like to share my thoughts how to build a pluggable Angular Frontend with modules which you can combine together like a puzzle. Modules should not know each other — that means, they don’t have cross-dependencies. Modules should be lazy loaded at runtime by means of backend configuration which specifies what modules your UI has exactly. In other words, the functionality scope depends on the logged in user, more exactly on the user role, such as “customer”, “developer”, etc. You got the idea.
In this blog post, I will try to explain a possible way how to implement a dependency injection in TypeScript. An injection means, you don’t need to call
new MyClass() because classes are managed and instantiated by a DI container automatically. I would like to achieve the following minimalistic goals:
There are two main ways to write utility functions in TypeScript:
A) Quite normal functions (grouped in a file)
B) Static methods of a class
Examples of both:
What is the best one? The answer is A). In the TypeScript documentation says:
“Consumers of your module should have as little friction as possible when using things that you export. Adding too many levels of nesting tends to be cumbersome, so think carefully about how you want to structure things. Exporting a namespace from your module is an example of adding too many layers of nesting. While namespaces sometime…
In my last post, I wrote about event handling with RxJS. In this post we will use the same technique, but for an Angular directive — a draggable directive. This directive can be applied to any HTML element in order to make this element draggable. It should have the selector
draggable and two input properties:
dragTarget. The first property defines a CSS selector of an element which is used as drag handle. The second property defines a CSS selector of an element which you want to drag.
I wrote this directive for the Angular Material dialog because the…