Photo by Clément Hélardot on Unsplash

In an earlier post, we looked at how to turn an imperative file ingest Java program into one that uses Java Stream API. To recap, the goal of the example program is to read a bunch of contacts from a flat file, validate the data, and finally insert all validated contacts into the database.

We highlighted a few shortcomings with the program we wrote in the end, more specifically the less than ideal exception and resource handling mechanism.

In this post, I’d like to address specifically these two problems with a better code using the Reactive Stream library, specifically the…


Photo by Fabian9799 on Unsplash

Functional style of programming is becoming more accepted in mainstream practical programming for good reasons. For one, functional programming offers a few tools to simplify complicated logic with more readable code.

Today, many mainstream programming languages, including Java, have incorporated these functional programming constructs. We don’t have to switch to a pure functional programming language in order to embrace functional style programming and benefit from it.

In this article, we’ll use a well understood application to illustrate how functional programming can be applied to the data processing domain; We are going to look at how we can ingest a tab-delimited…


Photo by Startup Stock Photos from Pexels

I recently started a journey to explore the Kotlin programming language. This is what I’ve learned as part of my journey so far. This article is part of a 3 part series. If you haven’t read the first part, you can find it here.

Reason 2: Write Robust Code

After playing with Kotlin for a while, I believe there are a few language features that are designed to encourage us to write more robust code. We’ll go over them in this article.

Immutability

In Java, all variables are mutable by default; meaning they can’t be changed to a different value after initialization. Over the years, that’s…


Photo by Fatos Bytyqi on Unsplash

In the past two years, I’ve encountered the buzz about Kotlin the programming language more and more. Kotlin is not a new programming language at this point in time (Nov 2019). It was created in 2011 by the popular IDE maker, JetBrains, to build their IDEs. Its adoption has not been that great until Google announced first-class support for it on Android, and later as the officially preferred language for developing Android app in May 2019. …


Photo by Deva Darshan on Pexels.

Stream processing is a popular design pattern for data processing these days due to its flexibility and horizontal scalability. The fundamental requirement of stream processing is to split our data into individual pieces or events, so that they can be processed individually. Each event can also be thought of like a row or tuple in a relational database.

This pattern works really well for certain type of event, e.g. UI events, database update events, as they usually originate as individual events anyway. However, in a real application, often times we need to support bulk data upload using some type of…


UPDATE: Virtual Scrolling is now a standard feature in the Angular Framework (version 7). See https://blog.angular.io/version-7-of-angular-cli-prompts-virtual-scroll-drag-and-drop-and-more-c594e22e7b8c for details.

One of the very powerful tools in the Angular framework is the ngFor directive. With a simple snippet of code, one can do magical things with ngFor. Combined with automatic change detection, Angular’s ngFor will automagically render the view based on data elements in an array.

For example, the following code snippet will render the view items that correspond to each data element in the “items” array:

<div *ngFor="let item of items">{{item}}</div>

When we manipulate the array elements, e.g. by adding/removing array…

Yongtze Chi

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