Photo by Olivia Bauso on Unsplash

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…

Photo by Christian De Stradis on Unsplash

In Java, long-running tasks can be run in non-blocking manner by means of CompletableFuture. is used for asynchronous programming in Java. Normally, we can asynchronously run a task by the method which returns a new . The task is running in a thread pool and the returned is completed when the task is done. For example:

The method waits if necessary for the future to complete, and then returns the computation result. Useful methods on are

  • thenAccept(Consumer<? super T> action)
    It can run some code after receiving some value from asynchronously running task without…

Photo by Cassandra Dray on Unsplash

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:

  • Communication over messaging increases the system availability. Many message broker offer message delivery guarantees.
  • A message broker can buffer last messages which are then available for upcommig subscribers. This feature makes possible for an application to retrieve the last system state on initial load.
  • Using an unique identifier, called correlation Id, you can also solve the problem when some requests are processed faster than the…

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):

  • SQLite (file-based database on native devices)
  • IndexedDB
  • WebSQL
  • LocaleStorage

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 the first part, I will explain the bootstrapping process of such…

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 because classes are managed and instantiated by a DI container automatically. I would like to achieve the following minimalistic goals:

  • Use constructor based injection to inject class instances into each other.
  • For the sake of convenience, the injected classes exist as singletons inside a DI container. The class instances live inside the DI container.
  • Possibility to define an entry point (entry class) to bootstrap the DI container. …

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 and two input properties: and . 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…

Oleg Varaksin

Thoughts on software development. Author of “PrimeFaces Cookbook” and “Angular UI Development with PrimeNG”. My old blog:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store