Software Engineering Blog

Hadoop ecosystem, Scala, Java, Go, Micoroservices

Reactive Systems vs Reactive Programming

This is the digest of Reactive Programming versus Reactive Systems by Jonas Bonér and Viktor Klang. This is for anyone who does not have enough time to study the original white paper. It is the shortest version without sacrificing important stuff. Reactive - A Set Of Design Principles “Reactive” is a set of design principles for creating cohesive systems. In a Reactive System, it’s the interaction between the individual parts that makes all the difference, which is the ability to operate individually yet act in concert to achieve their intended result.

Practical Cats: Functor and Applicative

In this post, I ’m going to introduce you some useful aspects of Cats library, mostly code snippets and I ’m not going to delve into any theory or mathematics. Hopefully you will use them in your daily codes, resulting in much more simpler and readable code. map using Functor You are already familiar with the prominent map method in Scala. Informally, a functor is any context with a map method.

Case Study - Solve Crosswords Puzzle

As a software engineer, I always enjoy solving problems and that’s why I sometimes go to the coding challenge websites like hackerrank and pick one problem to solve. This time I searched in functional programming category and crosswords-101 caught my eye and I decided to solve it in Scala in a very clean and understandable way and not in a contest style way of programming! This article is going to reveal how I solved this puzzle.

Slick Actions Composition

Problem You want to insert a new row to a table which has auto increment primary key; Also some additional information must be persist in other tables. At the end you also want to return the inserted generated ID. Imaging you are developing a new web application, and you are working on user registration code. Each time a new user signs up, you want to store his credential in users table and all of his roles in userRoles table.

More Readable Code in Scala

As a Java developer, I ’ve always had argument with my colleagues to use Scala instead Java. They complained that Scala is a complex language and Java is a more readable and simple one so I never had the opportunity to use Scala well. Fortunately, recently I ’ve just joined to the startup company called snapptrip.com, and we use Scala for all the backend services. A few days ago, I was working on a peace of code in Scala to register a new user into the database.

Writing Internal DSL in Scala

Definition of DSL A DSL is a computer language, specialized for a specific domain. A DSL is essentially the opposite of a general programming languages(GPL), I mean every language that can be used to develop something. For example, Java, C#, and Scala are all GPL languages. With a DSL, we want only to solve a specific domain problem, so we design the language specifically for the domain. A DSL can’t be used outside of the domain, because it is not designed for flexibility.

Dev tools: ngrok

Have you ever wanted to show your work which is running on your local machine to your colleagues or friends? If they are far away of you, how will you show them? Will you upload your source code to github to share it with your friends? But what if you don’t like to share your source code with others? Will you run it on public or private cloud or something like that?

5 ways to customize Spring MVC JSON/XML output

To adhere to guidelines or requirements, API designers may want to control how JSON/XML responses are formatted. Spring Web makes use of Jackson to perform JSON/XML serialization. Therefore, to customize our output format, we must configure the Jackson processor. Spring Web offers XML-based or Java-based approaches to handling configuration. In this article, we will look at the Java-based configuration. Enable XML output First of all, if you have created your project through https://start.

Function Memorization in Go

Memoization is an optimization technique used to increase performance by storing the results of expensive function calls and returning the cached result when the same input occurs again. In this post I show how function memoization can be implemented in Go, in a pure functional manner. Based on wikipedia definition, a function may be considered a pure function if both of the following statements about the function hold: 1. The function always evaluates the same result value given the same argument value(s).

setcap Linux Command

Today I learned something new that I want to share with you. I knew that listening on port below 1024 requires special privilege, and to accomplish that you must be sudoers. But running applications with sudo is not a perfect way because that way the application can do almost anything to your operating system resulting unexpected results (you surely don’t want the application delete all your files by rm -rf).